Thread: Updating the owner of a function

Updating the owner of a function

From
Mike Mascari
Date:
While migrating to 7.4, which performs quite nicely btw, I must have
performed some sequence of the migration incorrectly. Now, when I use
pg_dump on a database for backup, I get:

pg_dump: WARNING: owner of data type "plr_environ_type" appears to be invalid
pg_dump: WARNING: owner of data type "r_typename" appears to be invalid
pg_dump: WARNING: owner of function "plr_call_handler" appears to be invalid
pg_dump: WARNING: owner of function "reload_plr_modules" appears to be invalid
pg_dump: WARNING: owner of function "install_rcmd" appears to be invalid
pg_dump: WARNING: owner of function "plr_singleton_array" appears to be invalid
pg_dump: WARNING: owner of function "plr_array_push" appears to be invalid
pg_dump: WARNING: owner of function "plr_array_accum" appears to be invalid
pg_dump: WARNING: owner of function "r_typenames" appears to be invalid
pg_dump: WARNING: owner of function "load_r_typenames" appears to be invalid
pg_dump: WARNING: owner of function "s_riupdate" appears to be invalid
pg_dump: WARNING: owner of function "plr_environ" appears to be invalid

Becuase the original owner does not exist (uid 100) in pg_user. I was wondering if it would be safe to do:

UPDATE pg_proc SET proowner = <appropriate owner id>
WHERE proowner = 100;

Or should I dump and reload the database with an edited dump file, which is dumping:

SET SESSION_AUTHORIZATION "100";

Thanks!

Mike Mascari





Re: Updating the owner of a function

From
Tom Lane
Date:
Mike Mascari <mascarm@mascari.com> writes:
> pg_dump: WARNING: owner of data type "plr_environ_type" appears to be invalid
> etc

> Becuase the original owner does not exist (uid 100) in pg_user. I was
> wondering if it would be safe to do:

> UPDATE pg_proc SET proowner = <appropriate owner id>
> WHERE proowner = 100;

It would be safer to create a new user with sysid 100, who would thereby
acquire ownership of the orphaned objects.  You could possibly go around
and locate all the owner columns and do the above, but what about
permissions (ACL columns)?

            regards, tom lane