Qualified tables in error messages
ERROR: update or delete on "ftp" violates foreign key constraint "$1"
on "ftp"
DETAIL: Key (ftp_id)=(11) is still referenced from "ftp".
Considering I have several different FTP tables in various schemas, this
message doesn't have much detail. The "Error Message Style Guide" does
not indicate one way or the other whether tables, etc. should be fully
qualified or not. Possibly not in ERROR, but qualified makes sense for
DETAIL.
Rod Taylor <rbt@rbt.ca> writes:
Considering I have several different FTP tables in various schemas, this
message doesn't have much detail. The "Error Message Style Guide" does
not indicate one way or the other whether tables, etc. should be fully
qualified or not. Possibly not in ERROR, but qualified makes sense for
DETAIL.
I deliberately haven't done that because it would be awfully noisy.
It would be wrong to write only one set of quotes:
ERROR: table "schema.foo" does not exist
since it's not clear here if the dot is in the name or not. We'd have
to write
ERROR: table "schema"."foo" does not exist
which is just plain ugly.
There are error fields defined in the SQL spec for table name, schema
name, etc, and at some point we should consider expanding the
error-message structure to allow passing those fields back to the
client --- *not* as part of the text messages, but as separate detail
fields. Didn't get around to it for 7.4 though.
regards, tom lane
since it's not clear here if the dot is in the name or not. We'd have
to writeERROR: table "schema"."foo" does not exist
which is just plain ugly.
Yes, it certainly is.
There are error fields defined in the SQL spec for table name, schema
name, etc, and at some point we should consider expanding the
I see, this would be ideal.
"Tom Lane" <tgl@sss.pgh.pa.us> wrote:
ERROR: table "schema"."foo" does not exist
which is just plain ugly.
Why not wrap all 'identifier' outputs in a call to the quoting function, so
the above message would in fact appear as:
table schema.foo does not exist
but with a space in it it would appear like this:
table "schema 2".foo does not exist
Chris
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
Why not wrap all 'identifier' outputs in a call to the quoting function, so
the above message would in fact appear as:
table schema.foo does not exist
but with a space in it it would appear like this:
table "schema 2".foo does not exist
This doesn't conform to the message style guidelines we agreed to,
which specify quoting of user identifiers in messages. I think the
guidelines are correct on this point --- consider for instance
table exists does not exist
which could easily be a tad confusing...
regards, tom lane