Skip to content

[jdbc-v2] Throw SQLException for an invalid PreparedStatement parameter index - #3465

Open
arimu1 wants to merge 1 commit into
ClickHouse:mainfrom
arimu1:fix/3462-setter-sql-exception
Open

arimu1 wants to merge 1 commit into
ClickHouse:mainfrom
arimu1:fix/3462-setter-sql-exception

Conversation

@arimu1

@arimu1 arimu1 commented Nov 29, 2026 •

Copy link
Copy Markdown

Summary

jdbc-v2 PreparedStatement setters threw ArrayIndexOutOfBoundsException when the parameter index was 0, negative, above the marker count, or used on a statement with no markers (for example INSERT ... FORMAT CSV). The RowBinary writer (WriterStatementImpl, beta.row_binary_for_simple_insert) had the same behaviour.

Setters now throw SQLException with the same message as ParameterMetaData for that index. Valid indexes are unchanged.

Fixes #3462

Checklist

@arimu1
arimu1 requested review from a team and mzitnik as code owners November 29, 2026 06:56
import static org.testng.Assert.expectThrows;

@Test(groups = {"unit"})
public class PreparedStatementImplTest {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use existing tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[jdbc-v2] PreparedStatement setters throw ArrayIndexOutOfBoundsException, not SQLException, for an invalid parameter index

2 participants