Re: Allow COPY's 'text' format to output a header - Mailing list pgsql-hackers

From Isaac Morland
Subject Re: Allow COPY's 'text' format to output a header
Date
Msg-id CAMsGm5ehOK5EbVEBsEDXP4iaTbwOUszWFdUWEu3bRRp3ix7mKA@mail.gmail.com
Whole thread Raw
In response to Re: Allow COPY's 'text' format to output a header  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Allow COPY's 'text' format to output a header  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
While we're discussing COPY options, what do people think of an option for COPY FROM with header to require that the headers match the target column names? This would help to ensure that the file is actually the right one.

On 14 May 2018 at 14:55, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Mon, May 14, 2018 at 11:44 AM, Garick Hamlin <ghamlin@isc.upenn.edu> wrote:
I wonder if there was a way to let COPY FROM detect or ignore headers
as appropriate and rather than cause silently result in headers being
added as data.

​Not reliably
 
Maybe a blank line after the header line could prevent this confusion

​No​

+1 for allowing HEADER with FORMAT text.  It doesn't interfere with COPY and even if I were to agree that CSV format is the better one this seems like an unnecessary area to impose preferences.  If TSV with Header meets someone's need providing a minimal (and consistent with expectations) syntax to accomplish that goal seems reasonable, as does the patch.

David J.


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Postgres 11 release notes
Next
From: Bruce Momjian
Date:
Subject: Re: Postgres 11 release notes