Skip site navigation (1) Skip section navigation (2)

Re: REASSIGN OWNED lacks support for FDWs

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: REASSIGN OWNED lacks support for FDWs
Date: 2012-02-22 08:37:36
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
(2012/02/22 9:30), Tom Lane wrote:
> Alvaro Herrera<alvherre(at)commandprompt(dot)com>  writes:
>> Excerpts from Alvaro Herrera's message of mar feb 21 15:54:03 -0300 2012:
>>> Excerpts from Tom Lane's message of lun feb 20 12:37:45 -0300 2012:
>>>> As per
>>>> there is no switch case in shdepReassignOwned for foreign data wrappers.
>>> I'm gonna take a stab at fixing this now (the simple way).
>> Here's the patch I have; last minute opinions.  I intend to push a
>> backpatch to 9.1 and 9.0.  8.4 has the same problem, but since Heikki
>> punted in e356743f3ed45c36dcc4d0dbf6c1e8751b3d70b5, I'm not going to
>> bother either.
> Looks roughly like what I expected, but I haven't tested it.

I did some tests.  The results look good to me.  Please find attached a
logfile.  My only concern on the patch is

+static void
+AlterForeignServerOwner_internal(Relation rel, HeapTuple tup, Oid
+	Form_pg_foreign_server form;

-	srvId = HeapTupleGetOid(tup);
 	form = (Form_pg_foreign_server) GETSTRUCT(tup);

 	if (form->srvowner != newOwnerId)
@@ -366,10 +388,15 @@ AlterForeignServerOwner(const char *name, Oid
 		/* Superusers can always do it */
 		if (!superuser())

I wonder if superusers can always do it.  For example, is it OK for
superusers to change the ownership of a foreign server owned by old_role
to new_role that doesn't have USAGE privilege on its foreign data wrapper.

Best regards,
Etsuro Fujita

Attachment: reassign_fdw.log
Description: text/plain (2.3 KB)

In response to


pgsql-hackers by date

Next:From: Dimitri FontaineDate: 2012-02-22 10:07:16
Subject: Extensions default full version (was: Displaying accumulated autovacuum cost)
Previous:From: Noah MischDate: 2012-02-22 07:06:49
Subject: Re: 16-bit page checksums for 9.2

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group