Skip to content

Bogus SqlParser warning for valid DELETE statement #2569

Closed

Description

@lukaseder

Description

Steps to reproduce

try (Statement s = connection.createStatement()) {
    try {
        s.executeUpdate("create table t (i int, primary key (i)) engine = MergeTree()");

        try (PreparedStatement p = connection.prepareStatement("delete from t where true")) {
            System.out.println(p.executeUpdate());
        }
    }
    finally {
        s.executeUpdate("drop table if exists t");
    }
}

The statement follows valid syntax and also works on the server and via JDBC:

Error Log or Exception StackTrace

12:06:05,741  WARN [SqlParser                     ] - SQL syntax error at line: 1, pos: 0, mismatched input 'delete' expecting {ALTER, ATTACH, CHECK, CREATE, DESC, DESCRIBE, DETACH, DROP, EXISTS, EXPLAIN, INSERT, KILL, OPTIMIZE, RENAME, REPLACE, SELECT, SET, SHOW, SYSTEM, TRUNCATE, USE, WATCH, WITH, GRANT, '('}
0

Expected Behaviour

No log message should be printed

Environment

  • Client version: com.clickhouse:clickhouse-jdbc:0.9.2
  • Language version: OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)
  • OS: Microsoft Windows [Version 10.0.26100.4946]

ClickHouse Server

  • ClickHouse Server version: 25.4.4.25

Activity

  1. added
    jdbc
    sql-parser
    on Sep 9, 2025
  2. chernser commented on Oct 27, 2025

    @chernser
    Contributor

    Verified with com.clickhouse.jdbc.internal.BaseSqlParserFacadeTest#testMiscStatements

  3. added this to the 0.9.3 milestone on Oct 29, 2025
  4. lukaseder commented on Oct 30, 2025

    @lukaseder
    Author

    I'm running into tons of similar issues, but don't know if they will all be addressed by the 0.9.3 version, so I'd rather not do the work of reporting them all here in case you're fixing them all at once. Would it make sense to release 0.9.3 soon, given how severe they must be for all jdbc driver user?

  5. chernser commented on Oct 30, 2025

    @chernser
    Contributor

    Good day, @lukaseder !

    I appreciate you are communicating this issues to us.

    I've merged #2579:

    1. Ports old JavaCC parse as default in JDBC-v2
    2. Some fixes in javacc (some new statements were missing)
    3. fixes in antlr4 (can be used as another option)
    4. parameter extraction is borrowed from v1

    The solution tested against many queries - some of them are composed with help of documentation, some come from ClickHouse itself.

    0.9.3 should be released this week. We currently testing with some tools that use our driver.

  6. lukaseder commented on Oct 30, 2025

    @lukaseder
    Author

    0.9.3 should be released this week. We currently testing with some tools that use our driver.

    Thanks, that's great to hear. I'll resume my own testing and reporting next week, then.

  7. added
    queries
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugjdbcqueriessql-parser

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions