Re: COPY with column headings - Mailing list pgsql-hackers

From Jeroen T. Vermeulen
Subject Re: COPY with column headings
Date
Msg-id 20040816154521.GA9953@xs4all.nl
Whole thread Raw
In response to Re: COPY with column headings  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Aug 16, 2004 at 11:30:49AM -0400, Tom Lane wrote:

> The bigger question is whether this would do anything to satisfy the
> requestor.  He probably wants the headings to appear in the file
> resulting from COPY TO file (or the psql equivalent), which this would
> not do.  Providing the info in the COPY PGresult would change nothing
> except the behavior of client applications specially rewritten to use it.

True, and from a compatibility standpoint that would probably be good...

Output post-processing (translation to CSV or XML output, XSLT transforms,
what have you) IMHO should probably go on top of COPY anyway, rather than
into it.  Are people really having problems with
select * from table where 1=0 ; copy table to stdout

and first printing the column names found in the first PGresult, then
dumping the COPY lines to the same fd?  I think that should do the trick for
most uses, although obviously I'm no expert.


Jeroen



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: COPY with column headings
Next
From: Tom Lane
Date:
Subject: Re: COPY with column headings