Skip to content

[jdbc] Parsing statement containing WITH clause fails on client side #2391

Closed
@DNAlchemist

Description

@DNAlchemist

Description

0.8.6 Patch broke parameter parsing in WITH block
I think it's related to this: #2351

Expected Behaviour

Code Example

    @Test
    void test_parameters() throws SQLException {
        String sql = """
            WITH
                toDateTime(?) AS target_time
            SELECT *
            FROM table
            """;
        assertEquals(1, new ConnectionImpl(host, properties)
            .prepareStatement(sql)
            .getParameterMetaData()
            .getParameterCount());
    } // pass
    @Test
    void test_parameters() throws SQLException {
        String sql = """
            WITH
                toDateTime(?) AS target_time,
                select 1 as gr
            SELECT *
            FROM table
            """;
        assertEquals(1, new ConnectionImpl(host, properties)
            .prepareStatement(sql)
            .getParameterMetaData()
            .getParameterCount());
    } // 0.8.5 - pass, 0.8.6 - fail

#### Environment
* [ ] Cloud
* Client version: 0.8.6
* Language version: java
* OS: MacOs

#### ClickHouse Server
* ClickHouse Server version:
* ClickHouse Server non-default settings, if any:
* `CREATE TABLE` statements for tables involved:
* Sample data for all these tables, use [clickhouse-obfuscator](https://github.com/ClickHouse/ClickHouse/blob/master/programs/obfuscator/Obfuscator.cpp#L42-L80) if necessary

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions