Skip site navigation (1) Skip section navigation (2)

pgsql: Fix dependencies generated during ALTER TABLE ADD CONSTRAINTUSI

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix dependencies generated during ALTER TABLE ADD CONSTRAINTUSI
Date: 2012-08-11 16:51:55
Message-ID: E1T0Eup-0002zd-A5@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Fix dependencies generated during ALTER TABLE ADD CONSTRAINT USING INDEX.

This command generated new pg_depend entries linking the index to the
constraint and the constraint to the table, which match the entries made
when a unique or primary key constraint is built de novo.  However, it did
not bother to get rid of the entries linking the index directly to the
table.  We had considered the issue when the ADD CONSTRAINT USING INDEX
patch was written, and concluded that we didn't need to get rid of the
extra entries.  But this is wrong: ALTER COLUMN TYPE wasn't expecting such
redundant dependencies to exist, as reported by Hubert Depesz Lubaczewski.
On reflection it seems rather likely to break other things as well, since
there are many bits of code that crawl pg_depend for one purpose or
another, and most of them are pretty naive about what relationships they're
expecting to find.  Fortunately it's not that hard to get rid of the extra
dependency entries, so let's do that.

Back-patch to 9.1, where ALTER TABLE ADD CONSTRAINT USING INDEX was added.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/b2cc6119591cd6428e0235c8cae44cf976783d7c

Modified Files
--------------
src/backend/catalog/index.c      |   25 +++++++++++++++++++------
src/backend/commands/tablecmds.c |    3 ++-
src/include/catalog/index.h      |    1 +
3 files changed, 22 insertions(+), 7 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-08-11 17:51:53
Subject: pgsql: Add link from COPY ref page to psql \copy.
Previous:From: Hiroshi SaitoDate: 2012-08-11 12:52:50
Subject: psqlodbc - psqlodbc: add the change history.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group