Re: generic copy options

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>, Emmanuel Cecchet <Emmanuel(dot)Cecchet(at)asterdata(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: generic copy options
Date: 2009-09-20 03:06:02
Message-ID: 603c8f070909192006u18b1fbd8j84cd30fea83356a8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Sep 19, 2009 at 3:10 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Emmanuel Cecchet <manu(at)asterdata(dot)com> writes:
>> [ latest patch version ]
>
> Do we have consensus on the syntax for this patch?  In particular,
> what about the question of adding CSV_ to all the CSV-specific option
> names?  Emmanuel argued that this is necessary to avoid confusion if
> we someday introduce other copy formats that have similar options.
> However, I think you could easily turn that argument around.  Any one
> COPY command will surely use just one format, and it seems to me that
> forcing different formats to use different names for equivalent options
> won't simplify life for anybody.  So I'm inclined to think we should
> not have the CSV_ prefixes.  (I seem to recall that we had exactly
> this discussion when the options were introduced the first time, and
> settled on not using format-specific option names.)

Agreed. It doesn't seem inconceivable that some other format could
have a "header" or "quote" option. A related question is whether we
should replace the "CSV" option with a "FORMAT" option for which one
of the possible choices is "CSV" (much as we did with EXPLAIN).

> One other minor point is that the patch introduces an empty-list
> syntax for individual option values, but then treats it the same
> as specifying nothing:
>
>> +             | '(' ')'                                { $$ = NULL; }
>> +             | /* EMPTY */                            { $$ = NULL; }
>
> I'm not convinced this is a a good idea, and in any case I don't see
> it documented.  I'm inclined to omit the '(' ')' syntax.

It seemed like a good idea because if you can do force_quote (a, b, c)
and force_quote (a, b) you might think that you could also do
force_quote (). Particularly for the sake of people generating SQL
automatically by some means, it seems like this might simplify life.
But possibly it shouldn't evaluate to the same value, so that you
can't write OIDS () to mean the same thing as OIDS ON.

...Robert

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-09-20 03:07:09 Re: SELECT ... FOR UPDATE [WAIT integer | NOWAIT] for 8.5
Previous Message Petr Jelinek 2009-09-20 02:39:22 Re: Anonymous code blocks