Re: bad error message - Mailing list pgsql-general

From Jonathan Vanasco
Subject Re: bad error message
Date
Msg-id 911F5634-328B-4141-B713-6543372C4BAD@2xlp.com
Whole thread Raw
In response to Re: bad error message  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Responses Re: bad error message  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Oct 12, 2006, at 3:44 PM, A. Kretschmer wrote:

> Can you show us your SQL? The message is clear: you create a new table
> with a foreign key to an other table that doesn't exist. An example:

Yes, I know that part.  The error message is bad though, because it
doesn't tell me exactly where the error is.

I got as an error
    ERROR:  column "id" referenced in foreign key constraint does not exist

I should have gotten something like
    ERROR:  column "id" referenced in foreign key constraint on column
"xyz" table "abc" does not exist

( the table "abc" is not necessary, i just wanted to be explicit
about the message )

In that create table statement, i had 10 columns each referencing an
'id' in another column.  I like very normalized DBs.

I had to go through each column individually to see where my error
was.  Postgres should have immediately told me which of the source
table columns that constraint failed on-- not just about the target
column name.



pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Error handling inside PL/pgSQL functions
Next
From: Jean-Christophe Roux
Date:
Subject: looping through query to update column