postgresql/contrib/adddepend
Bruce Momjian 51d16423ae - Corrections for tables, columns with uppercase characters
- Don't attempt to convert partial or expressional unique indexes
- Don't attempt to convert unique indexes based on a non-default
opclasses

- Untested prevention of conversion of non-btree indexes unique
indexes.  Untested as postgresql doesn't allow hash, gist, or rtree
based indexes to be unique.

rbt=# create unique index t on a using hash (col);
ERROR:  DefineIndex: access method "hash" does not support UNIQUE
indexes
rbt=# create unique index t on a using gist (col);
ERROR:  DefineIndex: access method "gist" does not support UNIQUE
indexes
rbt=# select version();
                                version
------------------------------------------------------------------------
 PostgreSQL 7.4devel on i386-unknown-freebsd4.8, compiled by GCC 2.95.4

Rod Taylor
2003-06-25 01:11:09 +00:00
..
README.adddepend - Corrections for tables, columns with uppercase characters 2003-06-25 01:11:09 +00:00
adddepend - Corrections for tables, columns with uppercase characters 2003-06-25 01:11:09 +00:00

README.adddepend

            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, PostgreSQL 7.3 and later 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 <pg@rbt.ca>