Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQLComStmtPrepareExecutor throws an IndexOutOfBoundsException when insert #34287

Closed
strawberry1314 opened this issue Jan 9, 2025 · 1 comment · Fixed by #34291
Closed

Comments

@strawberry1314
Copy link
Contributor

Bug Report

Which version of ShardingSphere did you use?

5.5.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

proxy

Expected behavior

insert success

Actual behavior

IndexOutOfBoundsException
image

Reason analyze (If you can)

For some prepared SQL statements, if the number of parameters in the inserted statement is greater than the number of fields to be inserted, the method(createParameterColumnDefinition41Packets) in class(MySQLComStmtPrepareExecutor) will throw IndexOutOfBoundsException

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

1、Use GoLang to execute the SQL statement
image

2、sql statement example:
insert into test_table (id, content, version, create_time) values (?, ?, ?, ?) ON DUPLICATE KEY UPDATE version = ?, update_time =?

Example codes for reproduce this issue (such as a github link).

Class : MySQLComStmtPrepareExecutor
image

@strongduanmu
Copy link
Member

Hi @strawberry1314, thank you for your feedback. Can you sumbit a pr to fix this bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants