diff --git a/src/parsers/parse-sqlite-type-name.lisp b/src/parsers/parse-sqlite-type-name.lisp index cfa9fb2..8143371 100644 --- a/src/parsers/parse-sqlite-type-name.lisp +++ b/src/parsers/parse-sqlite-type-name.lisp @@ -31,20 +31,27 @@ (defrule sqlite-typemod (or sqlite-double-typemod sqlite-single-typemod)) -(defrule sqlite-type-name (and (* extra-qualifiers) - (+ (or (alpha-char-p character) #\_)) +;; type names may be "double quoted", such as "double precision" +(defrule sqlite-type-name (or (+ (and (not extra-qualifiers) + (+ (or (alpha-char-p character) #\_)) + (? " ")))) + (:text t)) + +(defrule sqlite-type-expr (and (* extra-qualifiers) + sqlite-type-name (* extra-qualifiers) ignore-whitespace (? sqlite-typemod) ignore-whitespace (* extra-qualifiers)) - (:lambda (tn) (list (text (second tn)) - (fifth tn) - (remove-if #'null - (append (first tn) (third tn) (seventh tn)))))) + (:lambda (tn) + (list (text (second tn)) + (fifth tn) + (remove-if #'null + (append (first tn) (third tn) (seventh tn)))))) (defun parse-sqlite-type-name (type-name) (if (string= type-name "") ;; yes SQLite allows for empty type names "text" - (values-list (parse 'sqlite-type-name (string-downcase type-name))))) + (values-list (parse 'sqlite-type-expr (string-downcase type-name))))) diff --git a/src/sources/sqlite/sqlite-cast-rules.lisp b/src/sources/sqlite/sqlite-cast-rules.lisp index e162a5a..0192a66 100644 --- a/src/sources/sqlite/sqlite-cast-rules.lisp +++ b/src/sources/sqlite/sqlite-cast-rules.lisp @@ -35,6 +35,9 @@ (:source (:type "double") :target (:type "double precision") :using pgloader.transforms::float-to-string) + (:source (:type "double precision") :target (:type "double precision") + :using pgloader.transforms::float-to-string) + (:source (:type "numeric") :target (:type "numeric" :drop-typemod nil) :using pgloader.transforms::float-to-string) diff --git a/test/sqlite/sqlite.db b/test/sqlite/sqlite.db index bbe1f5f..ff6df4e 100644 Binary files a/test/sqlite/sqlite.db and b/test/sqlite/sqlite.db differ