X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C654DDA015 for ; Mon, 21 Nov 2005 15:21:55 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99469-09 for ; Mon, 21 Nov 2005 19:21:54 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx2.surnet.cl (mx2.surnet.cl [216.155.73.181]) by svr1.postgresql.org (Postfix) with ESMTP id 121F0D9676 for ; Mon, 21 Nov 2005 15:21:51 -0400 (AST) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx2.surnet.cl with ESMTP; 21 Nov 2005 13:35:09 -0300 X-IronPort-AV: i="3.97,357,1125892800"; d="scan'208"; a="29512345:sNHT15728176058" Received: from alvh.no-ip.org (216.155.78.23) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 43501597005064BC; Mon, 21 Nov 2005 13:34:14 -0300 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 7F07ACC023C; Mon, 21 Nov 2005 13:34:41 -0300 (CLST) Date: Mon, 21 Nov 2005 13:34:41 -0300 From: Alvaro Herrera To: Tom Lane , Patches Subject: Re: aclchk.c refactor Message-ID: <20051121163441.GA19278@surnet.cl> Mail-Followup-To: Tom Lane , Patches References: <20051118195430.GA26861@surnet.cl> <13652.1132361944@sss.pgh.pa.us> <20051119225514.GA16420@surnet.cl> <20051121133308.GB11527@surnet.cl> <20051121151652.GA12273@surnet.cl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051121151652.GA12273@surnet.cl> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.785 required=5 tests=[AWL=-0.461, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 1.785 X-Spam-Level: * X-Archive-Number: 200511/133 X-Sequence-Number: 17882 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