Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: Atomic drop/create trigger in ASE 16

$
0
0

Thanks for that, Avinash, I am making progress.

 

Your idea seems to work great in the case when the table and its trigger are owned by the same login, or when the table and its trigger are owned by two different logins, neither of which is me.

 

But I am having difficulty in the case when I own the table but a different dbo login owns the trigger. Firstly, because I don't own the trigger I can't replace it. But, I also can't use "alter table ... modify owner" because I get the error "Permission denied. DBO cannot modify the ownership of objects concretely owned by DBO." It's a Catch-22. (That error message seems inaccurate. In fact, I as a DBO can modify the ownership of a table owned by a different DBO login.)

 

The man page for "alter ... modify owner" says, "ownership of triggers are updated along with the dependent table when the owners are the same". That part I agree with. But it is true even in some cases when the owners are different (when both are DBO). It continues to say "The ownership of a DBO owned trigger cannot be altered if the trigger was created for a non DBO owned table." That is also true, but the part they leave out is when both the table and the trigger are DBO owned but by two different logins. In that case, modifying the table owner is sometimes allowed and sometimes not (depending on whether I am the table owner).

 

In summary, when I own the table but the trigger is owned by a different DBO login, I am prevented from taking ownership of the trigger. Therefore I can't replace the trigger.

 

As a last resort, could I turn on "allow updates to system tables" and then update the trigger's sysobjects.loginame with my login name? Then theoretically I can just replace the trigger without caring who the table owner is.


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>