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 08:18:26
Message-ID: alpine.DEB.2.20.1703030845410.15047@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


About v21:

Patch applies with some offset, make check ok, psql tap tests ok.

I also did some interactive tests which behaved as I was expecting.

I'm ok with this patch. I think that the very simple automaton code
structure achieved is worth the very few code duplications. It is also
significantly shorter than the nested if/switch variants, and it does
exactly what Tom and Robert wished with respect to errors, so I think that
this is a good compromise.

A tiny detail about "default". I would have added a comment when it is
expected to be dead code (else, elif), and I would have put the list of
matching states explicitely otherwise (if, endif) otherwise the reader has
to remember what the other states are. Probably it is me being really too
peckish, if at all possible:-)

I've turned the patch as ready, again.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2017-03-03 08:21:21 Re: [BUG FIX] Removing NamedLWLockTrancheArray
Previous Message Kyotaro HORIGUCHI 2017-03-03 08:13:42 [BUG FIX] Removing NamedLWLockTrancheArray