"Select All" selection with variable filter make queries fail

Grafana version : v10.3.3 (252761264e22ece57204b327f9130d3b44592c01)
OS : docker official image
Fetch to a PostgresSQL DB

What i want to do :

Hello, I want to add variables to my queries. My dashboard is a database of possible new CVEs for each host (IPs) and Port that our Red Team needs to test.

Problem:

Status: 500. Message: db query error: pq: syntax error at or near ".6"

Whether I select any IP, the third block of the IP is always returned as an error.

My query works fine without the parameter in the variable.

My query :

SELECT 
    (TO_TIMESTAMP(MIN(results.date)) AT TIME ZONE 'UTC' AT TIME ZONE 'Europe/Paris' + interval '1 hour') AS "Date de Detection",
    results.host,
    results.port,
    results.severity,
    nvts.cve,
    nvts.summary AS "Description",
    STRING_AGG(results.description, ', ') AS "Patch"
FROM 
    results
JOIN
    nvts ON results.nvt = nvts.uuid 
WHERE 
    results.type NOT LIKE '%Log%'
    AND results.host = ${ip}
    AND results.port = ${port}
GROUP BY
    results.host,
    results.port,
    results.severity,
    nvts.summary,
    nvts.cve
ORDER BY 
    results.severity DESC;

Here are my variables. (I put varchar in my filter query, thinking it would solve my problem, but in the end it didn’t).

Question: Does anyone know where the error might have come from ?

Welcome @user179

Click on Query Inspector and see what the query looks like

Yes, here it is

NOTE : if i select only 1 element in the filter. i.e. 1 IP and 1 port it work well but if i select 2 or more i have the problem

AND result.host in (${ip})
AND result.port in (${port})

2 Likes

Thank you ! it works !

And why my query for variable value doesn’t actualize itself ?

can you show the variable options?

have you set the refresh to “On time range change” ? try it.