Re: [PATCHES] CSV patch applied

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [PATCHES] CSV patch applied
Date: 2004-04-20 14:33:49
Message-ID: 200404201433.i3KEXnq19954@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan wrote:
> Bruce and I tossed this around quite a bit.
>
> The problem is that using QUOTE or NULL in these phrases might look
> confusing, e.g.
> COPY mytable TO 'mytable.csv' CSV QUOTE '"' FORCE QUOTE field1,field2;
> COPY mytable FROM 'mytable.csv' NULL '' CSV NO NULL CHECK field1,field2;
>
> I also don't think NO NULL CHECK actually matches the use case for this
> very well (and I'm dubious about LITERAL too). They both describe the
> actual behaviour, but not what you are trying to achieve. Essentially,
> this would be used when you have a field with a NOT NULL constraint, but
> the input CSV data stream has what would otherwise be considered nulls.
> (COPY itself will never produce such a CSV, as non-null values that
> resemble null are always quoted, but third party programs well might.)
> So an alternative might be FORCE NOT NULL, but for the previous
> consideration. Perhaps use of an optional preposition might make things
> slightly clearer, e.g.:
>
> COPY mytable TO 'mytable.csv' CSV QUOTE '"' FORCE QUOTE IN
> field1,field2;
> COPY mytable FROM 'mytable.csv' NULL '' CSV FORCE NOT NULL IN
> field1,field2;
>
> But it does start to look a little too much like COBOL :-).

Yea, and as I remember, that COBOL word scared us off. :-)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-04-20 14:41:32 Re: COPY CSV keywords
Previous Message Bruce Momjian 2004-04-20 14:32:10 Re: pg_encoding not needed anymore

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-04-20 14:37:13 Re: NetBSD 2.0 / native threads
Previous Message Fabien COELHO 2004-04-20 14:25:41 Re: CSV patch applied