postgresql/contrib/adddepend
2002-12-02 00:29:01 +00:00
..
adddepend Fix dependency generation for multicolumn foreign keys. From Adam Buraczewski. 2002-12-02 00:28:29 +00:00
README.adddepend Fix script name in README. 2002-12-02 00:29:01 +00:00

            Dependency Additions For PostgreSQL 7.3 Upgrades

In PostgreSQL releases prior to 7.3, certain database objects didn't
have proper dependencies.  For example:

1) When you created a table with a SERIAL column, there was no linkage
to its underlying sequence.  If you dropped the table with the SERIAL
column, the sequence was not automatically dropped.  

2) When you created a foreign key, it created three triggers.  If you
wanted to drop the foreign key, you had to drop the three triggers
individually.

3) When you created a column with constraint UNIQUE, a unique index was
created but there was no indication that the index was created as a
UNIQUE column constraint.

Fortunately, 7.3 now tracks such dependencies and handles these cases. 
Unfortunately, PostgreSQL dumps from prior releases don't contain
such dependency information.

This script operates on >= 7.3 databases and adds dependency information
for the objects listed above.  It prompts the user on whether to create
a linkage for each object.  You can use the -Y option to prevent such
prompting and have it generate all possible linkages.

This program requires the Pg:DBD Perl interface.

Usage:

  adddepend [options] [dbname [username]]

Options:
  -d <dbname>     Specify database name to connect to (default: postgres)
  -h <host>       Specify database server host (default: localhost)
  -p <port>       Specify database server port (default: 5432)
  -u <username>   Specify database username (default: postgres)
  --password=<pw> Specify database password (default: blank)

  -Y              The script normally asks whether the user wishes to apply 
                  the conversion for each item found.  This forces YES to all
                  questions.

Rod Taylor <rbt@rbt.ca>