dbTalk Databases Forums  

Re: mysql_field_name equivalent

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


Discuss Re: mysql_field_name equivalent in the comp.databases.postgresql.novice forum.



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

Default Re: mysql_field_name equivalent - 12-31-2003 , 09:48 AM






Hi,

Mace, Richard wrote, On 12/31/2003 12:59 PM:

Quote:
Is there a PostgreSQL equivalent command to the mysql_field_name command above?

I am running a select query (7.2) and would like to get the name of the columns I am selecting
too, in order to output a header line to an external file, with the result of the select.

Has anyone done this or similar?
you probably want this from php. Better to use, ask at
comp.databases.postgresql.interfaces.php for php related questions.

try the php documentation and check: pg_field_name

C.


Reply With Quote
  #2  
Old   
Michael Glaesemann
 
Posts: n/a

Default Re: mysql_field_name equivalent - 12-31-2003 , 05:25 PM







On Dec 31, 2003, at 5:59 AM, Mace, Richard wrote:
Quote:
I am running a select query (7.2) and would like to get the name of
the columns I am selecting
too, in order to output a header line to an external file, with the
result of the select.
I'm not familiar with the mysql command mentioned, but just using \o
and specifying a file in psql does what it sounds like you want.
Specify the file using:
\o /path/to/results.txt

The result of every query entered through psql will appear in the file
just as it would otherwise in psql, complete with column headings.
There are ways to specify the delimiter (e.g., tabs rather than
spaces), or the border (and other options as well) using /pset

Does this help?

Michael Glaesemann
grzm myrealbox com


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



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.