Re: How to *really* quit psql?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <stark(at)mit(dot)edu>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: How to *really* quit psql?
Date: 2022-11-19 19:59:01
Message-ID: CAKFQuwY-31E1PD4SJZHwGsxZnp+UqYBYFRpoh8suz4ZwpM0s7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 19, 2022 at 12:49 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Greg Stark <stark(at)mit(dot)edu> writes:
> > On Sat, 19 Nov 2022 at 14:10, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> Under what circumstances would it be appropriate for a script to take
> >> it on itself to decide that? It has no way of knowing what the next -f
> >> option is or what the user intended.
>
> > Presumably when they're written by the same person so the script does
> > effectively know what the "user" intended because it's written by the
> > same user.
>
> Even so, embedding that knowledge in the first script doesn't seem
> like the sort of design we ought to encourage. It'd be better if
> "don't run the next script if the first one fails" were directed
> by a command-line switch or the like. I also wonder exactly how
> this interacts with existing features like ON_ERROR_STOP.
>

vagrant(at)vagrant:~$ /usr/local/pgsql/bin/psql -v ON_ERROR_STOP=1 -f two.psql
-f three.psql postgres
psql:two.psql:1: ERROR: division by zero
vagrant(at)vagrant:~$ /usr/local/pgsql/bin/psql -f two.psql -f three.psql
postgres
psql:two.psql:1: ERROR: division by zero
?column?
----------
2
(1 row)

?column?
----------
3
(1 row)

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-11-19 20:00:33 Re: How to *really* quit psql?
Previous Message Tom Lane 2022-11-19 19:49:37 Re: How to *really* quit psql?