Re: COPY incorrectly uses null instead of an empty string in last field

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: COPY incorrectly uses null instead of an empty string in last field
Дата
Msg-id 4262.1014747842@sss.pgh.pa.us
обсуждение исходный текст
Ответ на COPY incorrectly uses null instead of an empty string in last field  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-hackers
Oliver Elphick <olly@lfix.co.uk> writes:
> Where the last field of a line contains an empty string, COPY
> incorrectly inserts a NULL.

Certainly not.  Using your example table definition, I did:

regression=# insert into schau values ('test','foo');
INSERT 146293 1
regression=# insert into schau values ('test2','');
INSERT 146294 1
regression=# insert into schau values ('test2',null);
ERROR:  ExecAppend: Fail to add null value in not null attribute feld2
regression=# copy schau to '/tmp/schau.out';
COPY
regression=# delete from schau;
DELETE 2
regression=# copy schau from '/tmp/schau.out';
COPY
regression=# select * from schau ;feld1 | feld2
-------+-------test  | footest2 |
(2 rows)

regression=# select * from schau where feld2 is null;feld1 | feld2
-------+-------
(0 rows)

The contents of /tmp/schau.out are:

test    foo
test2    

(there's a tab after test2, in case you can't see it ;-))

I don't see any problem here.
        regards, tom lane


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

Предыдущее
От: Teodor Sigaev
Дата:
Сообщение: Please, apply patch for contrib/tsearch
Следующее
От: "Brian Moran"
Дата:
Сообщение: Re: setting up a trace through extended stored procedures