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: Tom Lane <tgl@sss.pgh.pa.us>, Jim Nasby <Jim.Nasby@bluetreble.com>, Erik Rijkers <er@xs4all.nl>, Daniel Verite <daniel@manitou-mail.org>, PostgreSQL <pgsql-hackers@postgresql.org>, pgsql-hackers-owner@postgresql.org
Date: 2017-02-03T05:57:30Z
Lists: pgsql-hackers
Hello Corey,

> Glad you like the barking. I'm happy to let the prompt issue rest for now,
> we can always add it later.
>
> If we DID want it, however, I don't think it'll be hard to add a special
> prompt (Thinking %T or %Y because they both look like branches, heh),

Ah!:-) T may stand for Tree, but Y looks a little bit more like branches. 
Maybe Y for Yew.

> With a prompt1 of '%T> ' Would then resolve to "ttfi" [...]
> This is just idle musing, I'm perfectly happy to leave it out entirely.

I like it. I would prefer to have it available, but my advice is to follow 
committer' opinions. At the minimum, there must be some trace, either 
"barking" or "prompting".

-- 
Fabien.


Commits

  1. Support \if ... \elif ... \else ... \endif in psql scripting.

  2. Add a "void *" passthrough pointer for psqlscan.l's callback functions.