I have a plpgsql function complementwhere(parameter1 date)
which returns a complex where clause as a text, let's say it returns clause2 = filter2
just as an example, but it actually returns a bunch of other clauses.
I need to call this function in a select's where clause to complement that clause, this is what I have so far:
SELECT value1 FROM table1 WHERE clause1 = filter1 AND complementwhere(parameter1);
But this returns the error
argument of WHERE must be type boolean, not type text
What is the right way to do this?