Re: SPI_connect problems

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SPI_connect problems
Дата
Msg-id 5776.966954748@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SPI_connect problems  ("Joonas Makkonen" <joonas.makkonen@infosto.fi>)
Список 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


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: John Thorhauer
Дата:
Сообщение: odbc blob
Следующее
От: Gérald de Roany
Дата:
Сообщение: a question of TIME