mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-08 07:16:58 +02:00
Be smarter about MS SQL bit to boolean conversion, should fix #162.
This is a blind patch given that I couldn't CREATE TABLE as per the bug report to try and see by myself what's happening. Better have some tests going on though.
This commit is contained in:
parent
100e942c22
commit
7ccbb45763
@ -11,7 +11,8 @@
|
||||
(:source (:type "nvarchar") :target (:type "text" :drop-typemod t))
|
||||
(:source (:type "xml") :target (:type "text" :drop-typemod t))
|
||||
|
||||
(:source (:type "bit") :target (:type "boolean"))
|
||||
(:source (:type "bit") :target (:type "boolean")
|
||||
:using pgloader.transforms::sql-server-bit-to-boolean)
|
||||
|
||||
(:source (:type "uniqueidentifier") :target (:type "uuid")
|
||||
:using pgloader.transforms::sql-server-uniqueidentifier-to-uuid)
|
||||
|
@ -22,7 +22,8 @@
|
||||
right-trim
|
||||
byte-vector-to-bytea
|
||||
sqlite-timestamp-to-timestamp
|
||||
sql-server-uniqueidentifier-to-uuid))
|
||||
sql-server-uniqueidentifier-to-uuid
|
||||
sql-server-bit-to-boolean))
|
||||
|
||||
|
||||
;;;
|
||||
@ -252,3 +253,15 @@
|
||||
(format nil
|
||||
"~d-~2,'0d-~2,'0d ~2,'0d:~2,'0d:~2,'0dZ"
|
||||
year month date hour minute second)))))
|
||||
|
||||
(defun sql-server-bit-to-boolean (bit-string-or-integer)
|
||||
"We might receive bits as '((0))'"
|
||||
(typecase bit-string-or-integer
|
||||
(integer (if (= 0 bit-string-or-integer) "f" "t"))
|
||||
(string
|
||||
(cond ((string= "0" bit-string-or-integer) "f")
|
||||
((string= "1" bit-string-or-integer) "t")
|
||||
((string= "((0))" bit-string-or-integer) "f")
|
||||
((string= "((1))" bit-string-or-integer) "t")
|
||||
(t nil)))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user