Re: Nasty, propagating POLA violation in COPY CSV HEADER

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Nasty, propagating POLA violation in COPY CSV HEADER
Date: 2012-06-20 16:54:23
Message-ID: 4FE2003F.5040805@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/20/2012 12:18 PM, Tom Lane wrote:
> David Fetter<david(at)fetter(dot)org> writes:
>> OK, new proposal:
>> COPY FROM (Thanks, Andrew! Must not post while asleep...) should have
>> an option which requires that HEADER be enabled and mandates that the
>> column names in the header match the columns coming in.
>> Has someone got a better name for this option than
>> KEEP_HEADER_COLUMN_NAMES?
> Well, if it's just checking that the list matches, then maybe
> CHECK_HEADER would do.
>
> In your original proposal, I was rather wondering what should happen if
> the incoming file didn't have the same set of columns called out in the
> COPY command's column list. (That is, while *rearranging* the columns
> might be thought non-astonishing, I'm less convinced about a copy
> operation that inserts or defaults columns differently from what the
> command said should happen.) If we're just checking for a match, that
> question goes away.
>
>

In the past people have asked me to have copy use the CSV header line in
place of supplying a column list in the COPY command. I can certainly
see some utility in that, and I think it might achieve what David wants.
Using that scenario it would be an error to supply an explicit column
list and also use the header line. But then I don't think CHECK_HEADER
would be the right name for the option. In any case, specifying a name
before we settle on an exact behaviour seems wrong :-)

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-06-20 16:54:24 Re: foreign key locks
Previous Message Andres Freund 2012-06-20 16:53:01 Re: [PATCH 10/16] Introduce the concept that wal has a 'origin' node