pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steven Lembark <lembark@wrkhors.com>
To: pgsql-general@lists.postgresql.org
Cc: lembark@wrkhors.com
Subject: Re: conditionally terminate psql script
Date: Tue, 18 Dec 2018 15:42:14 -0600
Message-ID: <20181218154214.06bd0904.lembark@wrkhors.com> (raw)
In-Reply-To: <CAFj8pRC84OoTjuMp5DX+CXvZHsp+DSsJST364CMESLQV+DKAUg@mail.gmail.com>
References: <wolfgang-1181217131349.A0420644@noten19.local>
	<CAFj8pRC84OoTjuMp5DX+CXvZHsp+DSsJST364CMESLQV+DKAUg@mail.gmail.com>

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




view thread (11+ messages)  latest in thread

Message-ID: <20181218154214.06bd0904.lembark@wrkhors.com>
Permalink:  ../20181218154214.06bd0904.lembark@wrkhors.com/
Also on:    postgresql.org/message-id/20181218154214.06bd0904.lembark@wrkhors.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: lembark@wrkhors.com
  Subject: Re: conditionally terminate psql script
  In-Reply-To: <20181218154214.06bd0904.lembark@wrkhors.com>
  References: <wolfgang-1181217131349.A0420644@noten19.local> <CAFj8pRC84OoTjuMp5DX+CXvZHsp+DSsJST364CMESLQV+DKAUg@mail.gmail.com> <20181218154214.06bd0904.lembark@wrkhors.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox