| From: | "Andrus" <noeetasoftspam(at)online(dot)ee> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Which record causes referential integrity violation on delete |
| Date: | 2005-07-01 18:49:27 |
| Message-ID: | da43e6$26sl$2@news.hub.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stephane Bortzmeyer | 2005-07-01 19:47:01 | Re: How to uninstall PostGreSql from linux |
| Previous Message | Andrus | 2005-07-01 18:43:34 | Re: Hot to restrict access to subset of data |