dbTalk Databases Forums  

disable trigger temporary

comp.databases.postgresql comp.databases.postgresql


Discuss disable trigger temporary in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Philipp Kraus
 
Posts: n/a

Default disable trigger temporary - 11-15-2009 , 04:44 PM






Hello,

i had written a stored procedure that works as trigger for upate and
delete statements.
The trigger raises an error if there is a not allowd change on the row,
that's the normal way.
But now I have a special stored procedure with must be update the value
but the trigger needn't be
called. Can I suppress on Postgres 8.3.5 for exactly one statement the
trigger function?
I need something like this "update table set field='not allowd values'
where ... without run-update-trigger"
I wouldn't use the disable / enable trigger work around, because it
should be only in the user-session, that
is currenty in use.

Thats for help

Phil

Reply With Quote
  #2  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: disable trigger temporary - 11-15-2009 , 07:01 PM






On Sun, 15 Nov 2009 23:44:27 +0100, Philipp Kraus wrote:

Quote:
Hello,

i had written a stored procedure that works as trigger for upate and
delete statements.
The trigger raises an error if there is a not allowd change on the row,
that's the normal way.
But now I have a special stored procedure with must be update the value
but the trigger needn't be
called. Can I suppress on Postgres 8.3.5 for exactly one statement the
trigger function?
I need something like this "update table set field='not allowd values'
where ... without run-update-trigger" I wouldn't use the disable /
enable trigger work around, because it should be only in the
user-session, that is currenty in use.

Thats for help

Phil
You can't circumvent the trigger like that. As for doing things like that
in multiuser environment, my advice is to allocate a maintenance time and
do things like that while the database is inaccessible to the users.



--
http://mgogala.freehostia.com

Reply With Quote
  #3  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: disable trigger temporary - 11-16-2009 , 04:28 AM



Philipp Kraus wrote:
Quote:
i had written a stored procedure that works as trigger for
upate and delete statements. The trigger raises an error
if there is a not allowd change on the row, that's the normal way.
But now I have a special stored procedure with must be update
the value but the trigger needn't be called. Can I suppress
on Postgres 8.3.5 for exactly one statement the trigger function?
I need something like this
"update table set field='not allowd values' where ... without run-update-trigger"
I wouldn't use the disable / enable trigger work around,
because it should be only in the user-session, that is currenty in use.
I would create a special NOLOGIN database role for that purpose,
and make that role the owner of the function that has to do
the "illegal" modifications.
The role should only have the permissions necessary to
do the job.
The function is created with with "SECURITY DEFINER".

Then I would modify the trigger function so that it
does nothing if the current user is that special user.

Yours,
Laurenz Albe

Reply With Quote
  #4  
Old   
Philipp Kraus
 
Posts: n/a

Default Re: disable trigger temporary - 11-16-2009 , 04:50 AM



Thanks for the helpfull answers. I solve my problem with a table on
which I write a flag.
In my trigger I use this flag to update the rows

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.