fix the geometry of a column a sub-decoder derives from an expression - #619
Merged
Conversation
cportele
force-pushed
the
sql-geometry-expression-encoding
branch
from
August 25, 2026 08:00
012203b to
ffc0a63
Compare
…expression SqlQueryColumnOperations told the dialect whether the expression yields a geometry by passing "the column has the WKT operation". A geometry column carries exactly one of the WKT and WKB operations, chosen by queryGeneration.geometryEncoding, so with the default encoding of WKB the dialect was told the expression is not a geometry and returned it unwrapped. Every other consumer of these operations looks at both. Three defects followed from that, in both the PostGIS and the GeoPackage dialect: - a geometry was returned as the raw value of the database instead of the requested encoding - the spatial extent query excludes the WKT and WKB operations because it wraps the raw geometry itself, but the exclusion was not honoured, so the geometry was wrapped twice - forcePolygonCCW and linearizeCurves were not applied, so the same geometry came back differently depending on whether it was reached through an expression The dialect is now given the operation instead of a flag, along with the two geometry options. It cannot hold the encoding itself: it is shared by all providers of its DBMS, while the encoding is set per provider, which is why the field that used to be consulted for it was never assigned. Both dialects implemented the method identically, so it moves to the interface, where it calls the WKT and WKB rendering of the dialect.
azahnen
force-pushed
the
sql-geometry-expression-encoding
branch
from
August 25, 2026 13:01
ffc0a63 to
c4bb374
Compare
azahnen
approved these changes
Aug 25, 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.
This PR fixes an unrelated issue for an edge case (geometry properties with an SQL expression) that was discovered while working on #618. The changes build on top of #618.
SqlQueryColumnOperations told the dialect whether the expression yields a geometry by passing "the column has the WKT operation". A geometry column carries exactly one of the WKT and WKB operations, chosen by queryGeneration.geometryEncoding, so with the default encoding of WKB the dialect was told the expression is not a geometry and returned it unwrapped. Every other consumer of these operations looks at both.
Three defects followed from that, in both the PostGIS and the GeoPackage dialect:
The dialect is now given the operation instead of a flag, along with the two geometry options. It cannot hold the encoding itself: it is shared by all providers of its DBMS, while the encoding is set per provider, which is why the field that used to be consulted for it was never assigned.
Both dialects implemented the method identically, so it moves to the interface, where it calls the WKT and WKB rendering of the dialect.
For correctly configured geometry expressions, the Oracle and DuckDB dialects are handled properly.