Open tkporter opened 11 months ago
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
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 https://github.com/SeaQL/sea-query/pull/275#issuecomment-1075383107
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