From 2f7169e286cf941152f1eef971e7bf32822b21a7 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 25 Feb 2017 16:14:26 +0100 Subject: [PATCH] Fix MS SQL N'' default values. MS SQL apparently sends default values as Nvarchar, and in this case it means we have to deal ourselves with the N'' representation of it. --- src/sources/mssql/mssql-cast-rules.lisp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sources/mssql/mssql-cast-rules.lisp b/src/sources/mssql/mssql-cast-rules.lisp index 57f3d5f..176f2ef 100644 --- a/src/sources/mssql/mssql-cast-rules.lisp +++ b/src/sources/mssql/mssql-cast-rules.lisp @@ -128,6 +128,11 @@ (cond ((and (null default) (column-nullable pgcol)) :null) ((and (stringp default) (string= "NULL" default)) :null) + ;; fix stupid N'' behavior from MS SQL column default + ((and (stringp default) + (uiop:string-enclosed-p "N'" default "'")) + (subseq default 2 (+ (length default) -1))) + ((and (stringp default) ;; address CURRENT_TIMESTAMP(6) and other spellings (or (uiop:string-prefix-p "CURRENT_TIMESTAMP" default)