Re: How do I save data and then raise an exception?
От | Rob Richardson |
---|---|
Тема | Re: How do I save data and then raise an exception? |
Дата | |
Msg-id | 04A6DB42D2BA534FAC77B90562A6A03D6DE552@server.rad-con.local обсуждение исходный текст |
Ответ на | Trigger disable for table (Frank Durstewitz <frank.durstewitz@emporis.com>) |
Ответы |
Re: How do I save data and then raise an exception?
|
Список | pgsql-general |
From: Jaime Casanova [mailto:jcasanov@systemguards.com.ec]
Sent: Thu 10/2/2008 10:11 PM
To: Alvaro Herrera
Cc: Rob Richardson; pgsql-general@postgresql.org
Subject: Re: [GENERAL] How do I save data and then raise an exception?
On Thu, Oct 2, 2008 at 8:44 PM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
> Rob Richardson wrote:
>
>> Here's what I need to do:
>>
>> IF query_check_fails THEN
>> UPDATE some_table SET some_value = 0 WHERE some_condition_is_true;
>> RAISE EXCEPTION 'Look, you idiot, do it right next time!';
>> END;
>>
>> I need the update to work, but I need to raise the exception so the C++
>> code recognizes the error. How can I do both?
>
> You need an autonomous transaction, which Postgres does not support
> directly but you can implement using dblink or a plperl function that
> connects back to the database.
>
what about RAISE NOTICE?
--
regards,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157
В списке pgsql-general по дате отправления: