Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect default cast from MSSQL int (auto-increment) to PG bigserial #1590

Open
nathanael-ruf opened this issue Jun 20, 2024 · 0 comments · May be fixed by #1596
Open

Incorrect default cast from MSSQL int (auto-increment) to PG bigserial #1590

nathanael-ruf opened this issue Jun 20, 2024 · 0 comments · May be fixed by #1596

Comments

@nathanael-ruf
Copy link

int is 4 bytes in mssql: https://learn.microsoft.com/en-us/sql/t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql?view=sql-server-ver16
bigserial is 8 bytes: https://www.postgresql.org/docs/current/datatype-numeric.html

Expected: pgloader converts to serial (4 bytes).

Besides just more space this has implications for node applications using the pg library which returns strings instead of numbers because numbers in js can't represent full 64bit integers.

Location in the code:

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

(related: #1586. I only found this issue after applying the fix of #1586 on a fork)

gnarlex added a commit to gnarlex/pgloader that referenced this issue Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant