Vincenzo Romano <vincenzo.romano@xxxxxxxxx> writes: > How can I delay the query planner decisions until the actual query is to be > done inside the function body? Use plpgsql's EXECUTE. AFAIR there is no way in a SQL-language function. regards, tom lane