Engine File(CSVWithNames) inserts redundant headers, so second insert makes file unreadable by selects.
CREATE TABLE tmp (n UInt32, s String) ENGINE = Memory;
CREATE TABLE table_csv AS tmp ENGINE = File(CSVWithNames);
INSERT INTO table_csv SELECT number as n, toString(n) as s FROM numbers(10);
INSERT INTO table_csv SELECT number as n, toString(n) as s FROM numbers(10);
SELECT * FROM table_csv;
Code: 27. DB::Exception: Received from localhost:9000. DB::Exception: Cannot parse input: expected " before: n","s"\n0,"0"\n1,"1"\n2,"2"\n3,"3"\n4,"4"\n5,"5"\n6,"6"\n7,"7"\n8,"8"\n9,"9"\n: (at row 11)
Row 10:
Column 0, name: n, type: UInt32, parsed text: "9"
Column 1, name: s, type: String, parsed text: "<DOUBLE QUOTE>9<DOUBLE QUOTE>"
Row 11:
Column 0, name: n, type: UInt32, ERROR: text "<DOUBLE QUOTE>n<DOUBLE QUOTE>,<DOUBLE QUOTE>s<DOUBLE QUOTE><LINE FEED>0," is not like UInt32
Engine File(CSVWithNames) inserts redundant headers, so second insert makes file unreadable by selects.