> 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:
>
> sprintf(ident, "%s$%u", trigger->tgname, rel->rd_id);
> plan = find_plan(ident, &FPlans, &nFPlans);
>
> before line 483 which is:
> ret = SPI_execp(plan->splan[r], kvals, NULL, tcount);
Please send a context diff to the patches list.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026