From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Amul Sul <sulamul(at)gmail(dot)com> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Proposal for internal Numeric to Uint64 conversion function. |
Date: | 2022-03-11 20:16:35 |
Message-ID: | 984993.1647029795@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Amul Sul <sulamul(at)gmail(dot)com> writes:
> On Wed, Feb 16, 2022 at 4:50 PM Peter Eisentraut
> <peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>> On 16.02.22 06:00, Amul Sul wrote:
>>> Currently, numeric_pg_lsn is the only one that accepts the Numeric
>>> value and converts to uint64 and that is the reason all the type
>>> conversion code is embedded into it.
>> There are other functions such as numeric_int8() that work similarly.
>> If you are going to refactor, then they should all be treated similarly.
>> I'm not sure if it's going to end up being beneficial.
> Yeah, that's true, I am too not sure if we really need to refactor
> all those; If we want, I can give it a try.
There are several places that call numeric_int8, and right now they
have to go through DirectFunctionCall1, which is ugly and inefficient.
I think a refactoring that exposes some more-convenient API for that
could be useful. The patch as-presented isn't very compelling for
lack of callers of the new function; but if it were handling the
int64 and uint64 cases alike, and maybe the float8 case too, that
would seem more convincing. We already expose APIs like int64_to_numeric,
so the lack of similar APIs for the other direction seems odd.
It also feels to me that numeric_pg_lsn(), per se, doesn't belong in
numeric.c. A pretty direct comparison is numeric_cash(), which is
not in numeric.c but cash.c.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2022-03-11 20:25:25 | Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints |
Previous Message | Nathan Bossart | 2022-03-11 20:05:11 | Re: add checkpoint stats of snapshot and mapping files of pg_logical dir |