diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-02-01 19:28:56 +0000 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-02-01 19:28:56 +0000 |
commit | 63f9282f6e7a4afed8826437cea6e92d9e4b0869 (patch) | |
tree | 1c8c2e4c0d1fd5294e374a236585cbce210de4f6 /src/backend/optimizer/prep/prepunion.c | |
parent | 1526d4e38fc5a067ffa9779be34d4dbcfdf8ea5f (diff) | |
download | postgresql-63f9282f6e7a4afed8826437cea6e92d9e4b0869.tar.gz postgresql-63f9282f6e7a4afed8826437cea6e92d9e4b0869.zip |
Tighten integrity checks on ALTER TABLE ... ALTER COLUMN ... RENAME.
When a column is renamed, we recursively rename the same column in
all descendent tables. But if one of those tables also inherits that
column from a table outside the inheritance hierarchy rooted at the
named table, we must throw an error. The previous coding correctly
prohibited the rename when the parent had inherited the column from
elsewhere, but overlooked the case where the parent was OK but a child
table also inherited the same column from a second, unrelated parent.
For now, not backpatched due to lack of complaints from the field.
KaiGai Kohei, with further changes by me.
Reviewed by Bernd Helme and Tom Lane.
Diffstat (limited to 'src/backend/optimizer/prep/prepunion.c')
-rw-r--r-- | src/backend/optimizer/prep/prepunion.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index 4eb2859e09c..560afaaa240 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.179 2010/01/02 16:57:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.180 2010/02/01 19:28:56 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -1180,7 +1180,7 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti) lockmode = AccessShareLock; /* Scan for all members of inheritance set, acquire needed locks */ - inhOIDs = find_all_inheritors(parentOID, lockmode); + inhOIDs = find_all_inheritors(parentOID, lockmode, NULL); /* * Check that there's at least one descendant, else treat as no-child |