Skip to content

Fix JDBC parser parameter counting for empty comments and SELECT * EXCEPT - #3067

Open
n200534 wants to merge 1 commit into
ClickHouse:mainfrom
n200534:fix/jdbc-parser-argcount-3052
Open

Fix JDBC parser parameter counting for empty comments and SELECT * EXCEPT#3067
n200534 wants to merge 1 commit into
ClickHouse:mainfrom
n200534:fix/jdbc-parser-argcount-3052

Conversation

@n200534

@n200534 n200534 commented Aug 19, 2026

Copy link
Copy Markdown

Summary

  • fix single-line comment scanning when a bare -- is followed immediately by a newline, so later JDBC parameter markers are still discovered
  • extend the bundled ANTLR4 grammar to accept SELECT * EXCEPT (...), including identifier-list and regular-expression forms
  • add regression coverage for top-level and nested empty comments and SELECT * EXCEPT (...) across all three SQL parser backends
  • document the user-visible fix in CHANGELOG.md

Closes #3052

Root cause

ClickHouseUtils.skipSingleLineComment treated a newline located exactly at its start index as if no newline existed, causing the parameter scanner to skip the rest of the SQL. Separately, the bundled ANTLR4 grammar accepted * in a select list but did not model ClickHouse's EXCEPT modifier, so the parse-tree-based backend never reached a later ? marker.

User impact and compatibility

Prepared statements containing either construct now report the correct parameter count and can bind normally instead of failing with ArrayIndexOutOfBoundsException. This does not change public APIs, configuration, wire protocols, or binary compatibility.

Validation

  • mvn -pl jdbc-v2 -am -DskipTests install — passed under JDK 17
  • mvn -pl jdbc-v2 test — 1,331 tests passed
  • mvn -pl clickhouse-data test — 1,554 tests passed, 113 conditionally skipped, 0 failures/errors

Checklist

@CLAassistant

CLAassistant commented Aug 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@n200534
n200534 marked this pull request as ready for review August 19, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants