pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: scott.marlowe <scott.marlowe@ihs.com>
To: Bing Du <bdu@iastate.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: can insert 'null' into timestamp type field from command
Date: Tue, 13 Jan 2004 10:31:32 -0700 (MST)
Message-ID: <Pine.LNX.4.33.0401131028380.22537-100000@css120.ihs.com> (raw)
In-Reply-To: <2498.129.186.197.127.1074014921.squirrel@mail.eng.iastate.edu>

On Tue, 13 Jan 2004, Bing Du wrote:

> 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

Here's a simple way to find out.  use pg_dump to dump the table:

psql
db=>create table test (dt timestamptz, id int);
db=>insert into test (dt, id) values (NULL,22);
db=>\q
pg_dump db -t test

<Extra data deleted>

-- Data for TOC entry 3 (OID 705319)
-- Name: test; Type: TABLE DATA; Schema: public; Owner: marl8412
--

COPY test (dt, id) FROM stdin;
\N      22
\.

Note that a null is imported / exported as \N






view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.4.33.0401131028380.22537-100000@css120.ihs.com>
Permalink:  ../Pine.LNX.4.33.0401131028380.22537-100000@css120.ihs.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.33.0401131028380.22537-100000@css120.ihs.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: scott.marlowe@ihs.com, bdu@iastate.edu
  Subject: Re: can insert 'null' into timestamp type field from command
  In-Reply-To: <Pine.LNX.4.33.0401131028380.22537-100000@css120.ihs.com>
  References: <2498.129.186.197.127.1074014921.squirrel@mail.eng.iastate.edu> <Pine.LNX.4.33.0401131028380.22537-100000@css120.ihs.com>

* 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