I think ParseVariableBool is only likely to change to reject a NULL value rather than silently interpreting it as FALSE, which is the way it is in HEAD right now. That behavior is a leftover hack, really, and moving the treatment of unset values upstream seems a lot cleaner. See my draft patch at https://www.postgresql.org/message-id/30629.1485881533@sss.pgh.pa.us
regards, tom lane
Updated patch:
- rebased on post-psql hooks master
- took nearly every suggestion for change to documentation
- \if ERROR will throw the entire \if..\endif into IGNORE mode
- state is now pushed on all \ifs
- reinstated leveraging of ParseVariableBool
- history is now kept in interactive mode regardless of \if-truth
- reworked coding example to cause less agita
- removed MainLoop "are endifs balanced" variable in favor of in-place check which respects ON_ERROR_STOP.
- make changes to psql/Makefile to enable TAP tests and created t/ directory
- wrote an intentionally failing TAP test to see if "make check" executes it. it does not. need help.
I'm hoping my failure in that last bit is easy to spot/fix, so I can move forward with testing unbalanced branching, etc.