Re: COMMIT within function?

From: Dawid Kuroczko <qnex42(at)gmail(dot)com>
To: Pgsql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: COMMIT within function?
Date: 2004-11-22 10:30:20
Message-ID: 758d5e7f04112202307dd7a540@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 21 Nov 2004 20:10:03 -0700, Michael Fuhr <mike(at)fuhr(dot)org> wrote:
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
>
> BEGIN
> DELETE FROM values WHERE value_id = r.value_id;
> EXCEPTION
> WHEN foreign_key_violation THEN
> NULL;
> END;

Ahh, exactly what I was looking for. :) The thing I didn't notice
was that, while exception causes rollback to "BEGIN", it does
not mean to the beginning of the function. In other words
I didn't nest BEGIN...END blocks and all I got from using
exceptions was that they did not show any errors. :)

Thank you! I am now enlightened. This works perfect, exactly
as I hoped it would. :)

Regards,
dawid

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Terry Lee Tucker 2004-11-22 10:30:46 Re: How to handle larger databases?
Previous Message Sebastian Böck 2004-11-22 09:57:42 Re: infinite recursion detected in rules for relation "..."