Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode
Дата
Msg-id CAB7nPqQ5i3-ccXuPBu6dzP=TRDkTrun++fF4kgAYzvthrmjQyA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
On Wed, Mar 5, 2014 at 11:58 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> So if we specify both this produces the exact opposite of the default,
> default being an empty string inserted for a quoted empty string and
> NULL inserted for a non-quoted empty string. So yes I'm fine with a
> note on the docs about that, and some more regression tests.

For people who did not get this one, here is a short example:
=# ¥pset null 'null'
Null display (null) is "null".
=# create table aa (a text);
CREATE TABLE
=# COPY aa FROM STDIN WITH (FORMAT csv);
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> ""
>>
>> \.
=# select * from aa; a
------
null
(2 rows)
=# truncate aa;
TRUNCATE TABLE
Time: 12.149 ms
=# COPY aa FROM STDIN
WITH (FORMAT csv, FORCE_NULL(a), FORCE_NOT_NULL(a));
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> ""
>>
>> \.
Time: 3776.662 ms
=# select * from aa; a
------null

(2 rows)
--
Michael



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Fwd: patch: make_timestamp function