From bd84c6fec962a6acac691bcd904fe5701e2a8c31 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Mon, 23 Jan 2017 21:50:16 +0100 Subject: [PATCH] Fix default value handling in MS SQL. When the column is known to be non-nullable, refrain from adding a null default value to it. This also fixes the case of casting from an [int] IDENTITY(1,1) NOT NULL That otherwise did get transformed into a bigserial not null default NULL Causing then the error Database error 42601: multiple default values specified for column ... of table ... --- src/sources/mssql/mssql-cast-rules.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sources/mssql/mssql-cast-rules.lisp b/src/sources/mssql/mssql-cast-rules.lisp index a6a64f1..6c87c81 100644 --- a/src/sources/mssql/mssql-cast-rules.lisp +++ b/src/sources/mssql/mssql-cast-rules.lisp @@ -124,7 +124,7 @@ ;; normalize default values ;; see *pgsql-default-values* (setf (column-default pgcol) - (cond ((null default) :null) + (cond ((and (null default) (column-nullable pgcol)) :null) ((and (stringp default) (string= "NULL" default)) :null) ((and (stringp default)