From b2f9590f58b84b97639e6f2933c55fdc4483d6a9 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 25 Mar 2017 21:26:16 +0100 Subject: [PATCH] Add support for MS SQL XML data type. Given a test case and some reading of the FreeTDS source code, it appears that the XML data type is sent on the wire as (unicode) text. This patch makes pgloader aware of that and also revisit the choice of casting XML to PostgreSQL XML data type (thanks to the test case where we see it just works without surprise). Fix #503. --- src/monkey/mssql.lisp | 2 +- src/sources/mssql/mssql-cast-rules.lisp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monkey/mssql.lisp b/src/monkey/mssql.lisp index 13bfea6..a80d667 100644 --- a/src/monkey/mssql.lisp +++ b/src/monkey/mssql.lisp @@ -81,7 +81,7 @@ (let ((syb-type (foreign-enum-keyword '%syb-value-type type))) (case syb-type ;; we accept emtpy string (len is 0) - ((:syb-char :syb-varchar :syb-text) + ((:syb-char :syb-varchar :syb-text :syb-msxml) (foreign-string-to-lisp data :count len)) (otherwise diff --git a/src/sources/mssql/mssql-cast-rules.lisp b/src/sources/mssql/mssql-cast-rules.lisp index 1de799e..52197ce 100644 --- a/src/sources/mssql/mssql-cast-rules.lisp +++ b/src/sources/mssql/mssql-cast-rules.lisp @@ -10,7 +10,7 @@ (:source (:type "varchar") :target (:type "text" :drop-typemod t)) (:source (:type "nvarchar") :target (:type "text" :drop-typemod t)) (:source (:type "ntext") :target (:type "text" :drop-typemod t)) - (:source (:type "xml") :target (:type "text" :drop-typemod t)) + (:source (:type "xml") :target (:type "xml" :drop-typemod t)) (:source (:type "int" :auto-increment t) :target (:type "bigserial" :drop-default t))