Repository navigation
PostgreSQL: Parse hexadecimal, octal and binary integer literals - #2758
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2758 +/- ##
==========================================
+ Coverage 82.48% 82.52% +0.04%
==========================================
Files 42 42
Lines 35468 35533 +65
Branches 35468 35533 +65
==========================================
+ Hits 29255 29323 +68
+ Misses 2676 2675 -1
+ Partials 3537 3535 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
LucaCappelletti94
force-pushed
the
upstream/postgres-integer-literals
branch
from
October 28, 2026 20:12
d63b0a1 to
638ba57
Compare
LucaCappelletti94
force-pushed
the
upstream/postgres-integer-literals
branch
from
October 29, 2026 11:55
638ba57 to
81b1cfa
Compare
Contributor
Author
|
Thanks @s5dsn-eqee for the review, I will be merging this now. cc @alamb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since version 16, PostgreSQL reads
0x1F,0X1F,0o17and0b101as integers, with underscores allowed as in0x_FF_FF(docs).PostgreSqlDialectturned0x1FintoValue::HexStringLiteral("1F"), the same value as the bit stringX'1F', and split the other spellings into a zero followed by an alias, soSELECT 0o17came back asSELECT 0 AS o17.The new
Dialect::supports_non_decimal_integer_literals, enabled for PostgreSQL, makes the tokenizer read these prefixes into aNumbertoken that keeps the literal as written, so it round-trips. With thebigdecimalfeature the value is stored as its decimal, the same way10_000already is. Other dialects,GenericDialectincluded, keep0xas a hex string, as MySQL and SQL Server read it.