Thread: I get an error with Foreign Keys

I get an error with Foreign Keys

From
Brian Powell
Date:
I have around 40 tables defined, many relying on data in others so I have
foreign key constraints.  However, whenever I try to delete from any table,
I get:

ERROR:  SPI_execp() failed in RI_FKey_cascade_del()

What generates this?  I need assistance in knowing where to begin.  I
checked again, and I could not find any circular foreign key constraints...

Any help on where to search is appreciated.

Thanks,

--Brian



Re: I get an error with Foreign Keys

From
Stephan Szabo
Date:
On Thu, 30 Nov 2000, Brian Powell wrote:

> I have around 40 tables defined, many relying on data in others so I have
> foreign key constraints.  However, whenever I try to delete from any table,
> I get:
> 
> ERROR:  SPI_execp() failed in RI_FKey_cascade_del()
> 
> What generates this?  I need assistance in knowing where to begin.  I
> checked again, and I could not find any circular foreign key constraints...

Hmm, that might mean that the statement being generated inside the
trigger is incorrect in some way that isn't being reported.  Can you 
send a schema dump of your tables and I'll see if I can reproduce it.

BTW: The code in question is probably in src/backend/utils/ri_*.c [I
can't remember the exact ending of the filename].  It should be building
a statement and attempting to execute it using the SPI interface and
it looks like the execute is failing I'd guess by the message.