mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-08 07:16:58 +02:00
New test case showing off the 'null if' source field option, see #80.
This commit is contained in:
parent
61ff60d285
commit
32b4cf23e8
@ -10,6 +10,7 @@ REGRESS= allcols.load \
|
||||
csv-error.load \
|
||||
csv-filename-pattern.load \
|
||||
csv-keep-extra-blanks.load \
|
||||
csv-nulls.load \
|
||||
csv-trim-extra-blanks.load \
|
||||
csv.load \
|
||||
dbf.load \
|
||||
|
21
test/csv-nulls.load
Normal file
21
test/csv-nulls.load
Normal file
@ -0,0 +1,21 @@
|
||||
LOAD CSV
|
||||
FROM INLINE (id, number null if '\N', 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 fields terminated by ',',
|
||||
fields enclosed by '"',
|
||||
fields escaped by backslash-quote;
|
||||
|
||||
|
||||
"1",\N,"testing nulls"
|
||||
"2","2","another test"
|
2
test/regress/expected/csv-nulls.out
Normal file
2
test/regress/expected/csv-nulls.out
Normal file
@ -0,0 +1,2 @@
|
||||
1 \N testing nulls
|
||||
2 2 another test
|
Loading…
Reference in New Issue
Block a user