Skip to content

Commit e7b069c

Browse files
committed
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.
1 parent f350481 commit e7b069c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/backend/commands/command.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.105 2000/10/05 19:48:22 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.106 2000/10/10 17:13:30 momjian Exp $
1212
*
1313
* NOTES
1414
* The PerformAddAttribute() code, like most of the relation
@@ -1389,15 +1389,18 @@ AlterTableAddConstraint(char *relationName,
13891389
{
13901390
Ident *fk_at = lfirst(list);
13911391

1392-
trig.tgargs[count++] = fk_at->name;
1392+
trig.tgargs[count] = fk_at->name;
1393+
count+=2;
13931394
}
1395+
count = 5;
13941396
foreach(list, fkconstraint->pk_attrs)
13951397
{
13961398
Ident *pk_at = lfirst(list);
13971399

1398-
trig.tgargs[count++] = pk_at->name;
1400+
trig.tgargs[count] = pk_at->name;
1401+
count+=2;
13991402
}
1400-
trig.tgnargs = count;
1403+
trig.tgnargs = count-1;
14011404

14021405
scan = heap_beginscan(rel, false, SnapshotNow, 0, NULL);
14031406
AssertState(scan != NULL);

0 commit comments

Comments
 (0)