pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Jon Nelson <jnelson+pgsql@jamponi.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..)
Date: Fri, 20 Mar 2015 17:13:02 -0400
Message-ID: <20150320211302.GT6317@momjian.us> (raw)
In-Reply-To: <CAKuK5J3QZpMr+5=2yGqgRCyFSCp8-nAfFJx593A7Zkiqe7k2wQ@mail.gmail.com>
References: <CAKuK5J1WQX_dt8pF4zfmvyH79gC9suT46seo92prJOHAYMq-WQ@mail.gmail.com>
	<31008.1415987958@sss.pgh.pa.us>
	<CAKuK5J3QZpMr+5=2yGqgRCyFSCp8-nAfFJx593A7Zkiqe7k2wQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On Fri, Nov 14, 2014 at 01:12:37PM -0600, Jon Nelson wrote:
> On Fri, Nov 14, 2014 at 11:59 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Jon Nelson <jnelson+pgsql@jamponi.net> 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  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachments:

btree_gin.diff (text/x-diff, 1.6K) download 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)

view thread (7+ messages)  latest in thread

Message-ID: <20150320211302.GT6317@momjian.us>
Permalink:  ../20150320211302.GT6317@momjian.us/
Also on:    postgresql.org/message-id/20150320211302.GT6317@momjian.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, jnelson+pgsql@jamponi.net, tgl@sss.pgh.pa.us
  Subject: Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..)
  In-Reply-To: <20150320211302.GT6317@momjian.us>
  References: <CAKuK5J1WQX_dt8pF4zfmvyH79gC9suT46seo92prJOHAYMq-WQ@mail.gmail.com> <31008.1415987958@sss.pgh.pa.us> <CAKuK5J3QZpMr+5=2yGqgRCyFSCp8-nAfFJx593A7Zkiqe7k2wQ@mail.gmail.com> <20150320211302.GT6317@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox