Re: Quoting of psql \d output

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Quoting of psql \d output
Date: 2003-12-23 22:13:29
Message-ID: 200312232213.hBNMDTb10019@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut wrote:
> Bruce Momjian writes:
> > But it isn't a message:
> >
> > Table "public.xx"
> > Column | Type | Modifiers
> > --------+---------+-----------
> > y | integer |
> > Indexes:
> > "ii" btree (y)
>
> By definition, everything that is printed out for human consumption is a
> message.
>
> Everything that is printed out for consumption by an SQL parser (e.g., in
> pg_dump) is encouraged to use SQL quoting rules. But everything that is

I see pg_dump using the same rules that I am proposing:

CREATE TABLE "xx y" (
y integer
) WITH OIDS;

CREATE TABLE xx (
y integer
) WITH OIDS;

[ We need that WITH OIDS fixed before 7.5. I think Neil is working on it.]

> intended to be read by humans should use quoting rules that are common in
> real-life publishing.

To me quoting the table name is like quoting the name of a section
heading (which people don't do), and that's really what we are
displaying:

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

"Table public.xx" is the section heading, and before you complain that I
quoted it in this sentence, I had to because it is part of a sentence,
not on its own as it is in psql \d display.

You were suggesting no quotes at all. Would this display be OK?

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

Note I had to quote the table name to get \d to accept it. To me that
'y' just sitting along looks strange.

--
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 Tom Lane 2003-12-23 22:32:43 Re: Bug in new buffer freelist code
Previous Message Tom Lane 2003-12-23 22:08:05 Re: Bug in new buffer freelist code

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-12-23 23:02:02 Re: (Modified) Patch request for PostgreSQL 7.4 for HP-UX IA-64
Previous Message Bruce Momjian 2003-12-23 22:07:24 Re: Quoting of psql \d output