pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bing Du <bdu@iastate.edu>
To: pgsql-sql@postgresql.org
Subject: Re: can insert 'null' into timestamp type field from command
Date: Tue, 13 Jan 2004 11:45:18 -0600 (CST)
Message-ID: <2561.129.186.197.127.1074015918.squirrel@mail.eng.iastate.edu> (raw)
In-Reply-To: <2498.129.186.197.127.1074014921.squirrel@mail.eng.iastate.edu>
References: <2498.129.186.197.127.1074014921.squirrel@mail.eng.iastate.edu>

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@postgresql.org)
>




view thread (3+ messages)

Message-ID: <2561.129.186.197.127.1074015918.squirrel@mail.eng.iastate.edu>
Permalink:  ../2561.129.186.197.127.1074015918.squirrel@mail.eng.iastate.edu/
Also on:    postgresql.org/message-id/2561.129.186.197.127.1074015918.squirrel@mail.eng.iastate.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bdu@iastate.edu
  Subject: Re: can insert 'null' into timestamp type field from command
  In-Reply-To: <2561.129.186.197.127.1074015918.squirrel@mail.eng.iastate.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox