Re: [HACKERS] PSQL commands: \quit_if, \quit_unless

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: [HACKERS] PSQL commands: \quit_if, \quit_unless
Дата
Msg-id alpine.DEB.2.20.1701140734040.15294@lancre
обсуждение исходный текст
Ответ на Re: [HACKERS] PSQL commands: \quit_if, \quit_unless  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> $ cat loop.sql
> \if :x < 1000
>  \echo :x
>  \set x :x + 1
>  \include loop.sql
> \fi
> $ psql --set x=0 -f loop.sql

Nice one! CPP does not have arithmetic, so it is harder to do that because 
one must reimplement arithmetic with #if...

> Somebody is going to think of that workaround for not having loops, and
> then whine about how psql runs out of file descriptors and/or stack.

One can already have "include nested too deeply" errors, I guess, without 
a recursion.

I would say that's this consequence is acceptable, and that this is a 
feature.

I think having some kind of client-side test brings significant value 
because it would help writing application schema upgrades for instance, 
and that the this potential whining source is worth handling.

-- 
Fabien.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] PSQL commands: \quit_if, \quit_unless
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Fixing matching of boolean index columns to sort ordering