Re: bad error message - Mailing list pgsql-general

From Tom Lane
Subject Re: bad error message
Date
Msg-id 20992.1160696377@sss.pgh.pa.us
Whole thread Raw
In response to Re: bad error message  (Jonathan Vanasco <postgres@2xlp.com>)
Responses Re: bad error message  (Jonathan Vanasco <postgres@2xlp.com>)
Re: bad error message  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List pgsql-general
Jonathan Vanasco <postgres@2xlp.com> writes:
> 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

That's not necessarily all that much help, if you've got so many FK
constraints in your command that you don't know exactly where to look.
I think what you're really wishing for is an error cursor position.
8.2 has the infrastructure for this, eg

regression=# create table foo (a int, b int, c int);
CREATE TABLE
regression=# select a, b, q from foo;
ERROR:  column "q" does not exist
LINE 1: select a, b, q from foo;
                     ^
regression=#

but unfortunately the facility hasn't been extended to foreign key
constraint clauses in particular :-(.  Maybe next time.

            regards, tom lane

pgsql-general by date:

Previous
From: Jean-Christophe Roux
Date:
Subject: looping through query to update column
Next
From: Robert L Mathews
Date:
Subject: Re: Storing images in PostgreSQL databases (again)