Qualified tables in error messages

Started by Rod Taylorover 22 years ago5 messageshackers
Jump to latest
#1Rod Taylor
rbt@rbt.ca

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.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rod Taylor (#1)
Re: Qualified tables in error messages

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

#3Rod Taylor
rbt@rbt.ca
In reply to: Tom Lane (#2)
Re: Qualified tables in error messages

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.

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.

#4Christopher Kings-Lynne
chriskl@familyhealth.com.au
In reply to: Rod Taylor (#1)
Re: Qualified tables in error messages

"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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Christopher Kings-Lynne (#4)
Re: Qualified tables in error messages

"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