Always getting postgres sql error when adding sql parameter

Hello

I may be having a misunderstanding of how to use sql parameters to allow users to dynamically filter the data.

First I created a multi-series line chart, then I’m trying to allow users to filter on a particular column

so I would add a sql parameter to the where clause, but then I’d get this: Any idea why that is?

org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.

Also, when I comment out the line where I’ve added the sql parameter, and try to run the query again, I’d still get the same error.

Ah, I see that I have put quotes around the variable name, which is not nessary
where category = {{category}}
and not
where category = ‘{{category}}’

However, this doesn’t work when it’s not a text field, that is if I wanted to use a drop down filter.

Yes - in combination with the syntax you assumed correct:

where category = {{category}}

Which isn’t how Metabase wants it. This is becoming pretty #faq … See:

HTH