On Sat, Mar 29, 2025 at 4:44 PM Andres Freund <and...@anarazel.de> wrote: > > How about having an iterator function operating on a pointer to iterator state > that's used both by the main loop and the read stream callback? If the > iterator reaches the next relation, it returns InvalidBlockNumber and the main > loop starts the next stream?
I don't think that removes the need for the first_block special case. And we still need to duplicate the logic for detecting the next database, block, or filenumber in both places. It maybe reduces the potential for error a little bit. But I don't think it improves the clarity. - Melanie