Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-09-04 Thread Joel Jacobson
> On 3 sep 2014, at 16:20, Robert Haas wrote: > >> On Mon, Sep 1, 2014 at 5:08 AM, Joel Jacobson wrote: >>> On Sat, Jul 26, 2014 at 8:39 PM, Tom Lane wrote: >>> 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

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-09-03 Thread Robert Haas
On Mon, Sep 1, 2014 at 5:08 AM, Joel Jacobson wrote: > On Sat, Jul 26, 2014 at 8:39 PM, Tom Lane wrote: >> 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

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-09-01 Thread Joel Jacobson
On Sat, Jul 26, 2014 at 8:39 PM, Tom Lane wrote: > 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. The main difference

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-28 Thread Simon Riggs
On 28 July 2014 10:34, Marko Tiikkaja wrote: > On 7/28/14 11:27 AM, Simon Riggs wrote: >> >> On 26 July 2014 18:14, Marko Tiikkaja wrote: >> >>> Today I'd like to present a way to get rid of code like this: >> >> >> You haven't explained this very well... there is nothing that explains >> WHY you

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-28 Thread Marko Tiikkaja
On 7/28/14 11:27 AM, Simon Riggs wrote: On 26 July 2014 18:14, Marko Tiikkaja wrote: Today I'd like to present a way to get rid of code like this: You haven't explained this very well... there is nothing that explains WHY you want this. In the absence of a good explanation and a viable bene

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-28 Thread Simon Riggs
On 26 July 2014 18:14, Marko Tiikkaja wrote: > Today I'd like to present a way to get rid of code like this: You haven't explained this very well... there is nothing that explains WHY you want this. In the absence of a good explanation and a viable benefit, I would vote -1 for this feature sugg

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-26 Thread Pavel Stehule
Hello 2014-07-26 19:14 GMT+02:00 Marko Tiikkaja : > Hello, > > Today I'd like to present a way to get rid of code like this: > > $$ > BEGIN > > BEGIN > INSERT INTO foo VALUES (1); > -- run some tests/checks/whatever > RAISE EXCEPTION 'OK'; > EXCEPTION WHEN raise_exception THE

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-26 Thread Marko Tiikkaja
On 7/26/14, 8:39 PM, Tom Lane wrote: Marko Tiikkaja 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

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-26 Thread Tom Lane
Marko Tiikkaja writes: > On 7/26/14, 8:22 PM, Tom Lane wrote: >> In particular, what happens if someone attaches USING ROLLBACK >> to an EXIT that does not lead from inside to outside a BEGIN/EXCEPTION >> block? > I'm not sure which case you're envisioning. A label is required, and > the label

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-26 Thread Marko Tiikkaja
On 7/26/14, 8:22 PM, Tom Lane wrote: In particular, what happens if someone attaches USING ROLLBACK to an EXIT that does not lead from inside to outside a BEGIN/EXCEPTION block? I'm not sure which case you're envisioning. A label is required, and the label must be that of a BEGIN block with a

Re: [HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-26 Thread Tom Lane
Marko Tiikkaja writes: > Hello, > Today I'd like to present a way to get rid of code like this: >$$ >BEGIN >BEGIN > INSERT INTO foo VALUES (1); > -- run some tests/checks/whatever > RAISE EXCEPTION 'OK'; >EXCEPTION WHEN raise_exception THEN > IF SQLERRM <> 'OK

[HACKERS] PL/PgSQL: EXIT USING ROLLBACK

2014-07-26 Thread Marko Tiikkaja
Hello, Today I'd like to present a way to get rid of code like this: $$ BEGIN BEGIN INSERT INTO foo VALUES (1); -- run some tests/checks/whatever RAISE EXCEPTION 'OK'; EXCEPTION WHEN raise_exception THEN IF SQLERRM <> 'OK' THEN RAISE; END IF; END; RETURN '