summaryrefslogtreecommitdiff
path: root/contrib/spi/refint.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-10-06 03:12:59 +0000
committerBruce Momjian <bruce@momjian.us>1998-10-06 03:12:59 +0000
commit3abf496b8eb7619a576b135b447a78fb8cfb1fc1 (patch)
tree1d3335c6103ae6bdf2b2aea32ea278149eadf0d2 /contrib/spi/refint.c
parentb7ed6f8512b40ce7b82de0cb084452ca11277b84 (diff)
> > There is a bug in check_foreign_key of refint.c which is bundled with
> > the standard distribution. It occurs when a trigger calling this > > function recursively fires another trigger which calls the same > > function. The calling check_foreign_key loses its plan informantion and > > when it tries to use it the backend closes its channel. You can check it > > with the sql script I am attaching below. > > The solution to this is to do a find_plan again before executing it at > > line 483 of refint.c. > > Therefore two more lines should be added before line 483: Anand Surelia
Diffstat (limited to 'contrib/spi/refint.c')
-rw-r--r--contrib/spi/refint.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c
index 954e12c5905..ca9ffa72881 100644
--- a/contrib/spi/refint.c
+++ b/contrib/spi/refint.c
@@ -480,6 +480,8 @@ check_foreign_key()
relname = args[0];
+ sprintf(ident, "%s$%u", trigger->tgname, rel->rd_id);
+ plan = find_plan(ident, &FPlans, &nFPlans);
ret = SPI_execp(plan->splan[r], kvals, NULL, tcount);
/* we have no NULLs - so we pass ^^^^ here */