Re: Built-in binning functions

From: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Built-in binning functions
Date: 2014-08-31 23:59:09
Message-ID: CAKFQuwaZMSjw6GH-TOF2=s+F5xwjaihzYLUF7nbAxyWaEK05nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 31, 2014 at 7:48 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > Since "bucket" is the 'verb' here (in this specific case meaning "lookup
> the
> > supplied value in the supplied bucket definition") and "width" is a
> modifier
> > (the bucket specification describes an equal-width structure) I suggest
> > "literal_bucket(val, array[])" such that the bucket is still the verb but
> > now the modifier describes a structure that is literally provided.
>
> It's a very considerable stretch to see "bucket" as a verb here :-).
> Maybe that's why the SQL committee's choice of function name seems
> so unnatural (to me anyway).
>
> I was wondering about bucket_index(), ie "get the index of the bucket
> this value falls into". Or get_bucket(), or get_bucket_index() if you
> like verbosity.
>
> regards, tom lane
>

​I got stuck on the thought that a function name should ideally be/include
a verb...​

​Even if you read it as a noun (and thus the verb is an implied "get") the
naming logic still holds.

I pondered a "get_" version though the argument for avoiding conflicting
user-code decreases its appeal.

The good part about SQL standard naming is that the typical programmer
isn't likely to pick a conflicting name.

"bucket_index" is appealing by itself though user-code probable...as bad as
I think "width_bucket" is for a name the fact is that it currently exists
and, even forced, consistency has merit.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2014-09-01 03:45:56 Re: Tips/advice for implementing integrated RESTful HTTP API
Previous Message Tom Lane 2014-08-31 23:48:43 Re: Built-in binning functions