Skip to content

Query Builder: Column names containing parentheses not handled correctly #1217

@mbUSC

Description

@mbUSC

(cross-posting from 103501 in the Grafana repo)

What happened?

If a column name contains parentheses, the query builder fails to generate the correct SQL statements.

For example, let's say we have a Clickhouse data source that has a table with the following columns:

  • Track ID
  • Length (Kilometers)

When selecting those two columns, the query builder generates this SQL:

SELECT "Track ID", Length (Kilometers) FROM "mydatabase" . "TracksTable" LIMIT 1000

What did you expect to happen?

The correct SQL should be generated (i.e. Length (Kilometers) should be enclosed in double quotes):

SELECT "Track ID", "Length (Kilometers)" FROM "mydatabase" . "TracksTable" LIMIT 1000

Did this work before?

Not sure

How do we reproduce it?

See example provided above

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

Grafana: 11.6.0
OS: MacOS
Browser: Safari

Grafana platform?

Kubernetes

Datasource(s)?

Clickhouse Datasource plugin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions