Skip to content

Bogus SqlParser warning for valid NOT NULL constraint #2572

Closed

Description

@lukaseder

Steps to reproduce

try (Statement s = connection.createStatement()) {
    try {
        s.executeUpdate("create table t (i int not null, primary key (i)) engine = MergeTree()");
    }
    finally {
        s.executeUpdate("drop table if exists t");
    }
}

Error Log or Exception StackTrace

12:27:36,155  WARN [SqlParser                     ] - SQL syntax error at line: 1, pos: 22, mismatched input 'not' expecting {',', ')'}

Expected Behaviour

No warnings, the syntax is valid:

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. lukaseder commented on Sep 9, 2025

    @lukaseder
    Author

    The same happens when marking a column as nullable using that syntax:

    create table t (
      i int, 
      j int null,
      primary key (i)
    ) engine = MergeTree()
  2. added
    jdbc
    sql-parser
    on Sep 9, 2025
  3. andrey-vasilyev commented on Sep 19, 2025

    @andrey-vasilyev

    I confirm I have the same issue

  4. chernser commented on Oct 27, 2025

    @chernser
    Contributor

    Verified in com.clickhouse.jdbc.internal.BaseSqlParserFacadeTest#testStatementsForResultSet

  5. added this to the 0.9.3 milestone on Oct 29, 2025
  6. 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