Re: proposal: minscale, rtrim, btrim functions for numeric
| От | Karl O. Pinc | 
|---|---|
| Тема | Re: proposal: minscale, rtrim, btrim functions for numeric | 
| Дата | |
| Msg-id | 20191208202239.2a9908f3@slate.karlpinc.com обсуждение исходный текст  | 
		
| Ответ на | Re: proposal: minscale, rtrim, btrim functions for numeric (Tom Lane <tgl@sss.pgh.pa.us>) | 
| Список | pgsql-hackers | 
On Sun, 08 Dec 2019 13:57:00 -0500
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Karl O. Pinc" <kop@meme.com> writes:
> > FWIW, I bumped around the Internet and looked at Oracle docs to see
> > if there's any reason why minscale() might not be a good function
> > name. I couldn't find any problems.  
> 
> > I also couldn't think of a better name than trim_scale() and don't
> > have any problems with the name.  
> 
> I'd just comment that it seems weird that the same patch is
> introducing two functions with inconsistently chosen names.  Why does
> one have an underscore separating the words and the other not?  I
> haven't got a large investment in either naming convention
> specifically, but it'd be nice if we could at least pretend to be
> considering consistency.
Consistency would be lovely.  I don't feel qualified
to make the decision but here's what I came up with:
I re-read the back-threads and don't see any discussion
of the naming of minscale().
My thoughts run toward asking
the "what is a word?" question, along with "what is the
policy for separating a word?".  Is "min" different
from the prefix "sub"?
"Trim" seems to clearly count as a word and trim_scale()
seems mostly consistent with existing function names.
(E.g. width_bucket(), convert_to().  But there's no
true consistency.  Plenty of functions don't separate
words with "_".  E.g. setseed().)
As far as "min" goes, glancing through function names [1]
does not help much.  The index indicates that when PG puts "min"
in a configuration parameter it separates it with "_".
(Looking at "min" in the index.)
Looking at the function names containing "min" [2] yields:
 aclitemin
 brin_minmax_add_value
 brin_minmax_consistent
 brin_minmax_opcinfo
 brin_minmax_union
 min
 numeric_uminus
 pg_terminate_backend
 range_minus
 txid_snapshot_xmin
Not especially helpful.   
I'm inclined to want
min_scale() instead of "minscale()" based on
how config parameters are named and for consistency
with trim_scale().  Pavel, if you agree then
let's just change minscale() to min_scale() and
let people object if they don't like it.
Regards.
Karl <kop@meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein
[1] 
select pg_proc.proname
  from pg_proc
  group by pg_proc.proname
  order by pg_proc.proname;
[2]
select pg_proc.proname
  from pg_proc
  where pg_proc.proname like '%min%'
  group by pg_proc.proname
  order by pg_proc.proname;
		
	В списке pgsql-hackers по дате отправления: