summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-05-09 22:38:05 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-05-09 22:38:05 +0000
commit7baef60c8b6b178f43379810b1cb89664905208a (patch)
tree222cba7d57dbc836c8fe657b1c098237103d63c3
parente29ed89781fac6852c0b0e0e95c56f61a6eda66b (diff)
downloadpostgresql-7baef60c8b6b178f43379810b1cb89664905208a.tar.gz
Fix an ancient oversight in change_varattnos_of_a_node: it neglected to update
varoattno along with varattno. This resulted in having Vars that were not seen as equal(), causing inheritance of the "same" constraint from different parent relations to fail. An example is create table pp1 (f1 int check (f1>0)); create table cc1 (f2 text, f3 int) inherits (pp1); create table cc2(f4 float) inherits(pp1,cc1); Backpatch as far as 7.4. (The test case still fails in 7.4, for reasons that I don't feel like investigating at the moment.) This is a backpatch commit only. The fix will be applied in HEAD as part of the upcoming pg_constraint patch.
-rw-r--r--src/backend/commands/tablecmds.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 7bd8cbe8ff..97caafbb8e 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.91.2.2 2004/11/17 00:18:23 neilc Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.91.2.3 2008/05/09 22:38:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -877,7 +877,7 @@ change_varattnos_walker(Node *node, const AttrNumber *newattno)
* such a node currently.
*/
Assert(newattno[var->varattno - 1] > 0);
- var->varattno = newattno[var->varattno - 1];
+ var->varattno = var->varoattno = newattno[var->varattno - 1];
}
return false;
}