From e7b069ced1644f9da0002ad80d0bd65ae92ed277 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 10 Oct 2000 17:13:30 +0000 Subject: [PATCH] This is a stupid garden variety bug and I'm not sure why I didn't catch it previously. The patch included is against fairly current sources, but it may apply cleanly against 7.0.2 as well. On Fri, 6 Oct 2000, Vilson farias wrote: > I found a irregular behavior with constraints. > > I can only set a referencial integrity between these tables when there are > no data, even if there are no change to referential integrity violation. --- src/backend/commands/command.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c index 36f77f1bd6..a9b16c009e 100644 --- a/src/backend/commands/command.c +++ b/src/backend/commands/command.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.105 2000/10/05 19:48:22 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.106 2000/10/10 17:13:30 momjian Exp $ * * NOTES * The PerformAddAttribute() code, like most of the relation @@ -1389,15 +1389,18 @@ AlterTableAddConstraint(char *relationName, { Ident *fk_at = lfirst(list); - trig.tgargs[count++] = fk_at->name; + trig.tgargs[count] = fk_at->name; + count+=2; } + count = 5; foreach(list, fkconstraint->pk_attrs) { Ident *pk_at = lfirst(list); - trig.tgargs[count++] = pk_at->name; + trig.tgargs[count] = pk_at->name; + count+=2; } - trig.tgnargs = count; + trig.tgnargs = count-1; scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL); AssertState(scan != NULL); -- 2.40.0