From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Marko Tiikkaja <marko(at)joh(dot)to> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: PL/PgSQL: EXIT USING ROLLBACK |
Date: | 2014-07-27 04:44:22 |
Message-ID: | CAFj8pRBT3g4HKDMGC=RyN_ovMoU5CrekZCQ7FcDnKX7mL5TgPA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
2014-07-26 19:14 GMT+02:00 Marko Tiikkaja <marko(at)joh(dot)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 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
> $$
>
> I'm not set on the USING ROLLBACK syntax; it was the only thing I could
> come up with that seemed even remotely sane and didn't break backwards
> compatibility.
>
> Thoughts? Patch attached, if someone cares.
>
-1
I don't think, so we need to cobolize PL/pgSQL more.
There is not any strong reason why we should to introduce it. You don't
save a code, you don't increase a performance
Regards
Pavel
>
>
> .marko
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2014-07-27 04:59:15 | Re: PL/PgSQL: RAISE and the number of parameters |
Previous Message | Mark Kirkwood | 2014-07-27 00:39:32 | Re: parametric block size? |