From: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | PostgreSQL <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PSQL commands: \quit_if, \quit_unless |
Date: | 2016-11-28 20:03:44 |
Message-ID: | CADkLM=c98L20BEo7qGLJ_7L7p=aRXDUFLf2VgAMnE8454jbeEg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Nov 28, 2016 at 2:03 PM, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
>
> Hello Corey,
>
> This patch adds two very simple psql commands: \quit_if and \quit_unless.
>>
>
> A few comments about the feature design:
>
> I'm unsure about the name, esp with '_'. There are some \lo_* commands,
> but others rely on pasted words (\crosstabview, \errverbose, ...).
>
I'm completely flexible with regard to the names.
> I'm wondering if an simplistic interpreted \if \elsif/\else \fi would make
> more sense:
>
The problem is that \if \elsif \else \fi is anything but simplistic, and
would be a vastly bigger change. Detecting nested if-thens, detecting
un-matched if-thens, etc.
> Quitting seems a little bit definitive, and means that if I have some
> alternatives then I have to have something that relaunch another script
> outside...
>
> When \includes are process, does \quit stop the include or the full
> script. I'm afraid it is the script.
>
It behaves exactly as if the script contained \quit at that location.
> Now probably an \if... would have also some drawbacks, but ISTM that there
> could be less of them.
>
It'd be nice, but I'm trying to keep things simple.
>
> There is no test provided with the patch.
Indeed, but testing such a feature is hard within our current test harness.
I welcome suggestions for how to convert the example script in my first
email to tests.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-11-28 21:07:42 | Re: PSQL commands: \quit_if, \quit_unless |
Previous Message | Gilles Darold | 2016-11-28 20:00:47 | Re: Patch to implement pg_current_logfile() function |