In the original select you missed a small part. The operation || needs a value
on every side and you missed the value on the left side. You had it as: WHERE
(customerlastname ILIKE || '%') instead of WHERE (customerlastname
ILIKE 'lastname' || '%'). And that is the reason for the error you got.
M lanemanger.customers WHERE (customerfirstname ILIKE $1 ||
> '%')
>
> doesnt work when used as the select query of the dataset. Using functions
> is just as well but I would like to understand why the query doesnt work
> unless it is called from a function. Thanks to all tha