Re: Handling NULL dates in "copy from" statement

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: Tim Nelson <nelsonx(at)earthlink(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Handling NULL dates in "copy from" statement
Date: 2001-12-10 17:27:46
Message-ID: 20011210172746.61949.qmail@web20805.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The "with null as ''" should work: it does for me.
Are you sure that the field truly is empty, i.e. there
is no nonprintable character lurking in there?

--- Tim Nelson <nelsonx(at)earthlink(dot)com> wrote:
> Is there a way to handle NULL date fields
> that I am trying to import from another database?
>
> ex:
>
> ...for a table with a single date field that allows
> NULL...
>
> echo "12/31/2000" | psql -c "copy date_tab from
> stdin using delimiters '|' "
> db_name
>
> ...works, but if I use a blank date...
>
> echo "" | psql -c "copy date_tab from stdin using
> delimiters '|' " db_name
>
> ...it fails with "Bad date external
> representation"...
>
> I've tried replacing the empty string with "NULL"
> and adding " with null as
> '' " to no avail.
>
> Any ideas? Thanks. Tim
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the
> unregister command
> (send "unregister YourEmailAddressHere" to
majordomo(at)postgresql(dot)org)

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Troy.Campano 2001-12-10 17:30:49 Please ignore - test
Previous Message Andrew Gould 2001-12-10 17:26:12 Re: Access and Boolean