Handling NULL dates in "copy from" statement

From: "Tim Nelson" <nelsonx(at)earthlink(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Handling NULL dates in "copy from" statement
Date: 2001-12-10 12:43:25
Message-ID: N52R7.630$vK1.49112@newsread2.prod.itd.earthlink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Brett 2001-12-10 13:01:46 Re: Remote Access to pgsql DB ???
Previous Message Antonio Fiol Bonnín 2001-12-10 12:37:16 Analyzer for postgresql.log