Re: REASSIGN OWNED doesn't for all objects, ALTER FUNCTION seems to fix it

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: REASSIGN OWNED doesn't for all objects, ALTER FUNCTION seems to fix it
Date: 2011-04-18 15:15:28
Message-ID: 22461.1303139728@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl> writes:
> * upon issuing 'REASSIGN OWNED BY A TO postgres', all tables and _most_
> functions changed ownership, but not all.... a number of functions stay marked
> as owned by A, nothing weird in the logs, the reassign looked like it
> completed successfully

Hmmm .... look into pg_shdepend to see if there are entries linking
those functions to an owner. For instance, after

regression=# create user joe;
CREATE ROLE
regression=# \c - joe
You are now connected to database "regression" as user "joe".
regression=> create function foo() returns int as 'select 1' language sql;
CREATE FUNCTION

I get

regression=> select * from pg_shdepend;
dbid | classid | objid | objsubid | refclassid | refobjid | deptype
--------+---------+--------+----------+------------+----------+---------
...
123822 | 1255 | 148691 | 0 | 1260 | 148690 | o
...

1255 = pg_proc, 1260 = pg_authid, and the other numbers are the OIDs of
the database, function, and role (user) respectively. This data is what
REASSIGN OWNED works off of, and I suppose that some rows must be wrong
or missing in your pg_shdepend.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vick Khera 2011-04-18 18:01:59 Re: SSDs with Postgresql?
Previous Message tv 2011-04-18 15:02:42 Re: Help - corruption issue?