The proposed syntax of new psql commands \if_ver_eq 9.2 ... \else \endif
What do you thinking about it?
Couldn't this kind of thing be done directly with PL/pgSQL?
you can use PL/pgSQL - but there are some limits
* maintenance large plpgsql functions
* the plpgsql functions or anonymous functions create a transaction borders - what should not be wanted
* I cannot to use psql variables simply in plpgsql code (plpgsql has not any macro language) - so some patterns are implemented in plpgsql less readable
for example, if you can create a script that create some plpgsql function for specified PostgreSQL version, then using PLpgSQL for this purpose is suboptimal due less readability and maintainability