Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Daniel Verite <daniel@manitou-mail.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Fabien COELHO <coelho@cri.ensmp.fr>, Corey Huinker <corey.huinker@gmail.com>,
"David G. Johnston" <david.g.johnston@gmail.com>, Greg Stark <stark@mit.edu>, Erik Rijkers <er@xs4all.nl>,
Jim Nasby <Jim.Nasby@bluetreble.com>, PostgreSQL <pgsql-hackers@postgresql.org>, pgsql-hackers-owner@postgresql.org
Date: 2017-04-13T20:29:21Z
Lists: pgsql-hackers
On Mon, Apr 3, 2017 at 3:32 PM, Daniel Verite <daniel@manitou-mail.org> wrote: > In interactive mode, the warning in untaken branches is misleading > when \endif is on the same line as the commands that > are skipped. For instance: > > postgres=# \if false \echo NOK \endif > \echo command ignored; use \endif or Ctrl-C to exit current \if block > postgres=# > > From the point of view of the user, the execution flow has exited > the branch already when this warning is displayed. > Of course issuing the recommended \endif at this point doesn't work: > > postgres=# \endif > \endif: no matching \if > > Maybe that part of the message: > "use \endif or Ctrl-C to exit current \if block" > should be displayed only when coming back at the prompt, > and if the flow is still in an untaken branch at this point? Is this an open item, or do we not care about fixing it? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
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