mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Allow quoted field names to contain spaces, fix #285.
Given a fully quoted field name, there should be no restriction about using spaces in between the quotes, but the parser used to choke on that case.
This commit is contained in:
parent
62f0b7fc56
commit
b78bb6dd31
@ -197,16 +197,22 @@
|
||||
(defrule csv-field-options (? csv-field-option-list))
|
||||
|
||||
(defrule csv-raw-field-name (and (or #\_ (alpha-char-p character))
|
||||
(* (or (alpha-char-p character)
|
||||
(digit-char-p character)
|
||||
#\Space
|
||||
#\.
|
||||
#\$
|
||||
#\_)))
|
||||
(:text t))
|
||||
|
||||
(defrule csv-bare-field-name (and (or #\_ (alpha-char-p character))
|
||||
(* (or (alpha-char-p character)
|
||||
(digit-char-p character)
|
||||
#\.
|
||||
#\$
|
||||
#\_)))
|
||||
(:text t))
|
||||
|
||||
(defrule csv-bare-field-name csv-raw-field-name
|
||||
(:lambda (name)
|
||||
(string-downcase name)))
|
||||
(string-downcase (text name))))
|
||||
|
||||
(defrule csv-quoted-field-name (and #\" csv-raw-field-name #\")
|
||||
(:lambda (csv-field-name)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
LOAD CSV
|
||||
FROM inline (rownum, ts [date format 'YYYY-MM-DD HH24-MI-SS.US'])
|
||||
INTO postgresql:///pgloader?dateformat (rownum, ts)
|
||||
FROM inline ("row num", ts [date format 'YYYY-MM-DD HH24-MI-SS.US'])
|
||||
INTO postgresql:///pgloader?dateformat ("row num", ts)
|
||||
|
||||
WITH truncate,
|
||||
fields optionally enclosed by '"',
|
||||
@ -14,8 +14,8 @@ LOAD CSV
|
||||
BEFORE LOAD DO
|
||||
$$ drop table if exists dateformat; $$,
|
||||
$$ create table dateformat (
|
||||
rownum smallint,
|
||||
ts timestamp
|
||||
"row num" smallint,
|
||||
ts timestamp
|
||||
);
|
||||
$$;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user