X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 35FCDD1B4BD for ; Tue, 13 Jan 2004 17:52:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 93915-09 for ; Tue, 13 Jan 2004 13:52:14 -0400 (AST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 555CDD1B43F for ; Tue, 13 Jan 2004 13:52:09 -0400 (AST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i0DHnbDV014456; Tue, 13 Jan 2004 10:49:37 -0700 (MST) Date: Tue, 13 Jan 2004 10:31:32 -0700 (MST) From: "scott.marlowe" To: Bing Du Cc: Subject: Re: can insert 'null' into timestamp type field from command In-Reply-To: <2498.129.186.197.127.1074014921.squirrel@mail.eng.iastate.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/115 X-Sequence-Number: 16508 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 -- 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