Re: proposal: condition blocks in psql

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: proposal: condition blocks in psql
Дата
Msg-id 558FEB15.9010802@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: proposal: condition blocks in psql  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Hi,

On 06/28/2015 02:21 PM, Pavel Stehule wrote:
>
> 2015-06-28 14:12 GMT+02:00 Tomas Vondra
> <tomas.vondra@2ndquadrant.com <mailto:tomas.vondra@2ndquadrant.com>>:
>
> This proposal is not against to DO parametrization. It is same like
> conditional block in C (#ifdef). There is similarity with C
> statements - and both has sense.

I'm not sure how this is related to C macros - AFAIK psql has no concept 
of preprocessing, so effectively all the the conditional statements are 
equal. Also, they work directly with psql variables.

You mentioned several reasons for implementing this feature:
  * maintenance of large plpgsql functions
  * plpgsql functions create a transaction borders
  * impossibility to use psql variables in plpgsql code


I don't really buy the assertion that maintenance will be easier with 
large amounts of psql-specific scripting language, compared to plpgsql 
or regular scripting languages (bash, python, ...). Or more readable.

I also don't see why the transaction borders should be an issue, 
especially considering that the code is most often used to maintenance 
tasks.

So the only thing remaining is the impossibility to use psql variables 
in plpgsql code. And that's the current DO limitation, so let's fix that.


--
Tomas Vondra                   http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: proposal: condition blocks in psql
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: Refactoring pgbench.c