Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> If I have the nspForm variable (which is a Form_pg_namespace) struct
> pointer, then how do I check if the nspacl field is default (ie.
> "NULL"). This is so I can avoid running DatumGetAclP on it, which seems
> to cause alloc error reports.
Best practice is to use SysCacheGetAttr if you are dealing with a row
from cache or heap_getattr if it's from a table scan. For instance
in aclchk.c there is
aclDatum = SysCacheGetAttr(NAMESPACENAME, tuple, Anum_pg_namespace_nspacl,
&isNull); if (isNull) old_acl = acldefault(ACL_OBJECT_NAMESPACE, ownerId);
else /* get a detoasted copy of the ACL */ old_acl = DatumGetAclPCopy(aclDatum);
> When I run through the acl changing all references from the old owner to
> the new owner, should I combine the resulting acls if possible? Because
> if the new owner already has some acls on that item, they will end up
> with two acls.
If possible ... how painful would it be to do?
regards, tom lane