Re: bad error message

From: Jonathan Vanasco <postgres(at)2xlp(dot)com>
To: A(dot)Kretschmer <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: bad error message
Date: 2006-10-12 23:12:10
Message-ID: 911F5634-328B-4141-B713-6543372C4BAD@2xlp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christophe Roux 2006-10-12 23:13:23 looping through query to update column
Previous Message Jeff Davis 2006-10-12 22:58:43 Re: Error handling inside PL/pgSQL functions