-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
postgres: silently uses signed integers when unsigned integers are specified in schema #731
Comments
Yes, we can add a feature flag to panic, if that's what you wanted. For example, https://github.com/SeaQL/sea-query/pull/723/files |
thank you :) to be transparent, I don't believe I'll have the bandwidth to contribute this, but I'd love to see this happen. In the meantime we'll likely migrate to some larger data types |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Hi!
We have a table whose columns were created as unsigned integers, which we had originally expected to be a 4 byte unsigned integer. At the time, I don't think we realized that postgres doesn't support unsigned integers. Only now upon trying to insert a value >
(2^31) - 1
did I realize that the real column data type is a signed integer.I'm not sure if this is documented behavior where sea-query will silently use signed integers under the hood if using Postgres. Have you considered making the use of unsigned integers prohibited if using postgres? Maybe it could be put behind a feature flag, or some other compile time check? This is unfortunately now a pain for us to change so we can use higher value u32s.
Poking around, it seems we're not the first to need to hack around this #275 (comment)
Steps to Reproduce
ColumnDef::new(Foo::Bar).unsigned()
using postgres under the hood\d my_table
, which uses a normal integerExpected Behavior
Would've expected to not be able to create an unsigned integer, or some assurances about the number range I can use
Actual Behavior
uses a signed integer under the hood
Reproduces How Often
every time w/ postgres
Versions
db: PostgreSQL 14
Additional Information
The text was updated successfully, but these errors were encountered: