In completing this deliverable, you will focus on constraints and functions in PL/pgSQL.
You probably have already identified keys, and some of you have already specified keys in your schema. But in your last deliverable, you may have found that you needed to remove those specifications in order to see the time savings resulting from the indexes. In any event, modify your database schema to include the declaration of keys for all relations and at least one foreign-key constraint for some relation (even if you decided that no such constraints should logically hold -- we assume almost every project will have some natural foreign-key constraints). Show us the resulting database schema and the result of successfully declaring these relations to the database system.
Submit a listing of your programs and scripts showing them working. You should demonstrate that the programs had their intended effect by querying a relation changed by your program both before and after the change. The queries demonstrating the effects may be included in the file that holds your PL/pgSQL programs for convenience, but the results or output should be in an appropriate output file.
Submit your trigger code and a script showing the function and trigger declared. Also, the script should show the effect of a database modification that exercises the trigger. In your script, include queries that demonstrate the trigger's effect.
As with your last project component, please create a tar or zip file that expands to create a directory identified by your Postgres user name followed by "p4". Please name the tar/zip file in the same way (followed by the appropriate file extension). For example, if your postgreSQL user-name is "henry", your tar file should be called "henryp4.tar" and it should expand to create a new directory called "henryp4". This directory should contain the relevant files, appropriately named, required for this deliverable. For each task, you should have an input script file (with .sql extension) and a corresponding output file. As always, include the table creation and initialization scripts with your submissions.