Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Erik Rijkers <er@xs4all.nl>,
Tom Lane <tgl@sss.pgh.pa.us>, Daniel Verite <daniel@manitou-mail.org>,
Jim Nasby <Jim.Nasby@bluetreble.com>,
PostgreSQL <pgsql-hackers@postgresql.org>,
pgsql-hackers-owner@postgresql.org
Date: 2017-02-14T10:22:57Z
Lists: pgsql-hackers
>> For two states:
>> * for being executed (beware, it is ***important***)
>
> It does lend importance, but that's also the line continuation marker for
> "comment". Would that be a problem?
Argh. Indeed, even if people seldom type C comments in psql interactive
mode...
Remaining ASCII characters I can thing of, hopefully avoiding already used
ones: +%,@$\`|&:;_
So, maybe consider these ones:
"+" for it is "on"
"`" which is a "sub-shell execution"
"&" for "and the next command is ..."
>> / for not (under the hood, and it is opposed to *)
>
> +1, I was going to suggest '/' for a false state, with two possible
> metaphors to justify it
> 1. the slash in a "no" sign ("no smoking", ghostbusters, etc)
> 2. the leading char of a c/java/javascript comment (what is written here
> is just words, not code)
Great.
--
Fabien.
Commits
-
Support \if ... \elif ... \else ... \endif in psql scripting.
- e984ef5861df 10.0 landed
-
Add a "void *" passthrough pointer for psqlscan.l's callback functions.
- 895e36bb3f36 10.0 landed