mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-05 02:46:10 +02:00
Allow SQLite type names such as "double precision".
The parsing of the type names from the SQLite catalogs needs to allow for names with spaces in them, because SQLite allows that too. Fixes #921.
This commit is contained in:
parent
11d926126e
commit
1bdc0ee5f4
@ -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)))))
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user