ClickHouse / ClickHouse/clickhouse-java

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

Ouverte
#2,400 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area:general bug client-api-v2
Langage dominant
Java
Étoiles
1.6k
Forks
636
Merge moyen
2 j 23 h
PR mergées (30 j)
29

Description

## 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)

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start with Client#query(sql, params) and reproduce the issue using the provided test case and DESCRIBE TABLE query. Trace how the table_name parameter is parsed and substituted; done means the query completes without the syntax error and the regression test passes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
api, databases
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
58/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.