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

Поиск
Список
Период
Сортировка
От scott.marlowe
Тема Re: can insert 'null' into timestamp type field from command
Дата
Msg-id Pine.LNX.4.33.0401131028380.22537-100000@css120.ihs.com
обсуждение исходный текст
Ответ на can insert 'null' into timestamp type field from command line but not from input file?  ("Bing Du" <bdu@iastate.edu>)
Список pgsql-sql
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





В списке pgsql-sql по дате отправления:

Предыдущее
От: "Bing Du"
Дата:
Сообщение: Re: can insert 'null' into timestamp type field from command
Следующее
От: Sai Hertz And Control Systems
Дата:
Сообщение: Re: Copying rows between tables?