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

From Andrew Dunstan
Subject Re: COPY with column headings
Date
Msg-id 4120FFBF.2020907@dunslane.net
Whole thread Raw
In response to Re: COPY with column headings  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: COPY with column headings
Re: COPY with column headings
List pgsql-hackers

Tom Lane wrote:

>Bruce Momjian <pgman@candle.pha.pa.us> 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 (so it could work symmetrically).
>>>      
>>>
>
>  
>
>>Yes, that is what I was thinking.  Is this a TODO?  Sure it can be
>>misused but most copy options can be similarly misused.
>>    
>>
>
>Most copy options will result in obvious failures if misused.  I dislike
>this one because of the high risk of silent corruption of your data
>(loss of a row or insertion of a row that shouldn't be there).
>Considering no one has even made a positive case why we should add it
>(for instance, a use-case where it's necessary), I don't think it
>belongs in the to-do list.
>
>
>  
>

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 be harder if they lack headings.

cheers

andrew


pgsql-hackers by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: Open items
Next
From: Tom Lane
Date:
Subject: Re: COPY with column headings