Dapper.net "where ... in" query doesn't work with PostgreSQL Dapper.net "where ... in" query doesn't work with PostgreSQL postgresql postgresql

Dapper.net "where ... in" query doesn't work with PostgreSQL


PostgreSQL IN operator doesn't support array (or any other collection) as parameter, only a normal list (the one which you're generating with the ToInSql method), for PostgreSQL you need to use ANY operator, like this:

SELECT manufacturer, model, year, AVG(price) as averageprice, AVG(miles) as averagemiles, COUNT(*) as countFROM productsWHERE manufacturer = ANY(@manufacturers)AND model = ANY(@models)AND year = ANY(@years)GROUP BY manufacturer, model, year