Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updatable server-side scrollable cursor reports wrong size when inserting a row through the result set before fetching #819

Closed
mrotteveel opened this issue Sep 20, 2024 · 3 comments

Comments

@mrotteveel
Copy link
Member

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.

@mrotteveel
Copy link
Member Author

To be frontported to Jaybird 6

@mrotteveel
Copy link
Member Author

mrotteveel commented Sep 20, 2024

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.

@mrotteveel
Copy link
Member Author

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.

mrotteveel added a commit that referenced this issue Sep 20, 2024
…when inserting a row through the result set before fetching
mrotteveel added a commit that referenced this issue Sep 20, 2024
…e cursor reports wrong size when inserting a row through the result set before fetching
mrotteveel added a commit that referenced this issue Sep 20, 2024
mrotteveel added a commit that referenced this issue Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant