On Fri, Apr 23, 2021 at 2:36 PM Mark Dilger <mark.dil...@enterprisedb.com> wrote: > > What's different? > > for one thing, if a sequence of chunks happens to fit perfectly, the final > chunk will have size TOAST_MAX_CHUNK_SIZE, but you're expecting no larger > than one less than that, given how modulo arithmetic works.
Good point. Perhaps something like this, closer to the way you had it? expected_size = chunk_seq < last_chunk_seq ? TOAST_MAX_CHUNK_SIZE : extsize - (last_chunk_seq * TOAST_MAX_CHUNK_SIZE); -- Robert Haas EDB: http://www.enterprisedb.com