Re: mysql_field_name equivalent

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: "Mace, Richard" <richard(dot)mace(at)Lorien(dot)co(dot)uk>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: mysql_field_name equivalent
Date: 2003-12-31 23:25:59
Message-ID: B1293F70-3BE8-11D8-A298-000A95C88220@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Dec 31, 2003, at 5:59 AM, Mace, Richard wrote:
> 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Glaesemann 2003-12-31 23:37:23 Re: stupid question
Previous Message rhkelly 2003-12-31 22:09:07 Re: stupid question