Re: valid NULL DATE value

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: Tony Grant <tony(at)animaproductions(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: valid NULL DATE value
Date: 2001-08-24 12:48:22
Message-ID: 200108241248.f7OCmMoa027216@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tony Grant wrote:
>Hello,
>
>I am importing via pgaccess a text file from another non-postgres
>database and the NULL DATE values are written like 00/00/00.
>
>What I have tried is replacing 00/00/00 by 9/9/1999 and setting the
>style to european and I am getting 'can't parse /9/1999' errors.
>
>How do I go about importing DATE?

With INSERT, leave the field out of the list or insert NULL.

With COPY, specify NULL as \N. (You can redefine that - see COPY syntax.)

If you have a flat file with 00/00/00 in it, you can modify it with sed:

sed -e 's|00/00/00|\\N|g' flatfile > newflatfile

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"I saw in the night visions, and, behold, one like the
Son of man came with the clouds of heaven, and came to
the Ancient of days, and they brought him near before
him. And there was given him dominion, and glory, and
a kingdom, that all people, nations, and languages,
should serve him; his dominion is an everlasting
dominion, which shall not pass away, and his kingdom
that which shall not be destroyed."
Daniel 7:13,14

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Denis Gasparin 2001-08-24 12:57:57 BIGINT datatype and Indexes Failure
Previous Message Christoph 2001-08-24 12:43:37 Run scripts