On Mon, 21 Sept 2026 at 14:23, Sehrope Sarkuni <[email protected]> wrote:
>
> Hi hackers,
>
> 0002 adds a four-argument set_byte():
>
>     set_byte(bytes bytea, n integer, newvalue integer, count integer)
>
> setting count consecutive bytes from byte n to newvalue:
>
>     SELECT set_byte('\x0000000000'::bytea, 1, 255, 3);
>     => \x00ffffff00
>
> Today this needs nested set_byte() calls, each copying the whole
> value.  The new form does one copy and one memset().

Doesn't the `overlay(bytea, ...)` function already provide the feature
you're looking for (possibly combined with repeat() for ease of use)?
See 
https://www.postgresql.org/docs/current/functions-binarystring.html#id-1.5.8.11.5.2.2.6.1.1.1
and/or the ISO SQL spec for its specification.


Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)


Reply via email to