Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

disable trigger temporary

2 views
Skip to first unread message

Philipp Kraus

unread,
Nov 15, 2009, 5:44:27 PM11/15/09
to
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

Mladen Gogala

unread,
Nov 15, 2009, 8:01:34 PM11/15/09
to

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

Laurenz Albe

unread,
Nov 16, 2009, 5:28:11 AM11/16/09
to

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


Philipp Kraus

unread,
Nov 16, 2009, 5:50:41 AM11/16/09
to
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

0 new messages