Re: aclchk.c refactor - Mailing list pgsql-patches

From Alvaro Herrera
Subject Re: aclchk.c refactor
Date
Msg-id 20051121163441.GA19278@surnet.cl
Whole thread Raw
In response to aclchk.c refactor  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: aclchk.c refactor  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
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

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: drop database if exists
Next
From: Tom Lane
Date:
Subject: Re: aclchk.c refactor