Version
main
Platform
Subsystem
sqlite
What steps will reproduce the bug?
import { DatabaseSync } from 'node:sqlite';
const db = new DatabaseSync(':memory:');
let cleaned = 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.
Additional information
No response
Version
main
Platform
Subsystem
sqlite
What steps will reproduce the bug?
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 (fort.a = 1andt.a = 2) run theirfinally, socleanedis2.What do you see instead?
cleanedis1; the first generator is suspended and discarded by the re-filter and itsfinallynever runs.Additional information
No response