The following bug has been logged online:
Bug reference: 2310
Logged by: eKo1
Email address: bernd@tti.hn
PostgreSQL version: 8.1.3
Operating system: Linux Fedora Core 3
Description: "ALTER TYPE name OWNER TO new_owner" not working
Details:
I have the following function that displays the relation-like objects owned
by a user in a given schema:
-------------------------------------------------------
create or replace function fn_show_owned(text, text)
returns setof text as $$
declare
v_user alias for $1;
v_schema alias for $2;
v_rec record;
begin
for v_rec in select relname from pg_class, pg_namespace, pg_user
where pg_namespace.oid = relnamespace and
nspname = v_schema and
relowner = usesysid and usename = v_user
loop
return next v_rec.relname;
end loop;
return;
end;
$$
language plpgsql;
-------------------------------------------------------
Here is what I did to confirm that "ALTER TYPE name OWNER TO new_owner" is
not working:
testdb=# select * from fn_show_owned('bernd','public');
fn_show_owned
---------------
(0 rows)
testdb=# create type MyType as (a int);
CREATE TYPE
testdb=# select * from fn_show_owned('bernd','public');
fn_show_owned
---------------
mytype
(1 row)
testdb=# alter type MyType owner to wiki;
ALTER TYPE
testdb=# select * from fn_show_owned('bernd','public');
fn_show_owned
---------------
mytype
(1 row)
testdb=# \c - wiki
You are now connected as new user "wiki".
testdb=> select * from fn_show_owned('wiki','public');
fn_show_owned
---------------
(0 rows)
As you can see, changing the owner does nothing. If I do the above for a
table, it works fine, so I'm pretty sure this is a bug.
I also tested this in 8.1.2 on the same FC3 machine and in 8.1.1 on CentOS
3. I get the same results.