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 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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

Reply via email to