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

Re: Quick coding question with acl fixes

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Quick coding question with acl fixes
Date: 2004-07-26 02:44:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
> Yeah, but the point was that he was doing an ALTER OWNER and needed to
> fix the ACL to match.  I thought he claimed to have written the needed
> subroutine.  I have not yet looked at his patch though.

I think Fabien's owner changing routine will end up being a strict 
subset of my routine.  I think his just happens to only work on the 
newly created public and info_schema in a new db.  It's not complex 
enough to work on arbitrary acls.  Also, his needs to work as a public 
SQL function:

+ /* acl acl_switch_grantor(acl, oldgrantor, newgrantor);
+  * switch grantor id in aclitem array.
+  * used internally for fixing owner rights in new databases.
+  * must be STRICT.
+  */
+ Datum acl_switch_grantor(PG_FUNCTION_ARGS)
+ {
+ 	Acl * acls = PG_GETARG_ACL_P_COPY(0);
+ 	int i,
+ 		old_grantor = PG_GETARG_INT32(1),
+ 		new_grantor = PG_GETARG_INT32(2);
+ 	AclItem * item;
+ 	for (i=0, item=ACL_DAT(acls); i<ACL_NUM(acls); i++, item++)
+ 		if (item->ai_grantor == old_grantor)
+ 			item->ai_grantor = new_grantor;
+ 	PG_RETURN_ACL_P(acls);
+ }


In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2004-07-26 04:23:19
Subject: Re: storage engine , mysql syntax CREATE TABLE t (i INT)
Previous:From: Christopher Kings-LynneDate: 2004-07-26 02:21:20
Subject: Re: Improvements to PostgreSQL

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