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 <> 'OK' THEN > RAISE; > END IF; > END; > RETURN 'success'; > END > $$ > And replace it with code like this: > $$ > BEGIN > <<testsomething>> > BEGIN > INSERT INTO foo VALUES (1); > -- run some tests/checks/whatever > EXIT USING ROLLBACK testsomething; > EXCEPTION WHEN others THEN > RAISE; > END; > RETURN 'success'; > END > $$ Somehow I'm failing to see that as much of an improvement; in fact, it's probably less clear than before. I don't much care for the idea that EXIT should take on some transaction-control properties instead of being a simple transfer of control. In particular, what happens if someone attaches USING ROLLBACK to an EXIT that does not lead from inside to outside a BEGIN/EXCEPTION block? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers