Variable query not match

Hello, I have 2 Grafana v11.0.0 and v10.1.4. I get an error when I define variables in both of them.

I am pulling a column with a query. The data in it is like ABC SIGORTA or DFG SIGORTA. When I want to filter with a query, I get the error = Status: 500. Message: db query error: pq: syntax error at or near “SIGORTA”.

query like this . select a.“ACENTE_ADI” from center_agenc e a
where
a.ay= $ay
and a.“ACENTE_ADI” = $ADI

The variable named ay works, but I get this error when there is a space or _ in the data.

I wonder if there is an error in the data type while defining the variable.
Thanks for help.

click on query inspector and post what you see there please

Try to use quotes around variable, i.e. something like this:

select a."ACENTE_ADI" from center_agence a
where
a.ay = ${ay}
and a."ACENTE_ADI" = [[ADI]]

or

select a."ACENTE_ADI" from center_agence a
where
a.ay = ${ay}
and a."ACENTE_ADI" = '${ADI:raw}'
1 Like

or just simple add single quotes on ADI

$ADI

Thank you, the second solution you provided solved the problem. ‘${ADI:raw}’