Incorrect argument passed to buffer_readv_encode_error()
Although there's no compiler warning, and probably no correctness issue, I
think the intended coding was as I propose in the diff attached.
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
Agree with this change:
buffer_readv_encode_error(&result_one, is_temp,
*zeroed_buffer,
*ignored_checksum,
- *buffer_invalid,
+ *buffer_invalid ? 1 : 0,
*zeroed_buffer ? 1 : 0,
*failed_checksum ? 1 : 0,
buf_off, buf_off, buf_off);
The function prototype of buffer_readv_encode_error() is,
static inline void
buffer_readv_encode_error(PgAioResult *result,
bool is_temp,
bool zeroed_any,
bool ignored_any,
uint8 error_count,
uint8 zeroed_count,
uint8 checkfail_count,
uint8 first_error_off,
uint8 first_zeroed_off,
uint8 first_ignored_off)
Apparently the error_count argument should behave same as zeroed_count and checkfail_count.
Regards,
Steven
________________________________________
From: Antonin Houska <ah@cybertec.at>
Sent: Wednesday, October 14, 2026 14:31
To: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: andres@anarazel.de <andres@anarazel.de>
Subject: Incorrect argument passed to buffer_readv_encode_error()
Although there's no compiler warning, and probably no correctness issue, I
think the intended coding was as I propose in the diff attached.
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
On Wed, Oct 14, 2026 at 08:31:22AM +0200, Antonin Houska wrote:
Although there's no compiler warning, and probably no correctness issue, I
think the intended coding was as I propose in the diff attached.
Indeed. That's harmless still inconsistent as this *buffer_invalid
points to error_count in buffer_readv_encode_error, which is assumed
to be a uint8 counter.
I am wondering if this should be backpatched down to v18, actually, at
least to keep the branches consistently in check, or just as a matter
of style.
--
Michael