Re: conditionally terminate psql script

Поиск
Список
Период
Сортировка
От Steven Lembark
Тема Re: conditionally terminate psql script
Дата
Msg-id 20181218154214.06bd0904.lembark@wrkhors.com
обсуждение исходный текст
Ответ на Re: conditionally terminate psql script  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: conditionally terminate psql script
Список pgsql-general
On Mon, 17 Dec 2018 13:42:14 +0100
Pavel Stehule <pavel.stehule@gmail.com> wrote:

> you need psql from PostgreSQL 10 and higher
> 
> there is a \if statement

Q: What is the "abort cycle command"?

e.g., 


    select  count(1) < 1 as "lacks_rows";
    from    foobar
    where   blah blah
    \gset

    \if :lacks_rows

        \echo foobar lacks rows to process.
        \echo goodnight :-)

        ?????????    <--- what goes here to stop execution?

    \endif


The point is that adding many levels of if-block logic is becomes
difficult to maintain. It would be nice to stop execution without
having to nest everything one level deeper.



-- 
Steven Lembark                                     3920 10th Ave South
Workhorse Computing                               Birmingham, AL 35222
lembark@wrkhors.com                                    +1 888 359 3508


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Problem with text search in Postgresql 10
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: conditionally terminate psql script