I have a query:
SELECT mt.* FROM myTable as mt
WHERE mt."colName" IN ("PM")
and it always returns zero rows. But, if I change it so that the string is in single quotes:
SELECT mt.* FROM myTable as mt
WHERE mt."colName" IN ('PM')
then it returns the desired rows.
Clue: myTable has a column named "PM".
So, if I search for rows with the string "ABC" in column "colName", it will find rows. But if I add a column named "ABC", then that query also fails unless I specify ('ABC').
Why?
Any answer/solution should take into account that the IN list will be of arbitrary length and will include strings with embedded quotes (both single and double).
Also, while this example is for SQLite, my query also has to work for Postgres.