辅导COMP9311 20T2程序、Database程序 写作

” 辅导COMP9311 20T2程序、Database程序 写作COMP9311 20T2 – Assignment 2Testing FacilitiesDatabase SystemsLast updated: Sunday 7th July 2:53pmMost recent changes are shown in red … older changes are shown in brown.[Assignment Spec] [Database] [Schema Summary] [Testing] [Samples]This document describes the testing facilities available for Assignment 2.After creating the database and loading the mymyunsw.dump, you have a basic MyMyUNSW database,with all of the data tables and their tuples.To help test you views and functions against the Assignment 2 database, it is very useful to load one morefile, whose contents are described in more detail below. Use the following command to do this:$ psql ass2 -f /home/cs9311/web/20T2/assignments/2/check.sqlThis loads some additional tables containing expected results for calls to the views and functions. In orderto prevent problems with People loading it multiple times and producing incorrect expected results tables, itdrops each table before loading it. A side-effect of this is that the very first time you load the check.sqlfile, you may receive some messages like:psql:check.sql:141: NOTICE: type testingresult does not exist, skipping…psql:check.sql:410: NOTICE: table q1_expected does not exist, skippingDROP TABLE…psql:check.sql:421: NOTICE: table q2_expected does not exist, skippingDROP TABLE 辅导COMP9311 20T2作业、Database作业 写作.As long as these are all NOTICEs and not ERRORs, everything is ok. Youll get these notices messagesevery time you load check.sql into a fresh copy of the MyMyUNSW database. You can safely ignorethem, as long as they are accompanied by CREATE TABLE messages.The check.sql file contains examples of expected output for the Assignment 2 exercises and functions touse this data to check your views/functions. The expected outputs are mostly available in the form of tableswith names like q1_expected, q3_expected, q8a_expected, and so on. The expected results are usedby the checking functions, but you can also use them by hand to get some idea of the expected resultsthat your SQL queries should be producing, e.g.$ psql ass2… PostgreSQL welcome stuff …ass2=# select * from q1_expected;… table showing expected results for select * from Q1; …ass2=# select * from q2_expected;… table showing expected results for select * from Q2; …ass2=# … etc. etc. etc.The expected results tables were generated from queries like the following:q1 … select * from Q1 order by …;q2 … select * from Q2 order by …;…q8a … select * from Q8(arg1, …);…etc. etc. etc.The checking scripts also use these queries, and you can use them yourself for your initial checks on thecorrectness of your queries.2020/7/15 COMP9311 20T2 – Assignment 2 httpss://cgi.cse.unsw.edu.au/~cs9311/20T2/assignments/2/checking.php 2/2The check.sql file also contains a collection of PLpgSQL functions that take your views/functions andcompare their results against the expected results. They assume that your views are defined the same as inthe ass2.sql file. The check functions are invoked as follows:ass2=# select check_q1();… gives a message on correctness of Q1 view …ass2=# select check_q2();… gives a message on correctness of Q2 view …ass2=# select check_q8a();… gives a message on correctness of Q8 function for one example query …The check_qX() functions test for the following conditions:your view/function (QX) does not yet existyour view returns too many tuplesyour view is missing some tuplesyour view has extra tuples and is missing othersNote that the most likely reason for the last condition being reported is that the format of individual attributesdoes not match the required format. You can check this by examining the results of your view and theexpected Results closely; looking for subtle table alignment/layout differences. Having just one extra spaceis not treated As a trivial error, because its possible that the output of these views (in a real-life scenario)might be used as Input to some other program, which could crash because the expected format was notfollowed exactly.Note also that if you type the name of a check_qX() function incorrectly, PostgreSQL gives you thefollowing error message:ass2=# select * from check_q33();ERROR: function check_q33() does not existHINT: No function matches the given name and argument types.You may need to add explicit type casts.The error is useful; the hint about adding explicit type casts is not useful.The check.sql file has one checking function for each of the expected results tables (i.e. for each testcase). There is also a function that will run all of the checking functions and produce a table of test/resultpairs, which Eventually should look like:ass2=# select * from check_all();test | result——+———q1 | correctq2 | correct…q8a | correct…(N rows)Note that it may take some time to produce results because some of the individual tests are slow.While youre not required to completely understand the code in check.sql at this stage, it might be usefulto take a look through it. You might pick up a few useful tricks.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导