Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement null if support as a WITH option.
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.
- Loading branch information
Showing
3 changed files
with
55 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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" |