pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hamann.w@t-online.de
To: pgsql-general@lists.postgresql.org
Subject: Re: conditionally terminate psql script
Date: 17 Dec 2018 14:31:03 -0000
Message-ID: <wolfgang-1181217153103.A0720644@noten19.local> (raw)
In-Reply-To: <2c2417d2-9a81-73e7-23d5-a10436e4a2ff@postgrespro.ru>

Hi,

many thanks, I will give it a try tomorrow

Best regards
Wolfgang

>> >> On 17.12.2018 16:07, hamann.w@t-online.de wrote:
>> > Hi, many thanks -- too bad I am still using 9.3
>> >> In this case you can try ON_ERROR_STOP psql variable.
>> Something like this:
>> >> \set ON_ERROR_STOP on
>> >> do $$
>> declare
>>      total bigint;
>> begin
>>      select count(*) into total from pg_class where 1=1;
>>      if total = 0 then
>>          raise exception 'Nothing found.';
>>      end if;
>> >>      raise notice '% records found.', total;
>> end;
>> $$ language plpgsql;
>> >> \echo Continue execution...
>> >> -----
>> Pavel Luzanov
>> Postgres Professional: http://www.postgrespro.com
>> The Russian Postgres Company
>> >> >> 








view thread (11+ messages)  latest in thread

Message-ID: <wolfgang-1181217153103.A0720644@noten19.local>
Permalink:  ../wolfgang-1181217153103.A0720644@noten19.local/
Also on:    postgresql.org/message-id/wolfgang-1181217153103.A0720644@noten19.local

 · 

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: hamann.w@t-online.de
  Subject: Re: conditionally terminate psql script
  In-Reply-To: <wolfgang-1181217153103.A0720644@noten19.local>
  References: <2c2417d2-9a81-73e7-23d5-a10436e4a2ff@postgrespro.ru> <wolfgang-1181217153103.A0720644@noten19.local>

* 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