Re: BUG #2294: SPI_connect() fails in trigger when a Foreignkey constraint exists on same table as trigger. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2294: SPI_connect() fails in trigger when a Foreignkey constraint exists on same table as trigger.
Date
Msg-id 3050.1141314273@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #2294: SPI_connect() fails in trigger when a Foreignkey constraint exists on same table as trigger.  ("Jim Fitzgerald" <jfitz@spacelink.com>)
List pgsql-bugs
"Jim Fitzgerald" <jfitz@spacelink.com> writes:
>   It is notable, however, that Postgres is not emitting the following:
>         WARNING:  transaction left non-empty SPI stack
>         HINT:  Check for missing "SPI_finish" calls.

Well, no, because control isn't going to get that far before the
mismatched SPI_connect/SPI_finish calls are noted.

If your theory of the problem were correct then the RI triggers
themselves would cause failures whenever a table had more than one
foreign key.  I feel fairly confident that it's just a bug in your
trigger code.  Aside from the missing SPI_finish, you might be needing
SPI_push/SPI_pop calls if the trigger code invokes anything that might
itself call SPI.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2292: Calling conventions in docs
Next
From: Tom Lane
Date:
Subject: Re: BUG #2295: MemoryContextSwitchTo missing