1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-03 22:24:49 +03:00

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.
This commit is contained in:
Bruce Momjian 2000-10-10 17:13:30 +00:00
parent f350481134
commit e7b069ced1

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* The PerformAddAttribute() code, like most of the relation * The PerformAddAttribute() code, like most of the relation
@ -1389,15 +1389,18 @@ AlterTableAddConstraint(char *relationName,
{ {
Ident *fk_at = lfirst(list); 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) foreach(list, fkconstraint->pk_attrs)
{ {
Ident *pk_at = lfirst(list); 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); scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL);
AssertState(scan != NULL); AssertState(scan != NULL);