Default cast rules for MySQL's text types fixed, see #219

This commit is contained in:
Aliaksei Urbanski 2015-07-13 12:55:33 +00:00 committed by Dimitri Fontaine
parent b4bfa18877
commit 3a55d80411
2 changed files with 15 additions and 6 deletions

View File

@ -92,14 +92,18 @@
:target (:type "decimal" :drop-typemod nil))
;; the text based types
(:source (:type "varchar") :target (:type "text"))
(:source (:type "tinytext") :target (:type "text"))
(:source (:type "text") :target (:type "text"))
(:source (:type "mediumtext") :target (:type "text"))
(:source (:type "longtext") :target (:type "text"))
(:source (:type "tinytext") :target (:type "text") :using pgloader.transforms::remove-null-characters)
(:source (:type "text") :target (:type "text") :using pgloader.transforms::remove-null-characters)
(:source (:type "mediumtext") :target (:type "text") :using pgloader.transforms::remove-null-characters)
(:source (:type "longtext") :target (:type "text") :using pgloader.transforms::remove-null-characters)
(:source (:type "varchar")
:target (:type "varchar" :drop-typemod nil)
:using pgloader.transforms::remove-null-characters)
(:source (:type "char")
:target (:type "varchar" :drop-typemod nil))
:target (:type "char" :drop-typemod nil)
:using pgloader.transforms::remove-null-characters)
;;
;; cl-mysql returns binary values as a simple-array of bytes (as in

View File

@ -212,6 +212,11 @@
(when string
(string-right-trim '(#\Space) string)))
(defun remove-null-characters (string)
"Remove NULL-characters (0x00) from STRING"
(when string
(remove #\Nul string)))
(defun byte-vector-to-bytea (vector)
"Transform a simple array of unsigned bytes to the PostgreSQL bytea
representation as documented at