From: | giova <giovainstall2(at)yahoo(dot)fr> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | how to force an insert before Raise Exception? |
Date: | 2011-04-19 13:39:23 |
Message-ID: | 1303220363098-4313283.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi.
I made a function that Raise exception with some conditions.
No problem with that, it is the goal.
My problem is that i want to do an INSERT into a log table before to raise
the exception. But RAISE EXCEPTION cancels my Insert.
How to force the insert to not being cancelled please?
Note that i want my exception to be raised , so i can't use:
EXCEPTION WHEN THEN
Thanks for your help.
example :
CREATE OR REPLACE FUNCTION "PrepareTrialLic"(userid integer)
BEGIN;
IF userid = 0 THEN
--I want to force that insert !!!!!!!!!!!!!!!!!!
INSERT INTO log_error(caller, description) VALUES('PrepareTrialLic',
'userid is 0');
RAISE EXCEPTION 'userid can''t be equal to 0';
ENDIF;
END;
--
View this message in context: http://postgresql.1045698.n5.nabble.com/how-to-force-an-insert-before-Raise-Exception-tp4313283p4313283.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Jens Wilke | 2011-04-19 13:48:59 | Re: pg_reorg |
Previous Message | Taras Kopets | 2011-04-19 13:18:52 | Re: create table sintax |