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

From Daniel Verite
Subject Re: Allow COPY's 'text' format to output a header
Date
Msg-id 4cf84f71-8388-48ef-be28-78b52f8f334b@manitou-mail.org
Whole thread Raw
In response to Re: Allow COPY's 'text' format to output a header  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Responses Re: Allow COPY's 'text' format to output a header  (Isaac Morland <isaac.morland@gmail.com>)
List pgsql-hackers
    Andrew Dunstan wrote:

> I'm not necessarily opposed to this, but I'm not certain about the use
> case either.

+1.
The downside is that it would create the need, when using COPY TO,
to know whether an input file was generated with or without header,
and a hazard on mistakes.
If you say it was and it wasn't, you quietly loose the first row of data.
If you say it wasn't and in fact it was, either there's a
datatype mismatch or you quietly get a spurious row of data.

This complication should be balanced by some advantage.
What can we do with the header?
If you already have the table ready to COPY in, you don't
need that information. The only reason why COPY TO
needs to know about the header is to throw it away.
And if you don't have the table created yet, a header
with just the column names is hardly sufficient to create it,
isn't it?


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postgres 11 release notes
Next
From: Euler Taveira
Date:
Subject: Re: libpq compression