Repository navigation
Description
Describe the bug
Table with transaction column name not parsed
create table test_execute_batch(a Int32, transaction String)engine=Memory
Expected behaviour
It should be parsed and the table should be created.
Code example
Assert.assertFalse(stmt.execute("drop table if exists test_execute_batch; "
+ "create table test_execute_batch(a Int32, transaction String)engine=Memory"), "Should not have result set");
Error log
2023-10-23 10:44:09:447 -0400 [main] WARN ClickHouseSqlParser - Parse error at line 1, column 83. Encountered: transaction. If you believe the SQL is valid, please feel free to open an issue on Github with this warning and the following SQL attached.
drop table if exists test_execute_batch; create table test_execute_batch(a Int32, transaction String)engine=Memory
java.sql.SQLException: Code: 62. DB::Exception: Syntax error (Multi-statements are not allowed): failed at position 40 (end of query): ; create table test_execute_batch(a Int32, transaction String)engine=Memory. . (SYNTAX_ERROR) (version 23.2.4.12 (official build))
, server ClickHouseNode [uri=http://localhost:49238/test_statement]@1568086
Configuration
Environment
- Client version:
- Language version:
- OS:
ClickHouse server
- ClickHouse Server version:
- ClickHouse Server non-default settings, if any:
CREATE TABLEstatements for tables involved:- Sample data for all these tables, use clickhouse-obfuscator if necessary
Activity
mzitnik commentedon Oct 25, 2023
@subkanthi Can you provide a simple snippet that reproduces the issue?
subkanthi commentedon Oct 25, 2023
Hi @mzitnik , here is the modified Integration test
Note: with backticks it works
transactionmva-coinify commentedon Nov 1, 2024
Any chance this can be fixed? Seems like the issue is replicable and has been a year ago.
chernser commentedon Nov 4, 2024
Good day, @mva-coinify!
Will look into it.
Would it help if column is wrapped with
"?chernser commentedon Jan 9, 2025
need to retest with new jdbc driver
github-actions commentedon Jan 11, 2026
This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!
chernser commentedon Jan 30, 2026
parser problem. know issue.
polyglotAI-bot commentedon Nov 28, 2026
Recommendation: Keep open — fix needed
Only the v1 driver (
clickhouse.jdbc.v1=true) still fails to parsetransactionas a column name. jdbc-v2, the default driver of theclickhouse-jdbcartifact, parses it since #2725 (first release v0.9.7), so the fix is needed in v1 only.main: Reproduced on main — the v1 driver logs the parse error for each statement withtransaction, and the two-statementexecutefails withMulti-statements are not allowed. jdbc-v2 parses all the statements.Analysis: In the v1 grammar, the rule
anyKeyword(the keywords that can be names) has no<TRANSACTION>(clickhouse-jdbc/src/main/javacc/ClickHouseSqlParser.jj:1010). So the v1 parser stops at the column name: a single statement still runs, but the driver cannot split two statements, and it sends them to the server as one. The jdbc-v2 grammar has<TRANSACTION>in the same rule (jdbc-v2/src/main/javacc/ClickHouseSqlParser.jj:1093); jdbc-v2 does not accept two statements in oneexecutecall (jdbc-v2/src/main/java/com/clickhouse/jdbc/internal/SqlParserFacade.java:236).Reproduction: complete program and output
Changed from the issue's steps: the TestNG test is a
mainthat runs with jdbc-v2 and with the v1 driver (compress=0because of #3107); added a contrast with a columnb, the statements one by one, and a prepared insert.Output on
main(8480ca001), ClickHouse 26.11.4.11:Automated triage by Polyglot AI. A maintainer makes the final decision.