Re: [PATCH] Add get_bytes() and set_bytes() functions
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Joel Jacobson <joel@compiler.org>
Cc: David Fetter <david@fetter.org>,
Aleksander Alekseev <aleksander@timescale.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-08-15T10:14:55Z
Lists: 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
Commits
-
Allow casting between bytea and integer types.
- 6da469badaff 18.0 landed