Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless) - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)
Date
Msg-id CADkLM=fbsnkWUWOKz8JiU5hN-8mKDm7MgsuAq6pHk-22eqJ3xA@mail.gmail.com
Whole thread Raw
In response to Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)  (Erik Rijkers <er@xs4all.nl>)
Responses Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)
List pgsql-hackers
On Thu, Feb 9, 2017 at 4:43 PM, Erik Rijkers <er@xs4all.nl> wrote:
On 2017-02-09 22:15, Tom Lane wrote:
Corey Huinker <corey.huinker@gmail.com> writes:

The feature now  ( at patch v10) lets you break off with Ctrl-C anywhere.  I like it now much more.

The main thing I still dislike somewhat about the patch is the verbose output. To be honest I would prefer to just remove /all/ the interactive output.

I would vote to just make it remain silent if there is no error.   (and if there is an error, issue a message and exit)

thanks,

Erik Rijkers

Changes in this patch:
- invalid boolean expression on \if or \elif is treated as if the script had a bad \command, so it either stops the script (ON_ERROR_STOP, script mode), or just gives the ParseVariableBool error and continues.

- All interactive "barks" removed except for 
    "command ignored. use \endif or Ctrl-C to exit current branch" when the user types a non-branching \command in a false branch
    "query ignored. use \endif or Ctrl-C to exit current branch" when the user types a non-branching \command in a false branch
    "\if: escaped" when a user does press Ctrl-C and they escape a branch.

- remaining error messages are tersed:
     \elif: cannot occur after \else
     \elif: no matching \if
     \else: cannot occur after \else
     \else: no matching \if
     \endif: no matching \if
     found EOF before closing \endif(s)
Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [HACKERS] possibility to specify template database for pg_regress
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] contrib modules and relkind check