pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in, ..)
7+ messages / 3 participants
[nested] [flat]

* minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in, ..)
@ 2014-11-14 16:40  Jon Nelson <jnelson+pgsql@jamponi.net>
  0 siblings, 1 reply; 7+ messages in thread

From: Jon Nelson @ 2014-11-14 16:40 UTC (permalink / raw)
  To: pgsql-bugs

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?

-- 
Jon


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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in, ..)
@ 2014-11-14 17:59  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jon Nelson <jnelson+pgsql@jamponi.net>
  0 siblings, 1 reply; 7+ messages in thread

From: Tom Lane @ 2014-11-14 17:59 UTC (permalink / raw)
  To: Jon Nelson <jnelson+pgsql@jamponi.net>; +Cc: pgsql-bugs

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.

			regards, tom lane


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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in, ..)
@ 2014-11-14 19:12  Jon Nelson <jnelson+pgsql@jamponi.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 7+ messages in thread

From: Jon Nelson @ 2014-11-14 19:12 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

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.


-- 
Jon


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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..)
@ 2015-03-20 21:13  Bruce Momjian <bruce@momjian.us>
  parent: Jon Nelson <jnelson+pgsql@jamponi.net>
  0 siblings, 2 replies; 7+ messages in thread

From: Bruce Momjian @ 2015-03-20 21:13 UTC (permalink / raw)
  To: Jon Nelson <jnelson+pgsql@jamponi.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-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)
^ permalink raw reply [nested|flat] 7+ messages in thread

* Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..)
@ 2015-03-25 00:53  Bruce Momjian <bruce@momjian.us>
  parent: Bruce Momjian <bruce@momjian.us>
  1 sibling, 0 replies; 7+ messages in thread

From: Bruce Momjian @ 2015-03-25 00:53 UTC (permalink / raw)
  To: Jon Nelson <jnelson+pgsql@jamponi.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs

On Fri, Mar 20, 2015 at 05:13:02PM -0400, Bruce Momjian wrote:
> 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.

Patch applied.

-- 
  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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in, ..)
@ 2015-03-26 23:02  Jon Nelson <jnelson+pgsql@jamponi.net>
  parent: Bruce Momjian <bruce@momjian.us>
  1 sibling, 1 reply; 7+ messages in thread

From: Jon Nelson @ 2015-03-26 23:02 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs

On Fri, Mar 20, 2015 at 4:13 PM, Bruce Momjian <bruce@momjian.us> wrote:
> 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.

For as much as it's worth, I did review the patch and it looks just perfect.

--
Jon


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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..)
@ 2015-03-31 14:27  Bruce Momjian <bruce@momjian.us>
  parent: Jon Nelson <jnelson+pgsql@jamponi.net>
  0 siblings, 0 replies; 7+ messages in thread

From: Bruce Momjian @ 2015-03-31 14:27 UTC (permalink / raw)
  To: Jon Nelson <jnelson+pgsql@jamponi.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-bugs

On Thu, Mar 26, 2015 at 06:02:12PM -0500, Jon Nelson wrote:
> On Fri, Mar 20, 2015 at 4:13 PM, Bruce Momjian <bruce@momjian.us> wrote:
> > 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.
> 
> For as much as it's worth, I did review the patch and it looks just perfect.

Patch applied.  Thanks for the report.

-- 
  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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2015-03-31 14:27 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 16:40 minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in, ..) Jon Nelson <jnelson+pgsql@jamponi.net>
2014-11-14 17:59 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-11-14 19:12   ` Jon Nelson <jnelson+pgsql@jamponi.net>
2015-03-20 21:13     ` Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..) Bruce Momjian <bruce@momjian.us>
2015-03-25 00:53       ` Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..) Bruce Momjian <bruce@momjian.us>
2015-03-26 23:02       ` Jon Nelson <jnelson+pgsql@jamponi.net>
2015-03-31 14:27         ` Re: minor: contrib/btree_gin/btree_gin.c uses DirectFunctionCall3(inet_in,..) Bruce Momjian <bruce@momjian.us>

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