Re: Add numeric_trim(numeric) - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: Add numeric_trim(numeric)
Date
Msg-id 5691C048.8080000@joh.to
Whole thread Raw
In response to Re: Add numeric_trim(numeric)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2016-01-07 1:11 AM, Tom Lane wrote:
> A different approach is that I'm not real sure why we want a function
> that returns a modified numeric value at all.  To the extent I understood
> Marko's original use case, it seems like what you'd invariably do with the
> result is extract its scale().

Well, no, both are useful.  I think as far as the interface goes, having 
both a scale() and a way to "rtrim" a numeric is optimal.  rtrim() can 
also be used before storing and/or displaying values to get rid of 
unnecessary zeroes.

As for what the actual function should be called, I don't much care.  I 
wanted to avoid making trim() work because I thought it would interfere 
with the  trim('foo')  case where the input argument's type is unknown, 
but after some testing it appears that that would not be interfered with.


.m



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: WIP: bloom filter in Hash Joins with batches
Next
From: Peter Geoghegan
Date:
Subject: Re: WIP: bloom filter in Hash Joins with batches