Re: COPY incorrectly uses null instead of an empty string in last field

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY incorrectly uses null instead of an empty string in last field
Date: 2002-02-26 21:44:06
Message-ID: 5719.1014759846@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jean-Michel POURE 2002-02-26 22:04:43 Re: PostgreSQL 8.0 ??
Previous Message Oliver Elphick 2002-02-26 21:27:43 Re: COPY incorrectly uses null instead of an empty string