Re: COPY incorrectly uses null instead of an empty string in last field - Mailing list pgsql-hackers

From Tom Lane
Subject Re: COPY incorrectly uses null instead of an empty string in last field
Date
Msg-id 5719.1014759846@sss.pgh.pa.us
Whole thread Raw
In response to Re: COPY incorrectly uses null instead of an empty string  (Oliver Elphick <olly@lfix.co.uk>)
List pgsql-hackers
> The original reporter's mail had no tabs at all, but it was not an
> attachment and it had had lost all its tabs along the way.  His input
> script came from 7.0 pg_dump.  I am following up with him whether there
> are actually tabs before the empty fields in that pg_dump output.

If a trailing tab got lost in a dump file, then COPY IN would silently
assume that fields after the tab position should be NULL.  I suspect
that that is what happened here.  Probably some "helpful" program
stripped trailing whitespace from the file.

One of the things we've agreed to do in 7.3 is change COPY IN to remove
that assumption --- a line with too few fields (too few tabs) will draw
an error report instead of silently doing what's likely the wrong thing.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: COPY incorrectly uses null instead of an empty string
Next
From: Jean-Michel POURE
Date:
Subject: Re: PostgreSQL 8.0 ??