Re: proposal: condition blocks in psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: condition blocks in psql
Date: 2015-06-28 06:01:50
Message-ID: CAFj8pRD7QxVV66cxpVqhLCVR4mcaHMj2fA_J3nkHxG2tKYpsVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-06-28 7:49 GMT+02:00 Fabien COELHO <coelho(at)cri(dot)ensmp(dot)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.
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2015-06-28 06:10:26 Re: Refactoring pgbench.c
Previous Message Fabien COELHO 2015-06-28 05:49:15 Re: proposal: condition blocks in psql