Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit31b6fc0

Browse files
committed
Fix inheritance count tracking in ALTER TABLE .. ADD CONSTRAINT.
Without this patch, constraints inherited by children of a parenttable which itself has multiple inheritance parents can end up withthe wrong coninhcount. After dropping the constraint, the childrenend up with a leftover copy of the constraint that is not dumpedand cannot be dropped. There is a similar problem with ALTER TABLE.. ADD COLUMN, but that looks significantly more difficult toresolve, so I'm committing this fix separately.Back-patch to 8.4, which is the first release that has coninhcount.Report by Hank Enting.
1 parent8c19d14 commit31b6fc0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.337 2010/07/29 19:23:20 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.338 2010/08/03 15:47:02 rhaas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -4890,6 +4890,15 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
48904890
/* Advance command counter in case same table is visited multiple times */
48914891
CommandCounterIncrement();
48924892

4893+
/*
4894+
* If the constraint got merged with an existing constraint, we're done.
4895+
* We mustn't recurse to child tables in this case, because they've already
4896+
* got the constraint, and visiting them again would lead to an incorrect
4897+
* value for coninhcount.
4898+
*/
4899+
if (newcons==NIL)
4900+
return;
4901+
48934902
/*
48944903
* Propagate to children as appropriate. Unlike most other ALTER
48954904
* routines, we have to do this one level of recursion at a time; we can't

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp