mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-06 22:37:02 +02:00
This gives a default "null if" option to all the input columns at once, and it's still possible to override the default per column. In passing, fix project-fields declarations that SBCL now complains about when they're not true, such as declaring a vector when we might have :null or nil. As a result, remove the (declare (optimize speed)) in the generated field processing code.
22 lines
487 B
Fish
22 lines
487 B
Fish
LOAD CSV
|
|
FROM INLINE (id, number, data)
|
|
INTO postgresql:///pgloader?nullif
|
|
|
|
BEFORE LOAD DO
|
|
$$ drop table if exists nullif; $$,
|
|
$$ CREATE TABLE nullif
|
|
(
|
|
id serial primary key,
|
|
number integer,
|
|
data text
|
|
);
|
|
$$
|
|
|
|
WITH null if '\N',
|
|
fields terminated by ',',
|
|
fields enclosed by '"',
|
|
fields escaped by backslash-quote;
|
|
|
|
|
|
"1",\N,"testing nulls"
|
|
"2","2","another test" |