fix: canonicalize type OIDs embedded in binary array and composite values - #1515
Draft
rlittlefield wants to merge 1 commit into
Draft
fix: canonicalize type OIDs embedded in binary array and composite values#1515rlittlefield wants to merge 1 commit into
rlittlefield wants to merge 1 commit into
Conversation
rlittlefield
force-pushed
the
oid-payload-rewrite
branch
from
September 10, 2026 17:30
3c4a5ed to
5c173b6
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
rlittlefield
force-pushed
the
oid-payload-rewrite
branch
3 times, most recently
from
September 10, 2026 17:49
37d1f52 to
7a25da1
Compare
rlittlefield
force-pushed
the
oid-payload-rewrite
branch
from
September 10, 2026 17:57
7a25da1 to
c4c564f
Compare
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.
Closes a gap in
canonicalize_type_information: rewriting RowDescription / ParameterDescription / Parse is not enough for arrays and composites. Binary array values embed the element type OID and binary composite (and anonymousrecord) values embed the OID of every field. Postgrex decodes arrays in binary format and checks the element OID against its type cache, so an array of a custom enum coming from a shard with different OIDs fails to decode even though the RowDescription was canonicalized.Independent of #1514 (which handles types created after PgDog loaded its mappings); both apply cleanly on main.
Behavior:
typtype,typcategory,typelem,typbasetype) are loaded frompg_typealongside the OIDs, for both the shard and the canonical set.PreparedStatementstracks bound portals per server connection (Bind → Execute, matched by portal name; suspended portals are kept for re-execution). For the executing portal, DataRow columns requested in binary format whose type is an array/composite/record have the embedded OIDs rewritten shard → canonical, recursing through nested values and looking through domains. Column types come from the portal's own Describe response (shard OIDs) or the cached RowDescription of the statement (canonical, mapped back).Testing: unit tests cover the payload rewriter (arrays, empty arrays, composites with nested arrays, arrays of composites, anonymous records, domains over arrays, malformed input), type kind classification, ParameterDescription caching, Bind rewrites (from ParameterDescription and from Parse data types), DataRow rewrites via both the portal Describe and the cached RowDescription, suspended portals, and text format being left alone.
integration/rustgainstest_oid_drift_arraysincross_shard_oid_drift.rs: an enum array round-trips through every shard with the element OID inside the binary payload checked against shard 0's. Ran locally against a two-shard setup;cargo fmtandcargo clippyare clean.