Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
Corey Huinker <corey.huinker@gmail.com>
From: Corey Huinker <corey.huinker@gmail.com>
To: Greg Stark <stark@mit.edu>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>, Erik Rijkers <er@xs4all.nl>,
Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, 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-11T23:45:49Z
Lists: pgsql-hackers
On Sat, Feb 11, 2017 at 5:57 PM, Greg Stark <stark@mit.edu> wrote:
> On 10 February 2017 at 21:36, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
> >> command prompt is now
> >> ----------- ---------------------------------------
> >> \echo bob '' = initial state, no branch going on at all
> >> \if yes 't' = inside a true branch
> >> \if no 'tf' = false inside a true
> >> \endif 't' = back to just the true branch
> >> \if yes 'tt'
> >> \if yes 'ttt'
> >> \if yes '...ttt' = only show the last 3, but let it be known that
> >> there's at least one more'
> >> \else '...ttz' = past the point of a true bit of this branch
> >
> >
> > I like the "tfz" idea. I'm not sure whether the up to 6 characters is a
> > good, though.
>
>
> I haven't been following this thread but just skimming through it for
> the first time I thought this was more baroque than I was expecting. I
> was expecting something like a { for each level of nested if you're in
> so you can see how many deep you are. I didn't expect to see anything
> more complex than that.
>
So you'd just want to know nesting depth, with no indicator of true/false?
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