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

2014-09-05 Thread Joel Jacobson
On 3 sep 2014, at 16:20, Robert Haas robertmh...@gmail.com wrote: On Mon, Sep 1, 2014 at 5:08 AM, Joel Jacobson j...@trustly.com wrote: On Sat, Jul 26, 2014 at 8:39 PM, Tom Lane t...@sss.pgh.pa.us wrote: Basically my point is that this just seems like inventing another way to do what one can

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

2014-09-03 Thread Robert Haas
On Mon, Sep 1, 2014 at 5:08 AM, Joel Jacobson j...@trustly.com wrote: On Sat, Jul 26, 2014 at 8:39 PM, Tom Lane t...@sss.pgh.pa.us 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

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

2014-09-01 Thread Joel Jacobson
On Sat, Jul 26, 2014 at 8:39 PM, Tom Lane t...@sss.pgh.pa.us 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

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

2014-07-28 Thread Simon Riggs
On 26 July 2014 18:14, Marko Tiikkaja ma...@joh.to 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

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 ma...@joh.to 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

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

2014-07-28 Thread Simon Riggs
On 28 July 2014 10:34, Marko Tiikkaja ma...@joh.to wrote: On 7/28/14 11:27 AM, Simon Riggs wrote: On 26 July 2014 18:14, Marko Tiikkaja ma...@joh.to 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

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

2014-07-26 Thread Tom Lane
Marko Tiikkaja ma...@joh.to 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

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

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

2014-07-26 Thread Tom Lane
Marko Tiikkaja ma...@joh.to 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

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 ma...@joh.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

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

2014-07-26 Thread Pavel Stehule
Hello 2014-07-26 19:14 GMT+02:00 Marko Tiikkaja ma...@joh.to: 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