You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sqlite: re-filtering a virtual-table cursor skips generator cleanup #66193
import{DatabaseSync}from'node:sqlite';constdb=newDatabaseSync(':memory:');letcleaned=0;db.createModule('m',{columns: [{name: 'input',type: 'INTEGER',hidden: true}],*rows(input){try{yield[input];}finally{cleaned++;}},});db.exec('CREATE TABLE t(a); INSERT INTO t VALUES (1), (2)');db.prepare('SELECT a FROM t WHERE EXISTS(SELECT 1 FROM m(t.a))').all();console.log(cleaned);// 1, expected 2
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Both rows() calls (for t.a = 1 and t.a = 2) run their finally, so cleaned is 2.
What do you see instead?
cleaned is 1; the first generator is suspended and discarded by the re-filter and its finally never runs.
Activity
sqlite: run generator return() on cursor refilter
sqlite: run generator return() on cursor refilter
sqlite: run generator return() on cursor refilter
sqlite: run generator return() on cursor refilter