Re: PSQL commands: \quit_if, \quit_unless

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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>, 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:40:29
Message-ID: CAFj8pRBF-z8jUPXu_2JuCaXAzVeWi0m9O1muMqoky5yzmYyPmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2016-12-16 18:33 GMT+01:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:

> On Fri, Dec 16, 2016 at 10:28 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
>
>> 2016-12-16 18:21 GMT+01:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
>> :
>>
>>> On Fri, Dec 16, 2016 at 9:55 AM, Robert Haas <robertmhaas(at)gmail(dot)com>
>>> wrote:
>>>
>>>>
>>>> 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.
>>>
>>
>> why do you need special operator for negation? there is only one use
>> case. It can be solved by \if_not
>>
>
> ​Not following the thread that closely and the section Robert quoted
> didn't include "\if_not" as a syntax option. I figured the idea was to
> limit the number of backslash commands and leave the power in the
> expression evaluation.
>

without a expression you can store a negation to variable

I can imagine simple functional only expressions evaluated on client side.

\if not(table_exists('table_name'))

full expressions are not easy implemented without bigger changes in psql
parser design - and I don't see any reason why do some too complex there. I
would not to replace bash, perl, python or lua.

>
> David J.
> ​
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-12-16 19:30:11 Re: proposal: session server side variables
Previous Message Tom Lane 2016-12-16 17:40:22 Re: PSQL commands: \quit_if, \quit_unless