Re: aclchk.c refactor

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: aclchk.c refactor
Date: 2005-11-21 16:34:41
Message-ID: 20051121163441.GA19278@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches pgsql-www

Alvaro Herrera wrote:
> I intend to apply later today the attached patch in order to reduce some
> code duplication in aclchk.c and clean a bit the API I just introduced
> in the previous patch. This reduces aclchk.c from 2377 lines to 2206.

Of course, it would be much better if the proposed patch actually
worked, which it doesn't because there's a function call that I didn't
generalize: the code is calling pg_class_aclmask(), which of course only
works for relations.

Now I noticed that there are multiple functions pg_class_aclmask,
pg_database_aclmask, pg_language_aclmask, etc. Is there any objection
to making the exported routine expose the object type as an AclKind
parameter instead of having one function for each object type?
So instead of having

extern AclMode pg_class_aclmask(Oid table_oid, Oid roleid,
AclMode mask, AclMaskHow how);
extern AclMode pg_database_aclmask(Oid db_oid, Oid roleid,
AclMode mask, AclMaskHow how);
extern AclMode pg_proc_aclmask(Oid proc_oid, Oid roleid,
AclMode mask, AclMaskHow how);
extern AclMode pg_language_aclmask(Oid lang_oid, Oid roleid,
AclMode mask, AclMaskHow how);
extern AclMode pg_namespace_aclmask(Oid nsp_oid, Oid roleid,
AclMode mask, AclMaskHow how);
extern AclMode pg_tablespace_aclmask(Oid spc_oid, Oid roleid,
AclMode mask, AclMaskHow how);

We would have

extern AclMode pg_aclmask(AclKind objkind, Oid obj_oid, Oid roleid,
AclMode mask, AclMaskHow how);

And this would call the appropiate static function.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-11-21 16:57:40 Re: aclchk.c refactor
Previous Message Andrew Dunstan 2005-11-21 15:49:47 Re: drop database if exists

Browse pgsql-www by date

  From Date Subject
Next Message Tom Lane 2005-11-21 16:57:40 Re: aclchk.c refactor
Previous Message Alvaro Herrera 2005-11-21 15:16:52 aclchk.c refactor