Skip to content
Astera Technology

Why does an inactive urgent item pass the active-work filter?

Group the alternatives before applying the shared condition.

Download complete case notes and answer keys ↓

Prepare the report input

Original queue requires active AND either urgent or overdue. AND binds more tightly than OR, so the ungrouped filter makes active apply only to overdue. Parentheses express the supplied scope.

Every record and report rule below is original and fictional. Reproduce the setup in a fresh SQLite test database; input previews include every table in this small fixture.

Synthetic input: work
idurgentoverdueactive
A100
B011
C001
Download editable CSV ↓
Complete CREATE and INSERT fixture
CREATE TABLE work(id TEXT PRIMARY KEY,urgent INTEGER CHECK(urgent IN(0,1)),overdue INTEGER CHECK(overdue IN(0,1)),active INTEGER CHECK(active IN(0,1))); INSERT INTO work VALUES('A',1,0,0),('B',0,1,1),('C',0,0,1);

Compare misleading and corrected results

Misleading SELECT: reproduce the defect
SELECT id FROM work WHERE urgent=1 OR overdue=1 AND active=1 ORDER BY id;
Literal misleading result
id
A
B
Download editable CSV ↓
Corrected SELECT
SELECT id FROM work WHERE (urgent=1 OR overdue=1) AND active=1 ORDER BY id;
Literal corrected result
id
B
Download editable CSV ↓

A is urgent but inactive and must leave the queue. B is active and overdue and remains. The correction changes the predicate grouping, not any stored flags.

Check a fresh boundary case

Add active urgent D. It qualifies through the urgent branch while satisfying the shared active requirement.

Recreate the original setup in another fresh database, then apply the change and corrected query below. For an empty result, the table displays a labelled empty-result marker rather than a data record.

Boundary change and corrected query
INSERT INTO work VALUES('D',1,0,1);
SELECT id FROM work WHERE (urgent=1 OR overdue=1) AND active=1 ORDER BY id;
Literal boundary result
id
B
D
Download editable CSV ↓

Why does A fail but D pass?

Show the worked answer

Both are urgent; only D is active. Shared active scope excludes A.

Related resources