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

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Erik Rijkers <er(at)xs4all(dot)nl>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Verite <daniel(at)manitou-mail(dot)org>, 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-02-04 00:42:18
Message-ID: ce7ac5bd-9b62-80e2-283d-973b0b72ed56@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2/2/17 4:39 PM, Corey Huinker wrote:
>
> On Wed, Feb 1, 2017 at 4:58 PM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com
> <mailto:Jim(dot)Nasby(at)bluetreble(dot)com>> wrote:
>
> I think the issue here is that the original case for this is a user
> accidentally getting into an \if and then having no clue what's
> going on. That's similar to what happens when you miss a quote or a
> semicolon. We handle those cases with %R, and I think %R needs to
> support if as well.
>
> Perhaps there's value to providing more info (active branch, etc),
> but ISTM trying to do that will just confuse the original (%R) case.
>
>
> Jim,
>
> After spending a few minutes to familiarize myself with %R, I'm in
> agreement with your second statement (adding if-else to %R will just
> confuse %R). However, your first statement seems to indicate the
> opposite. Can you elaborate?

My point was that we need a way for users to know if they're stuck in an
\if block, and right now that's handled with %R (inside transaction,
parens, etc). My other point is that adding all the extra info to %R
would be folly.

Since the current consensus is to be very verbose about \if, this is
obviously a non-issue. Maybe worth adding a 'I' case to %R, but no big
deal if that doesn't happen.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2017-02-04 00:46:45 Re: libpq Alternate Row Processor
Previous Message Andres Freund 2017-02-04 00:39:24 Re: PinBuffer() no longer makes use of strategy