Thread: A PL/PgSQL Question

A PL/PgSQL Question

From
Ludwig Lim
Date:
Hi:

I have the following PL/PgSQL code blocks:

a) IF (condition) THEN     RAISE EXCEPTION ''Cannot Insert'';  END IF;

b) IF (condition) THEN     RAISE NOTICE ''Cannot Insert'';     RETURN NULL;  END IF;

  What is the difference between the first and second
chunk PL/PgSQL INSERT/UPDATE trigger function code
aside from the fact that first scenario will result in
an "ABORT" state?
 Are there any instances where a NOTICE and a RETURN
NULL statement is a much better than a RAISE EXCEPTION
statement?


Thank you very much,

ludwig lim



__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com


Re: A PL/PgSQL Question

From
Josh Berkus
Date:
Ludwig,

>    What is the difference between the first and second
> chunk PL/PgSQL INSERT/UPDATE trigger function code
> aside from the fact that first scenario will result in
> an "ABORT" state?
>
>   Are there any instances where a NOTICE and a RETURN
> NULL statement is a much better than a RAISE EXCEPTION
> statement?

Not that I have encountered, but YMMV.

--
-Josh BerkusAglio Database SolutionsSan Francisco