From 0882951b0cdb4c6686e57121d56216cb2044f7eb Mon Sep 17 00:00:00 2001 From: Jan Wieck Date: Wed, 8 Dec 1999 20:41:22 +0000 Subject: [PATCH] Fixed concurrent visibility bug. Jan --- src/backend/utils/adt/ri_triggers.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index e9942a7fad..a9b5c7cf2d 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -6,7 +6,7 @@ * * 1999 Jan Wieck * - * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.8 1999/12/07 00:13:41 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.9 1999/12/08 20:41:22 wieck Exp $ * * ---------- */ @@ -231,7 +231,8 @@ RI_FKey_check (FmgrInfo *proinfo) * SELECT oid FROM * ---------- */ - sprintf(querystr, "SELECT oid FROM \"%s\"", + sprintf(querystr, "SELECT oid FROM \"%s\" FOR UPDATE OF \"%s\"", + tgargs[RI_PK_RELNAME_ARGNO], tgargs[RI_PK_RELNAME_ARGNO]); /* ---------- @@ -378,6 +379,9 @@ RI_FKey_check (FmgrInfo *proinfo) queryoids[i] = SPI_gettypeid(fk_rel->rd_att, qkey.keypair[i][RI_KEYPAIR_FK_IDX]); } + sprintf(buf, " FOR UPDATE OF \"%s\"", + tgargs[RI_PK_RELNAME_ARGNO]); + strcat(querystr, buf); /* ---------- * Prepare, save and remember the new plan. @@ -1021,6 +1025,9 @@ RI_FKey_restrict_del (FmgrInfo *proinfo) queryoids[i] = SPI_gettypeid(pk_rel->rd_att, qkey.keypair[i][RI_KEYPAIR_PK_IDX]); } + sprintf(buf, " FOR UPDATE OF \"%s\"", + tgargs[RI_FK_RELNAME_ARGNO]); + strcat(querystr, buf); /* ---------- * Prepare, save and remember the new plan. @@ -1234,6 +1241,9 @@ RI_FKey_restrict_upd (FmgrInfo *proinfo) queryoids[i] = SPI_gettypeid(pk_rel->rd_att, qkey.keypair[i][RI_KEYPAIR_PK_IDX]); } + sprintf(buf, " FOR UPDATE OF \"%s\"", + tgargs[RI_FK_RELNAME_ARGNO]); + strcat(querystr, buf); /* ---------- * Prepare, save and remember the new plan.