Re: COPY enhancements

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Emmanuel Cecchet <manu(at)asterdata(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY enhancements
Date: 2009-09-11 15:11:47
Message-ID: 603c8f070909110811p14b8912td9b8b7e66d3356e6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 11, 2009 at 10:18 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Emmanuel Cecchet <manu(at)asterdata(dot)com> writes:
>> The new syntax could look like:
>
>> COPY /tablename/ [ ( /column/ [, ...] ) ]
>>     FROM { '/filename/' | STDIN }
>>     [ [, BINARY ]
>>       [, OIDS ]
>>       [, DELIMITER [ AS ] '/delimiter/' ]
>>       [, NULL [ AS ] '/null string/' ]
>>       [, CSV [ HEADER ]
>>              [ QUOTE [ AS ] '/quote/' ]
>>              [ ESCAPE [ AS ] '/escape/' ]
>>              [ FORCE NOT NULL (/column/ [, ...]) ]
>>       [, ERRORS { SKIP |
>>                   LOG INTO { tablename | 'filename' }
>>                     [ LABEL label_name ]
>>                     [ KEY key_name ]
>>                     [ MAX ERRORS /count/ ] } ]
>
>> Is this what you had in mind?
>
> No. because that doesn't do a darn thing to make the option set less
> hard-wired into the syntax. I was thinking of a strict keyword/value
> format with non-wired-in keywords ... and only *one* keyword per value.
> See EXPLAIN.

I was thinking something like:

COPY tablename [ ( column [, ...] ) ] FROM { 'filename' | STDIN }
[WITH] [option [, ...]]

Where:

option := ColId [Sconst] | FORCE NOT NULL (column [,...])

I don't see any reasonable way to sandwhich the FORCE NOT NULL syntax
into a keyword/value notation.

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-09-11 15:13:29 Re: COPY enhancements
Previous Message Robert Haas 2009-09-11 15:04:06 Re: COPY enhancements