Repository navigation
Decode binary-format parameters by their declared type in PgProtocolHandler - #754
Merged
brittleboye merged 3 commits intoOct 15, 2026
Merged
Conversation
…andler The PostgreSQL JDBC driver sends numeric parameters in binary format: setLong arrives as the 8 bytes of an int8. Bind passed every binary parameter to setBytes, so Calcite received a byte string where it expected a number and the statement failed with "ByteString cannot be cast to class java.lang.Number". Decode a binary parameter by the type OID the client declared in Parse (int2, int4, int8, oid, float4, float8, bool and the text types). Types without a decoding, and parameters with no declared type, are bound as bytes as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
The failing It reproduces on an untouched So the job fails whenever the generator happens to pick flag 0 or 1. A re-run should clear it here (I cannot trigger one). I can open a separate issue or pull request for the hash code mismatch if that is useful. |
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.
Prepared statements from the PostgreSQL JDBC driver send numeric parameters in binary format. Binding those bytes with
setBytesgives Calcite a byte string where it expects a number, so numeric inserts and updates fail.Decode binary parameters using the type OID declared in Parse. Signed integers, floating-point values, booleans and text use the corresponding JDBC setters; OIDs are widened as unsigned 32-bit values, preserving values through 4294967295. Invalid fixed-width lengths return SQLSTATE
08P01. Unsupported or unspecified types retain the existing byte-array fallback.Validation:
PgBinaryParameterTestcovers unsigned OID boundaries, signed INT4 boundaries and malformed OID lengths before binding../mvnw -B -T1C test -pl convex-db -ampassed (database suite: 188 tests, 2 existing skips)../mvnw -B clean installpassed across all modules on JDK 25 on retry. The first attempt failed the unchanged coreBlobsParamTest.testSliceidentity assertion (Inconsistent Hash on 0x); the isolated test passed, and the full retry passed.The separate extended-query RowDescription issue remains covered by #755; this PR does not enable the two SELECT tests skipped for that issue.