Parameter placeholder Postgresql

This query works as it should (outside Go)

SELECT job_id,job_subjectFROM job
WHERE lower(concat(job_id,job_subject)) like lower('%WEB%')

I am trying to replace “WEB” with a placeholder in this query.

SELECT job_id,concat(co_name1||co_name2) as co_name,job_subject FROM job
WHERE lower(concat(job_id,job_subject)) like lower('%$?%')

In Go I use this:

rows, err := db.Queryx(query, val)

But I get this error:

pq: got 1 parameters but the statement requires 0

What am I doing wrong?

The answer was to concatenate to a string:

lower('%'||$1||'%')

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.