Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Erik Rijkers <er(at)xs4all(dot)nl>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Verite <daniel(at)manitou-mail(dot)org>, PostgreSQL <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers-owner(at)postgresql(dot)org
Subject: Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
Date: 2017-02-01 20:03:48
Message-ID: alpine.DEB.2.20.1702012046410.31128@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello,

> We could just issue interactive-only warnings when:
> - A user types a branching condition command which sets the branch inactive
> - A user types a command or query when the current branch is inactive.
>
> The warnings could be specific about state, something like:
>
> psql session is now in an inactive \if branch. No queries will be executed
> and only branching commands (\if, \elif, \else, \endif) will be evaluated.
> [...]

My 0.02€: it looks too verbose, should stay on one short line. Maybe:

(in|)active (\if|\elif|\else), (execut|ignor)ing commands

Although there is some redundancy...

calvin=> \if true
active \if: executing commands
calvin=(t)> \echo ok
ok
calvin=(t)> \else
inactive \else: skipping commands
calvin=(f)> ...

Maybe it could be controlled, say based on VERBOSITY setting (which really
controls verbosity of error reports) or some other.

I'm unsure whether it is a good idea, I like terse interfaces, but this is
just an opinion.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2017-02-01 20:15:55 Re: logical decoding of two-phase transactions
Previous Message Thomas Munro 2017-02-01 19:49:26 Re: WIP: [[Parallel] Shared] Hash