I use COPY
command to take a copy of data. COPY
looks more simple than sstables. But it looks like it can't import empty string. Columns which are empty in original table are null in imported. Steps to reproduce below.
CREATE TABLE empty_example (id bigint PRIMARY KEY, empty_column text, null_column text);
INSERT INTO empty_example (id, empty_column) VALUES ( 1, '');
SELECT * from empty_example ;
id | empty_column | null_column
----+--------------+-------------
1 | | null
COPY empty_example TO 'empty_example.csv';
TRUNCATE empty_example ;
COPY empty_example FROM 'empty_example.csv';
SELECT * from empty_example ;
id | empty_column | null_column
----+--------------+-------------
1 | null | null
I tried to play with WITH
options but couldn't solve the issue.
Is it possible to preserve null/empty string distinction with COPY
?