Re: generic copy options

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

Emmanuel Cecchet <manu(at)asterdata(dot)com> writes:
> That would assume that the semantic of the other options (header, quote,
> espace, ...) is exactly the same for each format. Otherwise this will be
> a nightmare to document.

Well, sure, we should pick a different name for an option that means
something significantly different. But for options that do mean
approximately the same thing in different formats, it doesn't seem
helpful to require different names to be used.

> If we don't prefix with CSV, I guess that some users will spend some
> time to figure out that NULL is not a format option but FORCE NOT NULL
> is. If an option is only supported by one format (let's say XML) we will
> have to document every time which options are supported by which format
> which would be much easier and intuitive is options were readily
> prefixed by the format name.

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? 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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-09-20 16:31:50 Re: WIP: generalized index constraints
Previous Message Jeff Davis 2009-09-20 16:17:34 Re: operator exclusion constraints [was: generalized index constraints]