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

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

Hi,

> 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.

Yes, I was also thinking about adding NUMERIC versions of get_bytes()
/ set_bytes(). This would allow converting more than 8 bytes to/from
an integer. I dropped this idea because I thought there would be not
much practical use for it. On the flip side you never know who uses
Postgres and for what purpose.

I will add corresponding casts unless the idea will get a push-back
from the community. IMO the existence of these casts will at least not
make things worse.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-08-15 11:11:07 Re: Thread-safe nl_langinfo() and localeconv()
Previous Message Junwang Zhao 2024-08-15 10:25:13 replace magic num in struct cachedesc with CATCACHE_MAXKEYS