mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Accept more syntaxes for fields and columns, fixes #79.
With this patch it's now possible to "quote" column names and to use _ (underscore) as the leading character in a field or column name. Of course it is still unnecessary to quote the column names, but handling the PostgreSQL quoting rules can't be bad here.
This commit is contained in:
parent
b1c1b8bd45
commit
ecd4f31d12
@ -1558,12 +1558,20 @@ load database
|
||||
(:lambda (options)
|
||||
(alexandria:alist-plist options)))
|
||||
|
||||
(defrule csv-field-name (and (alpha-char-p character)
|
||||
(* (or (alpha-char-p character)
|
||||
(digit-char-p character)
|
||||
#\_)))
|
||||
(defrule csv-bare-field-name (and (or #\_ (alpha-char-p character))
|
||||
(* (or (alpha-char-p character)
|
||||
(digit-char-p character)
|
||||
#\_)))
|
||||
(:text t))
|
||||
|
||||
(defrule csv-quoted-field-name (and #\" csv-bare-field-name #\")
|
||||
(:lambda (csv-field-name)
|
||||
(destructuring-bind (open name close) csv-field-name
|
||||
(declare (ignore open close))
|
||||
name)))
|
||||
|
||||
(defrule csv-field-name (or csv-quoted-field-name csv-bare-field-name))
|
||||
|
||||
(defrule csv-source-field (and csv-field-name csv-field-options)
|
||||
(:destructure (name opts)
|
||||
`(,name ,@opts)))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user