Re: PSQL commands: \quit_if, \quit_unless

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PSQL commands: \quit_if, \quit_unless
Date: 2016-12-16 17:21:35
Message-ID: CAKFQuwZJPtnbdW_rvmBXyjoUdLzoWuxZaMgrbyQqjcm1gxOgXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 16, 2016 at 9:55 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Mon, Dec 5, 2016 at 12:32 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
> wrote:
> >> - possible incremental implemention steps on this path:
> >>
> >> (1) minimal condition and expression, compatible with
> >> a possible future full-blown expression syntax
> >>
> >> \if :variable
> >> \if not :variable -- maybe \if ! :variable
>

We don't presently have a unary boolean operator named "!" so adding this
variant would create an inconsistency

> So I think it would be reasonable for somebody to implement \if,
> \elseif, \endif first, with the argument having to be, precisely, a
> single variable and nothing else (not even a negator). Then a future
> patch could allow an expression there instead of a variable. I don't
> think that would be any harder to review than going all the way to #5
> in one shot, and actually it might be simpler.

​I worry about the case of disallowing negation in #1 and then not getting
to #5 (in the same version) where the expression "not(var)" becomes
possible.​

If the expected committed patch set includes #5 then this becomes a matter
for reviewer convenience so never mind. But if its at all possible for #5
to be punted down the road incorporating the eventual "not var" and
"not(var)" syntax into #1 as a kind of shim would seem desirable.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2016-12-16 17:26:49 Re: invalid number of sync standbys in synchronous_standby_names
Previous Message Robert Haas 2016-12-16 16:55:21 Re: PSQL commands: \quit_if, \quit_unless