Which record causes referential integrity violation on delete

Поиск
Список
Период
Сортировка
От Andrus
Тема Which record causes referential integrity violation on delete
Дата
Msg-id da43e6$26sl$2@news.hub.org
обсуждение исходный текст
Ответы Re: Which record causes referential integrity violation on delete  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Which record causes referential integrity violation on delete  (Dawid Kuroczko <qnex42@gmail.com>)
Re: Which record causes referential integrity violation on delete  (Martin Boese <boesemar@gmx.de>)
Re: Which record causes referential integrity violation on delete  ("Greg Sabino Mullane" <greg@turnstep.com>)
Список pgsql-general
In Postgres 8 I tried commad

DELETE FROM customer WHERE id=123

but got an error

ERROR:  update or delete on "customer" violates foreign key constraint
"invoice_customer_fkey" on "invoice"'

How to determine the primary key of invoice table which causes this error
in generic way ?

Why Postgres does not report primary key value in error message ?

I it is not possible to add more information to error I need function which
takes 3 arguments:

table name ('customer')
field name  ('id')
field value (123)

and returns the name of the table and primary key value which blocks
record deletion.

I looked to the ODBC log, but this does'nt contain more information
about error !?

Andrus.



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

Предыдущее
От: Stephane Bortzmeyer
Дата:
Сообщение: Re: How to uninstall PostGreSql from linux
Следующее
От: "Andrus"
Дата:
Сообщение: Re: Hot to restrict access to subset of data