Re: PSQL commands: \quit_if, \quit_unless

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, PostgreSQL <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PSQL commands: \quit_if, \quit_unless
Date: 2016-11-30 07:45:18
Message-ID: alpine.DEB.2.20.1611300828580.13369@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Tom,

> But really, \fi is something that could only be loved by a certain
> academic breed of hackers.

Ah ah:-) I'll take that as a compliment:-)

> I'd go for \endif, probably. That still doesn't relate well with
> \unless, so +1 for \if, \ifnot, \else, and \endif.

Ok, that is a clear opinion.

> I'm not really convinced that we need an \elseif at this point.
> It could be added later if people find it compelling, but I'm
> having a hard time believing that it's essential.

My experience with cpp is that #elif is quite useful in some cases,
typically with alternate implementations depending on dependences, to
avoid this:

#ifdef HAVE_XXX
...
#else
#ifdef HAVE_YYY
...
#else
#ifdef HAVE ZZZ
...
#else
#error "oops!"
#endif // HAVE_ZZZ
#endif // HAVE_YYY
#endif // HAVE_XXX

I think that some realistic use cases examples for psql would be great...

If the else-if is a common pattern then it should be at least in the
design, even if not implemented right away. Also ISTM that having else-if
is not too compatible with multiplying \if* because it leads to pretty
ugly \el*if* variants which are quite hard to parse and understand, so
there is an impact on the design.

--
Fabien.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2016-11-30 07:51:26 Minor correction in alter_table.sgml
Previous Message Michael Paquier 2016-11-30 07:01:43 Re: Random number generation, take two