mirror of
https://github.com/dimitri/pgloader.git
synced 2026-01-30 11:31:01 +01:00
Improve SQLite type names parsing.
Allow spaces in more random places, as SQLite doesn't seem to normalize the user input. Fixes #548 again.
This commit is contained in:
parent
f8460c1705
commit
207cd82726
@ -231,11 +231,6 @@
|
||||
(destructuring-bind (field1 fields) source
|
||||
(list* field1 fields))))
|
||||
|
||||
(defrule open-paren (and ignore-whitespace #\( ignore-whitespace)
|
||||
(:constant :open-paren))
|
||||
(defrule close-paren (and ignore-whitespace #\) ignore-whitespace)
|
||||
(:constant :close-paren))
|
||||
|
||||
(defrule having-fields (and kw-having kw-fields) (:constant nil))
|
||||
|
||||
(defrule csv-source-field-list (and (? having-fields)
|
||||
|
||||
@ -57,3 +57,11 @@
|
||||
quoted-namestring
|
||||
namestring))
|
||||
|
||||
(defrule open-paren (and ignore-whitespace #\( ignore-whitespace)
|
||||
(:constant :open-paren))
|
||||
|
||||
(defrule close-paren (and ignore-whitespace #\) ignore-whitespace)
|
||||
(:constant :close-paren))
|
||||
|
||||
(defrule comma-separator (and ignore-whitespace #\, ignore-whitespace)
|
||||
(:constant ","))
|
||||
|
||||
@ -15,14 +15,16 @@
|
||||
(? " "))
|
||||
(:lambda (noise) (second noise)))
|
||||
|
||||
(defrule sqlite-single-typemod (and #\( (+ (digit-char-p character)) #\))
|
||||
(defrule sqlite-single-typemod (and open-paren
|
||||
(+ (digit-char-p character))
|
||||
close-paren)
|
||||
(:lambda (st) (cons (parse-integer (text (second st))) nil)))
|
||||
|
||||
(defrule sqlite-double-typemod (and #\(
|
||||
(defrule sqlite-double-typemod (and open-paren
|
||||
(+ (digit-char-p character))
|
||||
(* (or #\, #\Space))
|
||||
comma-separator
|
||||
(+ (digit-char-p character))
|
||||
#\))
|
||||
close-paren)
|
||||
(:lambda (dt) (cons (parse-integer (text (second dt)))
|
||||
(parse-integer (text (fourth dt))))))
|
||||
|
||||
@ -31,9 +33,9 @@
|
||||
(defrule sqlite-type-name (and (* extra-qualifiers)
|
||||
(+ (alpha-char-p character))
|
||||
(* extra-qualifiers)
|
||||
(* #\Space)
|
||||
ignore-whitespace
|
||||
(? sqlite-typemod)
|
||||
(* #\Space)
|
||||
ignore-whitespace
|
||||
(* extra-qualifiers))
|
||||
(:lambda (tn) (list (text (second tn))
|
||||
(fifth tn)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user