Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YZ4EB-0003y9-Cb for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Mar 2015 21:13:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YZ4EA-0004Ay-RS for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Mar 2015 21:13:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YZ4E9-0004Ar-RA for pgsql-bugs@postgresql.org; Fri, 20 Mar 2015 21:13:09 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YZ4E5-0000IG-LD for pgsql-bugs@postgresql.org; Fri, 20 Mar 2015 21:13:08 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1YZ4E2-0004Dv-IZ; Fri, 20 Mar 2015 17:13:02 -0400 Date: Fri, 20 Mar 2015 17:13:02 -0400 From: Bruce Momjian To: Jon Nelson Cc: Tom Lane , pgsql-bugs@postgresql.org Subject: Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..) Message-ID: <20150320211302.GT6317@momjian.us> References: <31008.1415987958@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="WIIRZ1HQ6FgrlPgb" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --WIIRZ1HQ6FgrlPgb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Nov 14, 2014 at 01:12:37PM -0600, Jon Nelson wrote: > On Fri, Nov 14, 2014 at 11:59 AM, Tom Lane wrote: > > Jon Nelson writes: > >> contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..) > >> instead of DirectFunctionCall1(inet_in, one_argument). > > > >> That doesn't seem right. Does such a thing matter? > > > > It's not really incorrect: in a call going through InputFunctionCall(), > > which is the normal path, the two extra arguments would be provided > > whether the specific datatype input function needed them or not. > > > > However, I think the usual convention for DirectFunctionCall() usage > > is to pass exactly what the target function uses, since you know > > exactly what you're calling. Certainly that's what happens in the > > two direct calls to inet_in in the core code. > > > > So I tend to agree that we should change this call to match the others, > > but it's purely cosmetic. > > So, are there any additional steps that you might recommend that I take? > It's such a trivial thing. I could provide a patch, of course, or a > pull request off of github if people use that. Patch attached for review. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + --WIIRZ1HQ6FgrlPgb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="btree_gin.diff" diff --git a/contrib/btree_gin/btree_gin.c b/contrib/btree_gin/btree_gin.c new file mode 100644 index 80521fb..12bbcd7 *** a/contrib/btree_gin/btree_gin.c --- b/contrib/btree_gin/btree_gin.c *************** GIN_SUPPORT(macaddr, false, leftmostvalu *** 318,327 **** static Datum leftmostvalue_inet(void) { ! return DirectFunctionCall3(inet_in, ! CStringGetDatum("0.0.0.0/0"), ! ObjectIdGetDatum(0), ! Int32GetDatum(-1)); } GIN_SUPPORT(inet, true, leftmostvalue_inet, network_cmp) --- 318,324 ---- static Datum leftmostvalue_inet(void) { ! return DirectFunctionCall1(inet_in, CStringGetDatum("0.0.0.0/0")); } GIN_SUPPORT(inet, true, leftmostvalue_inet, network_cmp) *************** GIN_SUPPORT(bytea, true, leftmostvalue_t *** 346,365 **** static Datum leftmostvalue_bit(void) { ! return DirectFunctionCall3(bit_in, ! CStringGetDatum(""), ! ObjectIdGetDatum(0), ! Int32GetDatum(-1)); } GIN_SUPPORT(bit, true, leftmostvalue_bit, bitcmp) static Datum leftmostvalue_varbit(void) { ! return DirectFunctionCall3(varbit_in, ! CStringGetDatum(""), ! ObjectIdGetDatum(0), ! Int32GetDatum(-1)); } GIN_SUPPORT(varbit, true, leftmostvalue_varbit, bitcmp) --- 343,356 ---- static Datum leftmostvalue_bit(void) { ! return DirectFunctionCall1(bit_in, CStringGetDatum("")); } GIN_SUPPORT(bit, true, leftmostvalue_bit, bitcmp) static Datum leftmostvalue_varbit(void) { ! return DirectFunctionCall1(varbit_in, CStringGetDatum("")); } GIN_SUPPORT(varbit, true, leftmostvalue_varbit, bitcmp) --WIIRZ1HQ6FgrlPgb Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --WIIRZ1HQ6FgrlPgb--