Re: BUG #2310: "ALTER TYPE name OWNER TO new_owner" not working

From: berndlosert(at)netscape(dot)net
To: tgl(at)sss(dot)pgh(dot)pa(dot)us, bernd(at)tti(dot)hn
Cc: pgsql-bugs(at)postgresql(dot)org, chriskl(at)familyhealth(dot)com(dot)au
Subject: Re: BUG #2310: "ALTER TYPE name OWNER TO new_owner" not working
Date: 2006-03-10 15:01:10
Message-ID: 8C8126A99CB70F0-1FB0-33C1@mblkn-m03.sysops.aol.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

-----Original Message-----
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: eKo1 <bernd(at)tti(dot)hn>
Cc: pgsql-bugs(at)postgresql(dot)org; Christopher Kings-Lynne
<chriskl(at)familyhealth(dot)com(dot)au>
Sent: Thu, 09 Mar 2006 20:10:54 -0500
Subject: Re: [BUGS] BUG #2310: "ALTER TYPE name OWNER TO new_owner" not
working

I wrote:
> The relevant owner field for a composite type is pg_type.typowner.
> We don't bother to maintain pg_class.relowner for the subsidiary
> pg_class entry.

Actually, now that I look at it, there is a non-cosmetic issue here:
we seem to be creating a dependency link for the pg_class owner field.
We have to either not do that, or be willing to fix it during ALTER TYPE
OWNER. For instance

regression=# create user foo;
CREATE ROLE
regression=# create user bar;
CREATE ROLE
regression=# \c - foo
You are now connected as new user "foo".
regression=> create type mytype as (f1 int);
CREATE TYPE
regression=> \c - postgres
You are now connected as new user "postgres".
regression=# drop user foo;
ERROR: role "foo" cannot be dropped because some objects depend on it
DETAIL: owner of composite type mytype
owner of type mytype
regression=# alter type mytype owner to bar;
ALTER TYPE
regression=# drop user foo;
ERROR: role "foo" cannot be dropped because some objects depend on it
DETAIL: owner of composite type mytype
regression=#

regards, tom lane

This is exactly what I did that led me to discover this issue. I need
to drop a user but I can't because some objects depend on it. The only
way around it is to delete the type and everything else that depends on
it and recreate it and its dependents as the new owner of the type.
What a pain....

Bernd

___________________________________________________
Try the New Netscape Mail Today!
Virtually Spam-Free | More Storage | Import Your Contact List
http://mail.netscape.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message j6m 2006-03-10 15:39:59 Re: Suse Installations
Previous Message Kamil Giza 2006-03-10 14:43:30 Re: BUG #2307: Buckup and sequences in DEFAULT part