schizophrenicmaniac opened a new pull request, #40212:
URL: https://github.com/apache/shardingsphere/pull/40212

   Fixes #40195.
   
   Changes proposed in this pull request:
     - Resolve unspecified (OID 0) parameter types in 
`PostgreSQLComBindExecutor` before the parameter values are read, instead of 
routing with `PostgreSQLTypeUnspecifiedSQLParameter` values. This is what made 
`\bind` in psql and `pgbench -M prepared` fail with "Sharding value must 
implements Comparable" or a ClassCastException.
     - Resolve types the same way Describe already does: INSERT statements from 
table metadata, other statements from JDBC metadata with an empty parameter 
list. INSERT can't be routed with empty parameters, which is why Bind reads 
values first today.
     - Move the INSERT parameter type logic from 
`PostgreSQLComDescribeExecutor` into 
`PostgreSQLPreparedStatementParameterTypeResolver` so Describe and Bind share 
it.
     - Add unit tests for the new resolver entry point. Update the Bind test so 
it fails if values are read before types are resolved.
   
   The batch paths (`PostgreSQLAggregatedBatchedStatementsCommandExecutor` and 
openGauss batch bind) still read values before resolving types. I left them out 
to keep this PR focused on the reported Bind case.
   
   ---
   
   Before submitting this PR, I confirm that:
   - [x] My code follows the [code of 
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) 
of this project.
   - [x] I have reviewed my changes.
   - [ ] I have (or in comment I request) added corresponding labels for the 
pull request.
   - [x] I have passed the required local checks: `./mvnw clean install -B -T1C 
-Pcheck`. (Run with `-pl 
proxy/frontend/dialect/postgresql,proxy/frontend/dialect/opengauss`.)
   - [ ] I have updated the relevant documentation, if applicable.
   - [x] I have added or updated unit tests for my changes, if applicable.
   - [x] I have updated the Release Notes of the current development version, 
if applicable. For more details, see [Update Release 
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/).
   
   AI disclosure: drafted with Claude Code (Claude Opus 5.5); files: 
RELEASE-NOTES.md, PostgreSQLPreparedStatementParameterTypeResolver.java, 
PostgreSQLComBindExecutor.java, PostgreSQLComDescribeExecutor.java, 
PostgreSQLPreparedStatementParameterTypeResolverTest.java and 1 more.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to