Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-patchespgsql-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

pgsql-www by date

Next:From: Tom LaneDate: 2005-11-21 16:57:40
Subject: Re: aclchk.c refactor
Previous:From: Alvaro HerreraDate: 2005-11-21 15:16:52
Subject: aclchk.c refactor

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group