Re: [INTERFACES] copy command & null datetime

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ken J(dot) Wright" <ken(at)ori-ind(dot)com>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] copy command & null datetime
Date: 1999-03-08 07:40:52
Message-ID: 3924.920878852@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

"Ken J. Wright" <ken(at)ori-ind(dot)com> writes:
> where the empty field in between zzz & aaa is of type datetime (don't know
> about other types). I know a \N will fix this, but interpreting an empty
> import field as NULL would certainly beef up COPY as other database systems
> don't output the \N which is unique to PostgreSQL.

You might call that "beefing up COPY" but I'd call it "breaking COPY".
For data types such as text or varchar, there is a considerable
difference between an empty field value and a NULL field. You
propose to make it impossible to tell the difference.

IMHO, COPY's primary responsibility is to serve as a lossless conduit
for saving and restoring databases, not to be a user-friendly or
foreign-database-compatible data import method. It *must* reliably
distinguish empty strings from NULL fields. If there's some other
data format you want to read, you can use a preprocessor to convert
it into COPY format or INSERT statements.

Now I'm certainly not particularly in love with the \N notation,
and if you have a better idea I'm all ears. But failing to
distinguish empty and NULL is not a better idea.

regards, tom lane

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Meskes 1999-03-08 07:46:47 Re: [INTERFACES] Counting updates with libpq
Previous Message Tom Lane 1999-03-08 07:29:36 Re: [INTERFACES] Odd program behaviour