Re: [PATCH] Add get_bytes() and set_bytes() functions

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: David Fetter <david(at)fetter(dot)org>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Add get_bytes() and set_bytes() functions
Date: 2024-08-15 10:14:55
Message-ID: CAEZATCWBSqV-4U8ppTYabUT=t1tc9wZPSEwAbm57PhJh1e2eaw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 15 Aug 2024 at 05:20, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>
> On Wed, Aug 14, 2024, at 19:25, Joel Jacobson wrote:
> > What do we want to happen if passing a numeric with decimal digits,
> > to decimal_to_bytes()? It must be an error, right?
> >
> > Example: SELECT decimal_to_bytes(1.23);
>
> Hmm, an error feels quite ugly on second thought.
> Would be nicer if all numerics could be represented,
>
> But then what about Inf,-Inf,NaN?
>

Perhaps we should also add casts between bytea and the integer/numeric
types. That might be easier to use than functions in some
circumstances.

When casting a numeric to an integer, the result is rounded to the
nearest integer, and NaN/Inf generate errors, so we should probably do
the same here.

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Junwang Zhao 2024-08-15 10:25:13 replace magic num in struct cachedesc with CATCACHE_MAXKEYS
Previous Message Junwang Zhao 2024-08-15 10:03:45 Re: [Patch] remove duplicated smgrclose