ClickHouse / ClickHouse/clickhouse-java

Query parameters can not be parsed in `DESCRIBE TABLE` query with client-v2

Aperta
#2,400 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area:general bug client-api-v2
Lingua principale
Java
Stelle
1.6k
Fork
636
Merge medio
2g 23h
PR unite (30g)
29

Descrizione

## Description

Bug with `Client#query(sql, params)` for a `DESCRIBE TABLE` query.

### Steps to reproduce

See the unit test below.
The parameter name is not substituted.

### Error Log or Exception StackTrace

```
com.clickhouse.client.api.ServerException: Code: 62. DB::Exception: Syntax error: failed at position 33 (}): }. Expected substitution type (identifier). (SYNTAX_ERROR)
```

### Expected Behaviour

### Code Example

```java
@Test
void testWeirdBugWithParams() throws Exception {
final Client client = new Client.Builder()
.addEndpoint(Protocol.HTTP, "localhost", 8123, false)
.setUsername("default")
.setPassword("")
.build();
final Map params = Map.of("table_name", "`system`.`tables`");
// This query should not throw an exception
client.query("DESCRIBE TABLE {table_name:String}", params).get();
}

```

### Configuration

#### Client Configuration

See above.
#### Environment
* [ ] Cloud
* Client version: 0.8.6
* Language version: Java 17
* OS: Linux

#### ClickHouse Server
* ClickHouse Server version: 25.3.3.42 (official build)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.