Re: Allow round() function to accept float and double precision

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Sayyid Ali Sajjad Rizavi <sasrizavi(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Allow round() function to accept float and double precision
Date: 2022-12-01 02:58:23
Message-ID: CAApHDvofL+ajBkL8NM352ba9e88v5c36HwKzRzU8Zu8My1AeVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 1 Dec 2022 at 15:41, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> I don't get the point of adding a function here (or at least one called round) - the type itself is inexact so, as you say, it is actually more of a type conversion with an ability to specify precision, which is exactly what you get today when you write 1.48373::numeric(20,3) - though it is a bit annoying having to specify an arbitrary precision.

An additional problem with that which you might have missed is that
you'd need to know what to specify in the precision part of the
typemod. You might start getting errors one day if you don't select a
value large enough. That problem does not exist with round(). Having
to specify 131072 each time does not sound like a great solution, it's
not exactly a very memorable number.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2022-12-01 03:14:37 Re: Allow placeholders in ALTER ROLE w/o superuser
Previous Message David G. Johnston 2022-12-01 02:41:08 Re: Allow round() function to accept float and double precision