Closed mrotteveel closed 1 month ago
To be frontported to Jaybird 6
As bonus, the fix does away with some complexity in the fetcher. In the original implementation, I delayed knowing the server-side (and local) cursor size until absolutely necessary, but that involved some gnarly logic in places.
I spoke too soon. There is actually a good reason for the convoluted logic. Avoiding the need to know the cursor size ahead of time conserves server resources by not materializing the entire result set.
While investigating #818, I noticed that the server-side scrollable cursor implementation reported the wrong size if I inserted a row through the result set immediately after execute (thus without fetching any rows), and the inserted row was included twice in the result set: once server-side, and once locally.
This happens because the cursor is not materialized server-side until the first fetch, and so the inserted row was materialized in the server-side cursor, and also stored in the local "inserted rows" list, and thus reported twice. We need to address this by forcing materialization of the cursor earlier, maybe immediately on creating the fetcher.