Re: Quick coding question with acl fixes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Quick coding question with acl fixes
Дата
Msg-id 9931.1090727292@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Quick coding question with acl fixes  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Ответы Re: Quick coding question with acl fixes
Re: Quick coding question with acl fixes
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Quick coding question with acl fixes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Quick coding question with acl fixes