I have a rather complicated query on my PostgreSQL database spanning 4 tables via a series of nested subqueries. However, despite the slightly tricky looking appearance and
I don't think a "dynamic" view as you stated is possible.
Why not write a stored procedure that takes 2 arguments instead?