Fix PostgreSQL connector handling of extreme decimal scales#28414
Merged
findepi merged 5 commits intotrinodb:masterfrom Feb 25, 2026
Merged
Fix PostgreSQL connector handling of extreme decimal scales#28414findepi merged 5 commits intotrinodb:masterfrom
findepi merged 5 commits intotrinodb:masterfrom
Conversation
Remove unnecessary constructors taking `boolean exposeFixedPorts`. Deduplicate constructor overloads taking either image name as either `String` or `DockerImageName`.
To retain file history.
Reorder the logic: handle types mappable to Trino DECIMAL first. Only then check the decimal mapping value which governs how to map those that cannot be mapped directly to DECIMAL. This is meant to be just syntactic code a refactor, with no change in behavior.
Fix PostgreSQL connector handling of decimals with negative scale, and also of decimals with scale bigger than precision. Before the changes, both cases were just failing with `DecimalType` constructor. The code did not try to handle scale>precision case. For negative scale, the code assumed it is reported as negative DECIMAL_DIGITS, but that's not the case. This also adds PostgreSQL connector type mappings coverage with - latest PostgreSQL version - PostgreSQL 15, the oldest supported version with NaN, and infinity support within NUMERIC type
This was referenced Feb 23, 2026
losipiuk
approved these changes
Feb 23, 2026
wendigo
reviewed
Feb 23, 2026
| if (0 <= decimalDigits && decimalDigits <= 1000) { | ||
| return OptionalInt.of(decimalDigits); | ||
| } | ||
| if ((2048 - 1000) <= decimalDigits && decimalDigits < 2048) { |
Contributor
There was a problem hiding this comment.
introduce const for 2048. move comment to it
Member
Author
There was a problem hiding this comment.
it won't make the code more readable; actually the opposite.
wendigo
approved these changes
Feb 23, 2026
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.
Fix PostgreSQL connector handling of decimals with negative scale, and
also of decimals with scale bigger than precision. Before the changes,
both cases were just failing with
DecimalTypeconstructor. The codedid not try to handle scale>precision case. For negative scale, the code
assumed it is reported as negative DECIMAL_DIGITS, but that's not the
case.
This also adds PostgreSQL connector type mappings coverage with
support within NUMERIC type
.