Re: [PATCH] Add get_bytes() and set_bytes() functions
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Aleksander Alekseev <aleksander@timescale.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Michael Paquier <michael@paquier.xyz>, Peter Eisentraut <peter@eisentraut.org>
Date: 2025-01-13T19:23:33Z
Lists: pgsql-hackers
On 2025-Jan-13, Dean Rasheed wrote:
> On Mon, 13 Jan 2025 at 17:36, Aleksander Alekseev
> <aleksander@timescale.com> wrote:
> >
> > Besides fixing opr_sanity test I corrected error messages:
> >
> > -ERROR: bytea size 3 out of valid range, 0..2
> > +ERROR: bytea out of valid range, ''..'\xFFFF'
>
> "smallint out of range", "integer out of range" and "bigint out of
> range" would be more consistent with existing error messages.
But these don't show the acceptable range. We have these that do:
#: utils/adt/varbit.c:1824 utils/adt/varbit.c:1882
#, c-format
msgid "bit index %d out of valid range (0..%d)"
#: utils/adt/varlena.c:3218 utils/adt/varlena.c:3285
#, c-format
msgid "index %d out of valid range, 0..%d"
#: utils/adt/varlena.c:3249 utils/adt/varlena.c:3321
#, c-format
msgid "index %lld out of valid range, 0..%lld"
#: utils/misc/guc.c:3130
#, c-format
msgid "%d%s%s is outside the valid range for parameter \"%s\" (%d .. %d)"
The quoting in Aleksander's proposal is not great.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Update: super-fast reaction on the Postgres bugs mailing list. The report
was acknowledged [...], and a fix is under discussion.
The wonders of open-source !"
https://twitter.com/gunnarmorling/status/1596080409259003906
Commits
-
Allow casting between bytea and integer types.
- 6da469badaff 18.0 landed