Re: [GENERAL] Bug in contrib/spi/refint.c - Mailing list pgsql-general

From Bruce Momjian
Subject Re: [GENERAL] Bug in contrib/spi/refint.c
Date
Msg-id 199810022236.SAA22627@candle.pha.pa.us
Whole thread Raw
In response to Bug in contrib/spi/refint.c  (Anand Surelia <anand@bytekinc.com>)
List pgsql-general
> 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


pgsql-general by date:

Previous
From: Anand Surelia
Date:
Subject: Bug in contrib/spi/refint.c
Next
From: michel@michel.enter.it
Date:
Subject: subscribe pgsql-general