Re: generic copy options

From: Emmanuel Cecchet <manu(at)asterdata(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Emmanuel Cecchet <Emmanuel(dot)Cecchet(at)asterdata(dot)com>, Robert Haas <robertmhaas(at)gmail(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 17:53:18
Message-ID: 4AB66C0E.2050900@asterdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> No, I don't think so. Suppose I write
>
> COPY ... (xml_header on)
>
> If HEADER isn't actually an option supported by XML format, what I will
> get here is an "unknown option" error, which conveys just about nothing
> --- is it really an unsupported combination, or did I just misspell the
> option name?
Well, I don't see why you would write that if the option is not documented.
Usually as a user, when I need to use a command, I look at the doc/man
page and use the options that are indicated, I don't try to invent new
options. That should prevent the kind of scenario you describe here:
> If we go with the other way then I would expect
>
> COPY ... (xml, header on)
>
> to draw a specific "HEADER is not supported in XML format" error.
> Of course, that will require some extra code to make it happen.
> So you could argue that format-specific option names are easier
> from the lazy programmer's viewpoint. But I don't believe the
> argument that they're better from the user's viewpoint.
>
Here you will force every format to use the same set of options and if
someone introduces a new option, you will have to modify all other
formats to make sure they throw an error telling the user that this
option is not supported. I don't think this is a great design and that
it will be easy to extend.

Emmanuel

--
Emmanuel Cecchet
Aster Data Systems
Web: http://www.asterdata.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-09-20 18:01:14 Re: generic copy options
Previous Message Tom Lane 2009-09-20 17:49:08 Re: operator exclusion constraints [was: generalized index constraints]