On Mon, Dec 17, 2018 at 2:07 PM wrote:
> many thanks -- too bad I am still using 9.3
>
>
not sure if it has been mentioned in the thread so far. But according to
the docs, 9.3 psql does support the \gset command. So you should be able to
do something like this:
select case when exists (select 1
On Tue, Dec 18, 2018 at 2:44 PM Steven Lembark wrote:
> > there is a \if statement
>
> Q: What is the "abort cycle command"?
[...]
> \if :lacks_rows
>
> \echo foobar lacks rows to process.
> \echo goodnight :-)
>
> ?<--- what goes here to stop execution?
\q
On Mon, 17 Dec 2018 13:42:14 +0100
Pavel Stehule 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";
fromfoobar
where blah blah
\gset
\if :lacks_rows
On 12/17/2018 09:01 AM, Jerry Sievers wrote:
haman...@t-online.de writes:
Hi,
many thanks -- too bad I am still using 9.3
Just because your server backend is 9.3 does not rule out using much
newer clients, such as psql.
While technically true, and is useful, many production servers (especia
haman...@t-online.de writes:
> Hi,
>
> many thanks -- too bad I am still using 9.3
Just because your server backend is 9.3 does not rule out using much
newer clients, such as psql.
HTH
>
> Best regards
> Wolfgang
>
>>> Hi
>>> >> po 17. 12. 2018 v 13:14 odesílatel napsal:
>>> >> >
>>> >
>>> > H
Hi,
many thanks, I will give it a try tomorrow
Best regards
Wolfgang
>> >> On 17.12.2018 16:07, haman...@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
>> >> d
On 17.12.2018 16:07, haman...@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;
Hi,
many thanks -- too bad I am still using 9.3
Best regards
Wolfgang
>> Hi
>> >> po 17. 12. 2018 v 13:14 odesílatel napsal:
>> >> >
>> >
>> > Hi,
>> >
>> > is there a way to stop execution of a psql script if a select returns some
>> > rows (or no rows)
>> > The idea is to add a safety check o
Hi
is there a way to stop execution of a psql script if a select returns some rows
(or no rows)
The idea is to add a safety check on data, specifically to select all new rows
that would conflict
on a bulk insert, show them and stop
Look at \if command in psql (since v10):
select count(*) as
Hi
po 17. 12. 2018 v 13:14 odesílatel napsal:
>
>
> Hi,
>
> is there a way to stop execution of a psql script if a select returns some
> rows (or no rows)
> The idea is to add a safety check on data, specifically to select all new
> rows that would conflict
> on a bulk insert, show them and stop
Hi,
is there a way to stop execution of a psql script if a select returns some rows
(or no rows)
The idea is to add a safety check on data, specifically to select all new rows
that would conflict
on a bulk insert, show them and stop
Best regards
Wolfgang
11 matches
Mail list logo