dbTalk Databases Forums  

Return Value on UPDATE trigger

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Return Value on UPDATE trigger in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
derrick@grifflink.com
 
Posts: n/a

Default Return Value on UPDATE trigger - 09-20-2004 , 02:09 PM






On a table update, I want to check for certain conditions in a trigger
function, and if a condition is met, NOT ALLOW the update. Not a big
problem...I can accomplish that.

My question is this: How can I send a message back to the calling
application telling the user that the update was denied or failed, and for
the user to try again? Basically, I need a way to send a return value back
to the application (a 0 or a 1) when a trigger function says so.

Any ideas?

Thanks,
Derrick


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #2  
Old   
derrick@grifflink.com
 
Posts: n/a

Default Re: Return Value on UPDATE trigger - 09-20-2004 , 10:05 PM






RAISE EXCEPTION 'Your specific error message';
works just great.

----- Original Message -----
From: <derrick (AT) grifflink (DOT) com>
To: <pgsql-novice (AT) postgresql (DOT) org>
Sent: Monday, September 20, 2004 1:09 PM
Subject: [NOVICE] Return Value on UPDATE trigger


Quote:
On a table update, I want to check for certain conditions in a trigger
function, and if a condition is met, NOT ALLOW the update. Not a big
problem...I can accomplish that.

My question is this: How can I send a message back to the calling
application telling the user that the update was denied or failed, and for
the user to try again? Basically, I need a way to send a return value
back
to the application (a 0 or a 1) when a trigger function says so.

Any ideas?

Thanks,
Derrick


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.