Unix Technical Forum

Simple error "exception when" in trigger

This is a discussion on Simple error "exception when" in trigger within the pgsql Sql forums, part of the PostgreSQL category; --> It looks like exceptions are not raise in triggers as expected. example: 1. trigger function BEGIN EXCEPTION WHEN OTHERS ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-29-2008, 08:32 PM
bartel@ncc.co.za
 
Posts: n/a
Default Simple error "exception when" in trigger

It looks like exceptions are not raise in triggers as expected.

example:

1. trigger function

BEGIN
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE '% already exist.',NEW."UNAME";
END;

I've tried a before and after trigger
I've also tried the sql error codes for a violation of a UNIQUE
constraint but still no luck.

The the examples of the manual every example have a INSERT or UPDATE
statement before the
EXCEPTION WHEN and it's not done within a trigger.

I would love to make it "GLOBAL" so it does not matter if the INSERT
or UPDATE get called by a FUNCTION or not, thats why I want the
constrain violation to be trapped within a TRIGGER.

Is this possible or not ?

Thanks a mil.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:46 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com