Re: NULL TIMESTAM problem - Mailing list pgsql-general

From Guy Rouillier
Subject Re: NULL TIMESTAM problem
Date
Msg-id CC1CF380F4D70844B01D45982E671B230137A79B@mtxexch01.add0.masergy.com
Whole thread Raw
In response to NULL TIMESTAM problem  ("Enrique Sánchez" <sancheztru@hotmail.com>)
List pgsql-general
Enrique Sánchez wrote:
> Hi! I'm new in Postgres.
>
> I nedd to fill a database table x from a file With the COPY command
> an the delimiter '*'.
> This  table  has a timestamp null column (I declared like: ' birthday
> timestamp NULL' ).
>
> But when I try to insert NULL values(specified in the file), postgres
> throw an error.
>
>
> I don't know how can I specify this NULL value wkthout an '\N'
> character.

I created a table t1 with 3 columns, all nullable:

    f1 int
    f2 timestamp
    f3 int

Using the following input file t1.csv:

    5,NULL,7
    8,NULL,10

The following COPY command successfully put those rows in the table, with f2 null:

    copy t1 (f1, f2, f3)
    from 't1.csv'
    null as 'NULL'
    csv;

--
Guy Rouillier


pgsql-general by date:

Previous
From: Emi Lu
Date:
Subject: Re: in Pl/PgSQL, do commit every 5000 records
Next
From: "Hongxi.Ma"
Date:
Subject: Re: Baffled by failure to use index when WHERE uses a function