pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedSPI_connect problems
2+ messages / 2 participants
[nested] [flat]
* SPI_connect problems
@ 2000-08-22 09:03 Joonas Makkonen <joonas.makkonen@infosto.fi>
0 siblings, 1 reply; 2+ messages in thread
From: Joonas Makkonen @ 2000-08-22 09:03 UTC (permalink / raw)
To: pgsql-interfaces
I have a trigger function written in C that uses SPI to fetch certain data
from the db. The problem is that about 20% of the time SPI_connect()
returns:
NOTICE: SPI_connect() failed in RI_FKey_check()
Any ideas what might be causing this?
Joonas Makkonen
Attachments:
smime.p7s (application/x-pkcs7-signature, 2.8K) download
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: SPI_connect problems
@ 2000-08-22 14:32 Tom Lane <tgl@sss.pgh.pa.us>
parent: Joonas Makkonen <joonas.makkonen@infosto.fi>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2000-08-22 14:32 UTC (permalink / raw)
To: Joonas Makkonen <joonas.makkonen@infosto.fi>; +Cc: pgsql-interfaces
"Joonas Makkonen" <joonas.makkonen@infosto.fi> writes:
> I have a trigger function written in C that uses SPI to fetch certain data
> from the db. The problem is that about 20% of the time SPI_connect()
> returns:
> NOTICE: SPI_connect() failed in RI_FKey_check()
> Any ideas what might be causing this?
It looks like you have some referential integrity triggers in your
database that are getting fired during the query you execute from your
SPI call. The RI triggers also use SPI. Recursive entry to SPI is
supposed to work, but evidently SPI_connect() isn't happy. After a
quick look at the code (see src/backend/executor/spi.c) it seems the
only way that could happen is if there's a mismatch of SPI_push and
SPI_pop operations, leaving _SPI_curid pointing at the wrong stack
level. This might be your error, or it might be a bug in the RI
trigger code or in SPI itself. I'd suggest tracing through the
SPI operations (use a debugger, or insert printf()s) until you
understand what's happening.
BTW, the RI code is in src/backend/utils/adt/ri_triggers.c
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-08-22 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-22 09:03 SPI_connect problems Joonas Makkonen <joonas.makkonen@infosto.fi>
2000-08-22 14:32 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox