-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: Additional uint
datatype support for the SQL interface
#15993
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15993 +/- ##
==========================================
+ Coverage 80.89% 80.95% +0.05%
==========================================
Files 1384 1384
Lines 178047 178110 +63
Branches 3043 3043
==========================================
+ Hits 144035 144192 +157
+ Misses 33528 33436 -92
+ Partials 484 482 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
In postgres https://www.postgresql.org/docs/8.1/datatype.html#DATATYPE-INT. |
Ahh, the only thing causing confusion there was me committing an "off by one" error when aligning the int1/2/4/8 types with their tiny/small/big/etc counterparts. Fixed it in the description - the actual code/parsing behaves entirely as expected 😄 |
Finally got to grips with destructuring a nested
vec
("helloas_slice
"😜) so was able to cleanly register some custom datatypes with the SQL parser.Patch notes
PostgreSQL supports the following integer types
int2
,int4
,int8
(for which we also allow thesmallint
,integer
andbigint
aliases). Unfortunately it does not offer unsigned ints, and the parser doesn't offer them (directly) either. We also allowtinyint
for 1 byte ints.There is an extension called
pguint
1 (maintained by one of the PostgreSQL core developers) that addsuint1
,uint2
,uint4
, anduint8
types, as well asint1
.This PR adds support for these additional integer types by registering them via the parser's
SQLDataType::Custom
extension point.Also contains a fix for "CAST", making it strict by default; previously we might silently eat invalid/overflowing casts and return
null
values, which is not desirable.Sorted type parsing code into blocks of related dtypes (vs lexical order) for clarity.
Example
(Note that PostgreSQL defines its datatype sizes in bytes, not bits).
Footnotes
https://github.com/petere/pguint ↩