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 CAEZATCUQhKQ+i-R2ELvNL4YFKq68Qb4QUNpa-zYFZF2OeoQp=w@mail.gmail.com
Whole thread Raw
In response to [PATCH] Add get_bytes() and set_bytes() functions  (Aleksander Alekseev <aleksander@timescale.com>)
List pgsql-hackers
On Fri, 24 Jan 2025 at 13:00, Aleksander Alekseev
<aleksander@timescale.com> wrote:
>
> Thank you. Here is the corrected patch.
>

This looks pretty good to me. I have a just a couple of minor comments:

* The loop in bytea_integer() can be written more simply as a "for"
loop. Given that it's only a few lines of code, it might as well just
be coded directly in each cast function, which avoids the need to go
via a 64-bit integer for every case. In addition, it should use the
BITS_PER_BYTE macro rather than "8". Doing that leads to code that's
consistent with bittoint4() and bittoint8().

* In pg_proc.dat, it's not necessary to write "proleakproof => 'f'",
because that's the default, and no other function does that.

* I think it's worth using slightly more non-trivial doc examples,
including positive and negative cases, to make the behaviour more
obvious.

* I also tweaked the regression tests a bit, and copied the existing
test style which displays both the expected and actual results from
each test.

With those updates, I think this is ready for commit, which I'll do in
a day or two, if there are no further comments.

Regards,
Dean

Attachment

pgsql-hackers by date:

Previous
From: Ryo Kanbayashi
Date:
Subject: Re: [PATCH] Add regression tests of ecpg command notice (error / warning)
Next
From: Alena Rybakina
Date:
Subject: Re: Replace IN VALUES with ANY in WHERE clauses during optimization