That's because we parameterize the query. In the first case, the query is constructed as
SELECT invoice_number FROM invoices WHERE
invoice in ($1)
where $1 is "'INV-0726', 'INV-0728', 'INV-0708'"
(a string with those values chained together)
Even though the preview is the same, it's not exactly the same as the latter query.
You should be able to use ANY
, with an array of string value (i.e. don't join them) like the suggestion we have in this thread:
2 Likes