Skip site navigation (1) Skip section navigation (2)

Re: can insert 'null' into timestamp type field from command

From: "Bing Du" <bdu(at)iastate(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: can insert 'null' into timestamp type field from command
Date: 2004-01-13 17:45:18
Message-ID: 2561.129.186.197.127.1074015918.squirrel@mail.eng.iastate.edu (view raw or flat)
Thread:
Lists: pgsql-sql
I've figured it out, that is using 'null as <null string>' with the COPY
command.

Bing

> The table is like this:
>
> ========
> maxware=# \d test;
>                Table "public.test"
>  Column |            Type             | Modifiers
> --------+-----------------------------+-----------
>  a      | timestamp without time zone |
>  b      | integer                     |
> =========
>
> The following insert command works fine:
>
> maxware=# insert into test (a,b) values (null,'1');
>
> But importing from an input data file does not seem to work as shown
> below:
>
> =========
> maxware=# copy tbl_spcase from '/home/bdu/test/input.data' delimiter as
> '|';
> ERROR:  invalid input syntax for integer: "null"
> CONTEXT:  COPY tbl_spcase, line 1, column col_id_spcase: "null"
> ==========
>
> The input.data file just has one line.  But no matter what I did, neither
> of the following input format worked.
>
> 1. null|1
> 2. |1
> 3. ''|1
>
> How should I represent blank value for the field that's of timestamp type?
>
> Thanks in advance for any help,
>
> Bing
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>


In response to

pgsql-sql by date

Next:From: beyaRecords - The home Urban musicDate: 2004-01-13 18:45:55
Subject: Configure issues
Previous:From: scott.marloweDate: 2004-01-13 17:31:32
Subject: Re: can insert 'null' into timestamp type field from command

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group