Re: Quoting of psql \d output - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Quoting of psql \d output
Date
Msg-id 200312232213.hBNMDTb10019@candle.pha.pa.us
Whole thread Raw
In response to Re: Quoting of psql \d output  ("Peter Eisentraut" <peter_e@gmx.net>)
Responses Re: Quoting of psql \d output  ("Peter Eisentraut" <peter_e@gmx.net>)
List 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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Quoting of psql \d output
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] (Modified) Patch request for PostgreSQL 7.4 for HP-UX IA-64