Hi there,

I am having problems loading data into a datetime field when
the table allows NULL for the date.

I assume I am doing something silly. Can anyone help me?
Preferably technical rather than medical :)

Cheers

steve



# here is my test table.

--
-- Test table.
--
CREATE TABLE MyTable
(
myName varchar(50) NOT NULL,
myDate datetime NULL
);


# here is my datafile, with empty date data

si> cat datafile
fred|
bob|
harry|


# here is the table is Postgres

mydb=# \d mytable
Table "mytable"
Attribute | Type | Modifier
-----------+--------------------------+----------
myname | character varying(50) | not null
mydate | timestamp with time zone |


# here is the copy line I was trying.

mydb=# COPY mytable FROM '/home/si/datafile' USING DELIMITERS '|';
ERROR: copy: line 1, Bad timestamp external representation ''

Search Discussions

  • Oliver Elphick at Jan 18, 2002 at 1:18 am

    On Thu, 2002-01-17 at 16:09, Stephen Ingram wrote:

    I am having problems loading data into a datetime field when
    the table allows NULL for the date.

    I assume I am doing something silly. Can anyone help me?
    Preferably technical rather than medical :)
    Represent nulls by \N in your input file. An empty string is not the
    same.

    --
    Oliver Elphick Oliver.Elphick@lfix.co.uk
    Isle of Wight http://www.lfix.co.uk/oliver
    GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

    "And, behold, I come quickly; and my reward is with me,
    to give every man according as his work shall be."
    Revelation 22:12

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedJan 17, '02 at 4:17p
activeJan 18, '02 at 1:18a
posts2
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Stephen Ingram: 1 post Oliver Elphick: 1 post

People

Translate

site design / logo © 2022 Grokbase