Re: Built-in binning functions - Mailing list pgsql-hackers

From David Johnston
Subject Re: Built-in binning functions
Date
Msg-id CAKFQuwaZMSjw6GH-TOF2=s+F5xwjaihzYLUF7nbAxyWaEK05nw@mail.gmail.com
Whole thread Raw
In response to Re: Built-in binning functions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span
style="font-family:arial">OnSun, Aug 31, 2014 at 7:48 PM, Tom Lane </span><span dir="ltr"
style="font-family:arial"><<ahref="mailto:tgl@sss.pgh.pa.us" target="_blank">tgl@sss.pgh.pa.us</a>></span><span
style="font-family:arial">wrote:</span><br /></div><div class="gmail_extra"><div class="gmail_quote"><blockquote
class="gmail_quote"style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">DavidG
Johnston<<a href="mailto:david.g.johnston@gmail.com">david.g.johnston@gmail.com</a>> writes:<br /> > Since
"bucket"is the 'verb' here (in this specific case meaning "lookup the<br /> > supplied value in the supplied bucket
definition")and "width" is a modifier<br /> > (the bucket specification describes an equal-width structure) I
suggest<br/> > "literal_bucket(val, array[])" such that the bucket is still the verb but<br /> > now the modifier
describesa structure that is literally provided.<br /><br /> It's a very considerable stretch to see "bucket" as a verb
here:-).<br /> Maybe that's why the SQL committee's choice of function name seems<br /> so unnatural (to me anyway).<br
/><br/> I was wondering about bucket_index(), ie "get the index of the bucket<br /> this value falls into".  Or
get_bucket(),or get_bucket_index() if you<br /> like verbosity.<br /><br />                         regards, tom
lane<br/></blockquote></div><br /></div><div class="gmail_extra"><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">​Igot stuck on the thought that a function name should ideally
be/includea verb...​</div><br /></div><div class="gmail_extra"><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">​Evenif you read it as a noun (and thus the verb is an implied "get")
thenaming logic still holds.  </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br
/></div><divclass="gmail_default" style="font-family:arial,helvetica,sans-serif">I pondered a "get_" version though the
argumentfor avoiding conflicting user-code decreases its appeal.</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Thegood part about SQL standard naming is that the typical programmer
isn'tlikely to pick a conflicting name.</div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br/></div><div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">"bucket_index"is appealing by itself though user-code probable...as bad
asI think "width_bucket" is for a name the fact is that it currently exists and, even forced, consistency has
merit.</div><divclass="gmail_default" style="font-family:arial,helvetica,sans-serif"><br /></div><div
class="gmail_default"style="font-family:arial,helvetica,sans-serif">David J.</div></div></div> 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Built-in binning functions
Next
From: Craig Ringer
Date:
Subject: Re: Tips/advice for implementing integrated RESTful HTTP API