Re: Add numeric_trim(numeric)

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add numeric_trim(numeric)
Date: 2016-01-10 02:22:00
Message-ID: 5691C048.8080000@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2016-01-10 03:03:48 Re: WIP: bloom filter in Hash Joins with batches
Previous Message Peter Geoghegan 2016-01-10 00:08:03 Re: WIP: bloom filter in Hash Joins with batches