dbTalk Databases Forums  

Column Headings using Comment?

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Column Headings using Comment? in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
tully
 
Posts: n/a

Default Column Headings using Comment? - 02-25-2004 , 09:36 AM






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?

--tully

Reply With Quote
  #2  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: Column Headings using Comment? - 03-02-2004 , 01:00 PM






tully wrote:
Quote:
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 (AT) candle (DOT) 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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings



Reply With Quote
  #3  
Old   
M. Bastin
 
Posts: n/a

Default system tables - 03-03-2004 , 11:32 AM



Hi,

I've spent several hours browsing the system tables and the online
documentation about them but I still can't find how to extract
following information:

1. How do I find the user name for a given pid?

2. Where's the list that links all valid text encoding names with the
numbers representing them? (E.g. UNICODE = 6)

Is there an easy way to recoup how the different system tables are
related to each other, or does one simply have to know?

Thanks,

Marc

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
  #4  
Old   
Tom Lane
 
Posts: n/a

Default Re: system tables - 03-03-2004 , 05:31 PM



"M. Bastin" <marcbastin (AT) mindspring (DOT) com> writes:
Quote:
1. How do I find the user name for a given pid?
See pg_stat_activity.

Quote:
2. Where's the list that links all valid text encoding names with the
numbers representing them? (E.g. UNICODE = 6)
I don't believe this list exists as a system catalog. It is accessible
through the pg_char_to_encoding() and pg_encoding_to_char() functions,
though.

Quote:
Is there an easy way to recoup how the different system tables are
related to each other, or does one simply have to know?
See the docs:
http://www.postgresql.org/docs/7.4/static/catalogs.html

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html



Reply With Quote
  #5  
Old   
tully
 
Posts: n/a

Default Re: Column Headings using Comment? - 03-03-2004 , 08:46 PM



On Tue, 2 Mar 2004 14:00:29 -0500 (EST), pgman (AT) candle (DOT) pha.pa.us (Bruce
Momjian) wrote:

Quote:
Ideally, you could do something like:

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

but we don't support subqueries in AS clauses.
That would be much nicer. I'm afraid I got spoiled by a simple little
relational database called Unity, that I used years ago at AT&T. Just
a letter parameter added would use the "pretty" heading instead of the
field name, so one setup handled all subsequent queries. It would be
so nice if psql did something like that and everything is there to do
it except the support for the argument.

I really like how postgresql behaves, especially how psql lets me
create complicated web page results with small shell and awk scripts.
Transactions are a life-saver and couldn't be easier to code. I think
I'm hooked. Now if I could only talk a postgres developer into coding
that "pretty" option into psql...

Thanks Bruce.

--tully


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.