Re: Quoting of psql \d output

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, chriskl(at)familyhealth(dot)com(dot)au, pgsql-patches(at)postgresql(dot)org
Subject: Re: Quoting of psql \d output
Date: 2003-12-27 18:26:28
Message-ID: 200312271826.hBRIQSo23232@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > So it seems we can either go with no quotes, or smart quotes (which my
> > patch implemented). I feel my patch does the best of both worlds, by
> > quoting as needed, and as the psql \d commands actually require anyway,
> > and as used by pg_dump and in SQL queries.
>
> You have not responded to Peter's point that quotes need translation.
>
> If we adopt the viewpoint that this is an SQL representation of the
> table name, and not a human-oriented one, then double quotes are correct
> regardless of the language in use. However, we agreed during
> development of the message style guidelines that we would *not* use
> strict SQL quoting in messages. I have not seen a good reason given
> to ignore that general policy in this particular case.
>
> I think if we change it here we will also have to revisit hundreds of
> places in the backend, such as this one:
> regression=# select * from public.bar;
> ERROR: relation "public.bar" does not exist
> and indeed the whole question of what we are using quotes for in
> messages becomes open again.
>
> At this point I think I'm voting with Peter, for no change at all.

The issue for me is that in an ereport() are putting the relation name
inside a sentence/message, which psql is not doing. Right now it is
doing:

Table "xx.yy"

That has the worse of all worlds --- quotes, always, and invalid (not
"xx"."yy"). I suppose the only thing good about it is that translators
can change the quotes to something else, but to me the quotes don't make
much sense at all in this context, and I assume others complained about
this looking ugly, which is why I tried to fix it in the first place.

Also consider that users have to use quotes to see a table that needs
quotes with \d. They can't use their local quoting rules anyway.

This is the current output:

test=> \d xx
Table "public.xx"
Column | Type | Modifiers
--------+---------+-----------
y | integer |
Indexes:
"ii" btree (y)

Notice the class.tablename are quoted, and the index name.

I am starting to like the idea of putting the class name after the table
name. The class name is usually insignificant:

Table xx (Class yy)

I do see French changing the quotes in their .po file, while other
languages leave them the same. Perhaps we should just drop the quotes
entirely.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Sidney-Woollett 2003-12-27 18:26:49 Re: Is my MySQL Gaining ?
Previous Message Tom Lane 2003-12-27 18:13:55 Re: Quoting of psql \d output

Browse pgsql-patches by date

  From Date Subject
Next Message Manfred Spraul 2003-12-27 19:03:10 Re: [PATCHES] update i386 spinlock for hyperthreading
Previous Message Tom Lane 2003-12-27 18:13:55 Re: Quoting of psql \d output