Re: [PATCH] Add get_bytes() and set_bytes() functions - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: [PATCH] Add get_bytes() and set_bytes() functions
Date
Msg-id CAEZATCV_UNv+wVg1FD_TXK3FizGhKYFBqOghq+UfoHrLDmr=aA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Add get_bytes() and set_bytes() functions  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On Mon, 13 Jan 2025 at 19:23, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> 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)"
>

Those are all instances of a value that's outside a specific range
that you might not otherwise know, rather than being out of range of
the type itself. For that, we generally don't say what the range of
the type is. For example, we currently do:

select repeat('1', 50)::bit(50)::int;
ERROR:  integer out of range

Regards,
Dean



pgsql-hackers by date:

Previous
From: Giampaolo Capelli
Date:
Subject: question about relation_open
Next
From: Jeff Davis
Date:
Subject: Re: Reduce TupleHashEntryData struct size by half