Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion clojure/src/pgloader/ddl/common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
(= lower "xml") "xml"
;; Pass-through array types from PostgreSQL sources (#1371)
(str/ends-with? lower "[]") lower
(str/starts-with? upper "BIGSERIAL") "bigserial"
(str/starts-with? upper "BIGSERIAL") "bigserial"
(str/starts-with? upper "SMALLSERIAL") "smallserial"
(str/starts-with? upper "SERIAL") "serial"
;; Unsigned integers: upcast to avoid overflow (matches CL cast rules)
(and unsigned? (str/starts-with? upper "TINYINT")) "smallint"
(and unsigned? (str/starts-with? upper "SMALLINT")) "integer"
Expand Down
4 changes: 3 additions & 1 deletion clojure/src/pgloader/source/mssql.clj
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@
is-identity (= 1 (:is_identity c))
is-pk (some #(= (:column_name c) %) (mapv :column_name pkeys))
ai (and is-identity is-pk)]
(let [pg-type (if ai "bigserial" (mssql-type->pg col-type))
(let [pg-type (if ai
(if (= col-type "bigint") "bigserial" "serial")
(mssql-type->pg col-type))
raw-def (when-not ai (:column_default c))]
{:column-name (:column_name c)
:column-type pg-type
Expand Down
2 changes: 1 addition & 1 deletion src/sources/mssql/mssql-cast-rules.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(:source (:type "xml") :target (:type "xml" :drop-typemod t))

(:source (:type "int" :auto-increment t)
:target (:type "bigserial" :drop-default t))
:target (:type "serial" :drop-default t))

(:source (:type "bigint" :auto-increment t)
:target (:type "bigserial"))
Expand Down
Loading