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

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: [PATCH] Add get_bytes() and set_bytes() functions
Дата
Msg-id CAEZATCWBSqV-4U8ppTYabUT=t1tc9wZPSEwAbm57PhJh1e2eaw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Add get_bytes() and set_bytes() functions  ("Joel Jacobson" <joel@compiler.org>)
Ответы Re: [PATCH] Add get_bytes() and set_bytes() functions
Список pgsql-hackers
On Thu, 15 Aug 2024 at 05:20, Joel Jacobson <joel@compiler.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



В списке pgsql-hackers по дате отправления: