Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del()
От
Stephan Szabo
Тема
Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del()
Дата
Msg-id
20020612171131.Y96675-100000@megazone23.bigpanda.com
Ответ на
Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del() (Joshua b. Jore)
Список
Дерево обсуждения
Troubleshooting SPI_execp() failed in RI_FKey_cascade_del() "Joshua b. Jore" <josh@greentechnologist.org>
Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del() Stephan Szabo <sszabo@megazone23.bigpanda.com>
Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del() "Joshua b. Jore" <josh@greentechnologist.org>
Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del() Stephan Szabo <sszabo@megazone23.bigpanda.com>
Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del() Tom Lane <tgl@sss.pgh.pa.us>
Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del() Stephan Szabo <sszabo@megazone23.bigpanda.com>
Re: Troubleshooting SPI_execp() failed in RI_FKey_cascade_del() "Joshua b. Jore" <josh@greentechnologist.org>
On Wed, 12 Jun 2002, Joshua b. Jore wrote: > The following sql demonstrates the problem. What I'm getting at here is > cases where the rows in "b" are being altered instead of being deleted > consequently the delete to "a" shouldn't happen. > > create table a (id int4 primary key); > create table b (id int4 references a on delete cascade); > create rule b0 as on delete to b do instead nothing; > > insert into a values (1); > insert into b values (1); > delete from a; When you do the delete from a, the constraint will no longer be satisifed. It throws the error to prevent the delete from working. Maybe throwing a standard constraint violation would be enough, but I'd worry that there'd be some other return case that we should know about. In general on rules with on action foreign key constraints are a bad idea. I'd almost want to disallow the above entirely.
В списке pgsql-general по дате отправления