Re: Column Headings using Comment? - Mailing list pgsql-novice

From Bruce Momjian
Subject Re: Column Headings using Comment?
Date
Msg-id 200403021900.i22J0TD20416@candle.pha.pa.us
Whole thread Raw
In response to Column Headings using Comment?  (tully <none@noemail.com>)
Responses system tables
List pgsql-novice
tully wrote:
> Is there an option for psql to use the entry in Comments for "pretty"
> column headings in a report?  For example, instead of printing the
> column name of "last" in the heading, the option would print "Last
> Name" that is contained in the Comments field.
>
> The only two alternatives I've found so far is to use "SELECT AS" or
> to mangle the "\d+" output from psql with awk, which are both
> cumbersome solutions, especially when a "select *" is possible.
>
> Can anyone help?

Ideally, you could do something like:

    SELECT 1 AS (SELECT description FROM pg_description WHERE ...);

but we don't support subqueries in AS clauses.

--
  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-novice by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: current_query in pg_stat_activity
Next
From: Bruce Momjian
Date:
Subject: Re: UPDATE FROM syntax