Fix MS SQL protocol handling of bigint.

Actually, fix pgloader not to depend on MS SQL specifics for bigints in
the protocol. Depending on the protocol version in the driver's setup,
MS SQL would send bigints either as floats on the wire, loosing range,
or as something else entirely which values do not match with what's in
the database actually.

Here we just convert the values to NUMERIC by using a CAST expression
directly in the query, so that the protocol only see NUMERIC and
everyone is happy. Or should be. Let's try that.
This commit is contained in:
Dimitri Fontaine 2014-12-22 11:04:01 +01:00
parent 1a083af950
commit 77e11416a3

View File

@ -298,6 +298,7 @@ ORDER BY CONSTRAINT_NAME, KCU1.ORDINAL_POSITION
Mostly we just use the name, and make try to avoid parsing dates."
(case (intern (string-upcase type) "KEYWORD")
(:datetime (format nil "convert(varchar, [~a], 126)" name))
(:bigint (format nil "cast([~a] as numeric)" name))
(t (format nil "[~a]" name))))
(defun get-column-list (columns)