On Tue, Aug 05, 2025 at 12:43:06AM -0400, Tom Lane wrote:
> I've not looked at the issue actually being fixed, but a drive-by
> comment: these loops
>
> + for (int i = 0; i < stream->forwarded_buffers; ++i)
> + Assert(BufferGetBlockNumber(stream->buffers[stream->next_buffer_index + i]) ==
> + stream->pending_read_blocknum + i);
>
> should be wrapped in "#ifdef USE_ASSERT_CHECKING". Maybe the
> compiler is smart enough to throw away the useless looping logic
> in a production build, or maybe it isn't.
I'd bet it is usually not that smart.. Embedding these in an extra
#ifdef is a sound defense IMO.
--
Michael