Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <stark(at)mit(dot)edu>, Erik Rijkers <er(at)xs4all(dot)nl>, Robert Haas <robertmhaas(at)gmail(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, PostgreSQL <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers-owner(at)postgresql(dot)org
Subject: Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
Date: 2017-03-03 06:19:11
Message-ID: alpine.DEB.2.20.1703030709210.12372@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Corey,

> v20: attempt at implementing the switch-on-all-states style.

For the elif I think it is both simpler and better like that. Whether
committer will agree is an unkown, as always.

For endif, I really exagerated, "switch { defaut: " is too much, please
accept my apology. Maybe just do the pop & error reporting?

For if, the evaluation & error could be moved before the switch, which may
contain only the new state setting decision, and the push after the
switch? Also, I would suggest to use default only to detect an unexpected
state error, and list all other states explicitely.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-03-03 06:24:53 Re: Patch to implement pg_current_logfile() function
Previous Message Robert Haas 2017-03-03 06:18:43 Re: Patch to implement pg_current_logfile() function