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

From Fabien COELHO
Subject Re: [HACKERS] \if, \elseif, \else, \endif (was Re: PSQL commands:\quit_if, \quit_unless)
Date
Msg-id alpine.DEB.2.20.1702131231400.31279@lancre
Whole thread Raw
In response to Re: [HACKERS] \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: [HACKERS] \if, \elseif, \else, \endif (was Re: PSQL commands:\quit_if, \quit_unless)  (Corey Huinker <corey.huinker@gmail.com>)
List pgsql-hackers

>> Maybe this can be a discussed in a follow-up patch and Corey should
>> proceed to finalize the if patch?
>
> In the event that we can leave prompting to a later patch, here are the v12
> highlights:

My 0.02€ about v12: Patch applies, make check ok, psql make check ok.

> - created conditional.h and conditional.c which contain the functions with
> stack-ish push/pop/peek/poke names

Why not.

> - now all non-test, non-doc changes are in src/bin/psql

Hmmm, see below.

> - moved conditional stack out of scan_state, stack state maintained by
> mainloop.c/startup.c, passed to HandleSlashCommands

ISTM that it is kind of a regression, because logically this is about the 
scan state so it should be in the corresponding structure, and having two 
structures to pass the scan state is not an improvement...

> - documentation encourages the user to employ ON_ERROR_STOP when using
> conditionals

Indeed. The paragraph explanations are clear enough to me.

I would suggest to also apply the advice to the example shown, including a 
comment about why the variable is set on.

Also, the last element of the tap tests should be distinct: I suggest to 
use 'if syntax error' and 'elif syntax error' in place of 'syntax error' 
for the two first tests.

-- 
Fabien.

pgsql-hackers by date:

Previous
From: Stas Kelvich
Date:
Subject: [HACKERS] Walsender crash
Next
From: Amit Khandekar
Date:
Subject: [HACKERS] UPDATE of partition key