sqlite icon indicating copy to clipboard operation
sqlite copied to clipboard

Persistent queries can be returned to two callers

Open andrew-d opened this issue 2 years ago • 0 comments

This code doesn't check whether we've already returned the *stmt to a caller, so it's possible that calling conn.PrepareContext twice in a row can return the same *stmt to two different callers: https://github.com/tailscale/sqlite/blob/main/sqlite.go#L193-L196

This means that e.g. running a query from each of the two not-actually-different stmts, getting rows1 and rows2, and then calling rows1.Next will also step rows2.

andrew-d avatar Jun 07 '23 23:06 andrew-d