Handle MS SQL columns of float types without scale, fix #177.

The default for MS SQL float types is to only have a precision defined,
as described in https://msdn.microsoft.com/en-us/library/ms173773.aspx,
but the pgloader code didn't know what to do with a float without scale.
This commit is contained in:
Dimitri Fontaine 2015-02-18 23:43:27 +01:00
parent c5f0aeec93
commit 7fd1ddaa5f

View File

@ -84,9 +84,21 @@
(mssql-column-identity col))
"bigserial")
((member type
'("decimal" "numeric" "float" "double" "real")
:test #'string=)
((member type '("float" "real") :test #'string=)
;; see https://msdn.microsoft.com/en-us/library/ms173773.aspx
(if (mssql-column-numeric-scale col)
(if (<= (mssql-column-numeric-scale col) 24)
"float"
"double precision")
;; no scale
(format nil "~a(~a,~a)"
type
(mssql-column-numeric-precision col)
(mssql-column-numeric-scale col))))
((member type '("decimal" "numeric" ) :test #'string=)
;; https://msdn.microsoft.com/en-us/library/ms187746.aspx
(format nil "~a(~a,~a)"
type
(mssql-column-numeric-precision col)