Re: [HACKERS] COPY with column headings

2004-08-18 Thread Bruce Momjian
Added to TODO: > o Allow COPY to optionally include column headings as the first I know Tom didn't like it but there were others who did. --- Andrew Dunstan wrote: > > > Tom Lane wrote: > > >Bruce Momjian <[EMAIL

Re: [HACKERS] COPY with column headings

2004-08-16 Thread CSN
That'd likely be useful. Either specify the column names with COPY or \copy, or put them in the data file and pass an option to the command to look for them. The only time this could be a problem is if you forget to tell COPY to look for the field names in the file (AND specify the field names to

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Bruce Momjian
Tom Lane wrote: > Andrew Dunstan <[EMAIL PROTECTED]> writes: > > The use case is that it fits in with the way spreadsheets usually do > > data tables, and many will only allow you to export a whole worksheet > > (including the heading row) to CSV, not a part of one. Conversely, > > working with

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Dann Corbit
> To: Andrew Dunstan > Cc: Bruce Momjian; PostgreSQL-development > Subject: Re: [HACKERS] COPY with column headings > > > Andrew Dunstan <[EMAIL PROTECTED]> writes: > > The use case is that it fits in with the way spreadsheets usually do > > data tables, and many wi

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan <[EMAIL PROTECTED]> writes: The use case is that it fits in with the way spreadsheets usually do data tables, and many will only allow you to export a whole worksheet (including the heading row) to CSV, not a part of one. Conversely, working with imported data

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > The use case is that it fits in with the way spreadsheets usually do > data tables, and many will only allow you to export a whole worksheet > (including the heading row) to CSV, not a part of one. Conversely, > working with imported data tables will

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Andrew Dunstan
Tom Lane wrote: Bruce Momjian <[EMAIL PROTECTED]> writes: I certainly think it's worth considering, although I see Tom has objected :-) . Say we have an option called FIRSTLINELABELS, then on copy out it would write the headings on the first line, and on copy in it could just ignore the firs

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: >> I certainly think it's worth considering, although I see Tom has >> objected :-) . Say we have an option called FIRSTLINELABELS, then on >> copy out it would write the headings on the first line, and on copy in >> it could just ignore the first line (

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Jeroen T. Vermeulen
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

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Tom Lane
"Jeroen T. Vermeulen" <[EMAIL PROTECTED]> writes: > Wouldn't it be more logical, and more compatible, to keep this information > as regular column information in the PGresult returned by the COPY? That would work but would require a protocol change, which this is surely not worth by itself. (We c

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Bruce Momjian
Andrew Dunstan wrote: > > > Bruce Momjian wrote: > > >Someone just asked about a COPY capability to supply the column headings > >as the first line of the copy statement. Do we want to support > >something like that? Does anyone else want such functionality? > > > > > > > > I had it in mind

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Andrew Dunstan
Bruce Momjian wrote: Someone just asked about a COPY capability to supply the column headings as the first line of the copy statement. Do we want to support something like that? Does anyone else want such functionality? I had it in mind all along as a possible option for CSV mode, but given

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Jeroen T. Vermeulen
On Mon, Aug 16, 2004 at 10:53:36AM -0400, Bruce Momjian wrote: > Someone just asked about a COPY capability to supply the column headings > as the first line of the copy statement. Do we want to support > something like that? Does anyone else want such functionality? Wouldn't it be more logical,

Re: [HACKERS] COPY with column headings

2004-08-16 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Someone just asked about a COPY capability to supply the column headings > as the first line of the copy statement. Do we want to support > something like that? No. Tell him to use SELECT. (Such a capability would be a permanent hazard, because any ti

[HACKERS] COPY with column headings

2004-08-16 Thread Bruce Momjian
Someone just asked about a COPY capability to supply the column headings as the first line of the copy statement. Do we want to support something like that? Does anyone else want such functionality? -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED]