Re: Handling NULL dates in "copy from" statement - Mailing list pgsql-general

From Jason Earl
Subject Re: Handling NULL dates in "copy from" statement
Date
Msg-id 877krvc6fk.fsf@npa01zz001.simplot.com
Whole thread Raw
In response to Handling NULL dates in "copy from" statement  ("Tim Nelson" <nelsonx@earthlink.com>)
List pgsql-general
Try replacing the empty string with \N, that's what copy reads as
NULL.

Jason

"Tim Nelson" <nelsonx@earthlink.com> writes:

> 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@postgresql.org)

pgsql-general by date:

Previous
From: Jason Earl
Date:
Subject: Re: What is the practical limitation of no multi-threading?
Next
From: Bill Cunningham
Date:
Subject: Re: papers on datatype design