Re: proposal: condition blocks in psql - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal: condition blocks in psql
Date
Msg-id CAFj8pRD7QxVV66cxpVqhLCVR4mcaHMj2fA_J3nkHxG2tKYpsVg@mail.gmail.com
Whole thread Raw
In response to Re: proposal: condition blocks in psql  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: proposal: condition blocks in psql  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: proposal: condition blocks in psql  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers


2015-06-28 7:49 GMT+02:00 Fabien COELHO <coelho@cri.ensmp.fr>:

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

Pavel 

 

--
Fabien.

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: proposal: condition blocks in psql
Next
From: Fabien COELHO
Date:
Subject: Re: Refactoring pgbench.c