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: 4104702B.3050205@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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);
+ }

Chris

In response to

Browse pgsql-hackers by date

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