Re: PL/PgSQL: EXIT USING ROLLBACK

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/PgSQL: EXIT USING ROLLBACK
Date: 2014-07-26 18:49:55
Message-ID: 53D3F853.2010207@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7/26/14, 8:39 PM, Tom Lane wrote:
> Marko Tiikkaja <marko(at)joh(dot)to> writes:
>> I'm not sure which case you're envisioning. A label is required, and
>> the label must be that of a BEGIN block with an EXCEPTION block if USING
>> ROLLBACK is specified. If that doesn't answer your question, could try
>> and explain (perhaps in the form of an example) which problem you're seeing?
>
> Well, restrictions of that sort might dodge the implementation problem,
> but they make the construct even less orthogonal. (And the restriction as
> stated isn't good enough anyway, since I could still place such an EXIT in
> the EXCEPTION part of the block.)

That's a good point; the patch would have to be changed to disallow this
case.

> Basically my point is that this just seems like inventing another way to
> do what one can already do with RAISE, and it doesn't have much redeeming
> social value to justify the cognitive load of inventing another construct.

Yes, you can already do this with RAISE but that seems more like an
accident than anything else. I feel a dedicated syntax is less error
prone and makes the intent clearer to people reading the code. But I
realize I might be in the minority with this.

.marko

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-07-26 20:48:09 Re: building pdfs
Previous Message Tom Lane 2014-07-26 18:39:50 Re: PL/PgSQL: EXIT USING ROLLBACK