Variable panel configuration

I noticed that you have solved several doubts about the multiselect with a variable. I have three configured variables: the first one is STATION: SELECT station FROM alert_register, the second one is UNIT: SELECT station FROM alert_register, and the third one is active: SELECT active FROM alert_register WHERE station IN ($STATION) AND pumping_unit IN ($UNIT); each of the three variables feeds a panel of the VARIABLE plugin and is connected to the alert register panel as follows:

SELECT
    ALERT_ID AS ALERT_ID,
    ALERT_STATE AS ALERT_STATE,
    COALESCE(REGISTRATION_DATE, '0001-01-01 00:00:00') + interval '1 hour' * 5 AS REGISTRATION_DATE,
    COALESCE(TO_CHAR(REGISTRATION_DATE, 'YYYY-MM-DD HH24:MI:SS'), 'No date') AS DATE_AND_TIME_OF_REGISTRATION,
    ALERT_TYPE AS ALERT_TYPE,
    STATION AS STATION,
    PUMPING_UNIT AS PUMPING_UNIT,
    ACTIVE AS ACTIVE,
    PRIORITY AS PRIORITY_LEVEL,
    OBSERVATIONS AS OBSERVATIONS,
    MAINTENANCE_NOTICE AS MAINTENANCE_NOTICE_NUMBER,
    DECISION AS DECISION,
    AFFECTED_COMPONENT AS AFFECTED_COMPONENT,
    RESPONSIBLE AS RESPONSIBLE,
    COALESCE(UPDATE_DATE, 'No date') AS UPDATE_DATE
FROM alert_register
WHERE STATION = $STATION AND PUMPING_UNIT = $UNIT AND ACTIVE = $ACTIVE
ORDER BY ALERT_STATE DESC;

When I select one result for STATION, one for UNIT, and one for ACTIVE, there is no problem, everything works perfectly. However, when I select more than one UNIT, more than one STATION, or more than one ACTIVE, the log panel, where I have the list of my alerts, gives me the following message: "db query error: pq: syntax error at or near “,”. Could you help me solve this problem, please?

How would you do this query outside of grafana with a filter that has more than one value?

I am working with the additional VolKov VARIABLE plugin, and besides that, I am connected to a database with PostgreSQL.


So, when I select only one variable, it brings the correct data, but when I select more than one, it gives the following error: db query error: pq: syntax error at or near “,”
And this is the configuration I have for the variables.

We have already established that. But You still have not answered my question. How would you do a multi value filter query outside if grafana? Also what does the query inspector say.