Skip to content

MySQLComStmtPrepareExecutor throws an IndexOutOfBoundsException when insert #34287

@strawberry1314

Description

@strawberry1314

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions