Re: Change table ownership
Posted in 1995
How safe is mucking around with anything in the system catalogue?
Not very!
*** No, I do not recommend doing this ***
However, this one is OK if the engine lets you do it -- I don't think there
is any other place which identifies the owner of the table.
On the other hand, you probably have to worry about privileges on the
table, and triggers, indexes, constraints, etc, but you should have thought
about those issues before trying to change the owner of the table. There
was presumably a good reason for wanting to change the owner of the table;
presumably you will also want the new owner to own the constraints and
indexes and so on too. You can probably do the necessary updates by
chasing through SysTabAuth, SysColAuth SysTriggers, SysConstraints,
SysIndexes, etc. But it starts getting risky, given the number of tables
you are now adjusting.
The most complicated operations are those on SysTabAuth and SysColAuth
because of the way permissions are chained -- UserA grants a privilege to
UserB WITH GRANT OPTION, and UserB grants it to UserC, then UserA grants
the same privilege to UserC, then UserB revokes the permission from UserC,
but because UserA also granted the permission, UserC can still do it. And,
of course, if UserB as grantor is wrong and is changed to UserA, then you
end up with a duplicate row if UserB has not yet revoked the privilege from
UserC.
All this is why I said you shouldn't quote me on it; it is potentially
dangerous if you do more than just alter the table owner. If you try it,
on your own head be it -- you are a responsible adult and can choose
whether or not to try this dangerous game.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
>From: cherylk@spamis.jcdc.doleta.gov
>Date: Fri, 27 Oct 1995 14:35:59 -0500 (CDT)
>
>How safe is this and is any system catalog data integrity lost?
>
>On Fri, 27 Oct 1995, Jonathan Leffler wrote:
>> UPDATE SysTables SET Owner = "newowner" WHERE TabName = "tablename";>>
>> Run as a suitably privileged user -- informix or database creator (or
>> maybe any DBA). Don't say I said so...
>>
>> >From: jmv@oh.att.com (J.M. VandeVegt)
>> >Date: Thu, 26 Oct 1995 20:12:34 GMT
>> >X-Informix-List-Id: <news.18287>
>> >
>> >Is there a way, short of unloading and recreating, to change
>> >the owner of an Informix SE table?