Re: ORDER BY in \dt+ ? - Mailing list pgsql-general

From Mike Mascari
Subject Re: ORDER BY in \dt+ ?
Date
Msg-id 3C5A97CB.888005B1@mascari.com
Whole thread Raw
In response to ORDER BY in \dt+ ?  (Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE>)
List pgsql-general
Fritz Lehmann-Grube wrote:
>
> Hallo All,
>
> I'd like to have the output of a \dt+ command ordered.
> Is there a ( badly documented ) option like \pset listingorder=... ?
> Or do I have to rewrite it like
>    SELECT * FROM pg_tables WHERE ... ORDER BY oid;

I am unaware of any ORDER BY options. You can view the query that psql
is generating by using the -E option on the command line.

>
> If so, how do I get the comments ? As far as I can see, they are not
> stored in pg_tables - where else ?

They are stored in pg_description. In pre-7.2, the objoid in
pg_description relates to the oid of the object for which the comment
was created.

>
> Another question is about comments on columns. I can create one, but
> cannot get it afterwards. I did:
>
> arbeitsdb04=# comment on column sections.final is 'Hallo final';
> COMMENT
> arbeitsdb04=# \dd sections.final
>      Object descriptions
>  Name | Object | Description
> ------+--------+-------------
> (0 rows)
>
> So where is that comment ?

This appears to be a bug in psql. You can view the query using -E above
to see what it is doing. It generates a UNION of:

aggregates
relations
triggers
procedures
rules
types

but no

attributes

which is what a column comment is. You can, of course, see the comment
on the column by using:

\d+ sections.

Hope that helps,

Mike Mascari
mascarm@mascari.com

pgsql-general by date:

Previous
From: Picrate
Date:
Subject: trigger-procedure without plpgsql
Next
From: Holger Krug
Date:
Subject: Re: trigger-procedure without plpgsql