A robot measurement query can omit a row because its reading is missing. That omission does not mean the reading was known to fail the condition. In SQL, a comparison involving a null value can produce unknown, and WHERE retains only rows whose condition is true.

The distinction becomes visible when a query is negated or combined with another condition. Treating every omitted row as a known negative can lose the difference between a measured value and an unavailable value.

The following six-row table is an original hypothetical data model interpreted using PostgreSQL 18's documented standard comparison behavior. No SQL statements were executed against a database.

Define the records and predicate

Each row has an identifier, a scalar reading, and an enabled flag. NULL represents an unavailable value in the relevant column. It does not encode why that value is unavailable.

The six rows are:

R1: reading 3, enabled TRUE.

R2: reading 8, enabled TRUE.

R3: reading NULL, enabled TRUE.

R4: reading 8, enabled FALSE.

R5: reading NULL, enabled FALSE.

R6: reading 3, enabled NULL.

Define P as the comparison reading > 5. The reading units and limit are intentionally invented; the query is a data-selection example rather than a physical acceptance rule.

PostgreSQL's comparison documentation defines null behavior and explicit null predicates. Its logical-operator documentation gives the three-valued combinations, and its table-expression documentation defines WHERE row selection. The original rows below apply those contracts to a small ledger.

Keep three comparison outcomes

P is TRUE for R2 and R4 because their readings are eight. P is FALSE for R1 and R6 because their readings are three.

For R3 and R5, the input to the comparison is NULL, so P is unknown. A missing reading has not established whether the unknown underlying value exceeds five.

A WHERE P selection retains R2 and R4. Both false and unknown outcomes are omitted from that result, but the omitted rows do not all have the same comparison outcome.

The output table alone therefore cannot distinguish a known reading of three from a missing reading. The original record or an explicit outcome label is needed to preserve that distinction.

Negation does not turn missing information into a fact

For the same six rows, NOT P is TRUE for R1 and R6, FALSE for R2 and R4, and unknown for R3 and R5.

Consequently, WHERE NOT P retains R1 and R6. It does not collect every row omitted by WHERE P. The two missing-reading rows appear in neither result.

Counting the result sets gives two rows satisfying P and two satisfying NOT P, out of six input rows. Their union contains only the four rows with known readings.

For the null rows, P OR NOT P also remains unknown. It is therefore not a way to recover every input row in this three-valued interpretation. A two-valued intuition that every row must fall into exactly one of the two query results does not describe this table.

Combine the reading with enabled

Consider enabled AND P. Only R2 produces TRUE: it has a known enabled flag and a known reading above five.

R3 produces unknown because TRUE combined with an unknown P leaves the conjunction undecided. R5 produces FALSE because its enabled value is FALSE, regardless of the unknown reading comparison.

R6 also produces FALSE: its P is already FALSE, so an unknown enabled flag cannot make the conjunction true. This shows why an unknown operand does not force every combined expression to remain unknown.

For enabled OR P, R1, R2, R3, and R4 produce TRUE. R3 qualifies because enabled is already TRUE, while R4 qualifies because P is TRUE.

R5 and R6 produce unknown for that disjunction. Neither has a known true operand, and the missing operand could affect the outcome. WHERE consequently retains four rows for the disjunction and only one for the conjunction.

These are truth outcomes, not a claim about which operand an engine evaluates first. A logical identity should not be used as a promise of procedural evaluation order.

Ask explicitly about missingness

The predicate reading IS NULL is TRUE for R3 and R5 and FALSE for the other rows. It directly tests the representation of missingness rather than comparing an unavailable number with a limit.

Writing reading = NULL under the assumed standard behavior would not perform that test. Its ordinary equality result is unknown, including when reading is itself null, so a WHERE filter using that expression would retain no rows in this example.

For the Boolean expression P, P IS FALSE identifies R1 and R6, while P IS UNKNOWN identifies R3 and R5. P IS NOT TRUE identifies all four of those rows, deliberately combining false and unknown under one explicit selection rule.

That last rule can be useful for a review queue whose stated purpose includes undecided records. Its name should preserve that purpose: it collects records not established as true, rather than asserting that every collected reading is below the threshold.

A query policy does not identify the missing cause

R3 and R5 have identical missing reading representations but different enabled flags. The NULL alone cannot reveal a communication failure, a disabled sensor, a deferred computation, or any other origin.

If those distinctions matter, the data model needs separate status or provenance fields. Replacing every missing reading with zero would introduce a numerical assumption; it would no longer be the table analyzed here.

Similarly, changing the selection rule can decide which records enter a report without establishing physical measurement validity. A database predicate describes the stored record under declared semantics.

For robot data reviews, preserving true, false, and unknown outcomes makes omissions explainable. The six rows show the practical consequence: a condition and its negation need not partition records when one of the compared values is unavailable.

Sources checked October 23, 2026

PostgreSQL 18, Comparison Functions and Operators:

https://www.postgresql.org/docs/18/functions-comparison.html

PostgreSQL 18, Logical Operators:

https://www.postgresql.org/docs/18/functions-logical.html

PostgreSQL 18, Table Expressions, section 7.2.2 WHERE:

https://www.postgresql.org/docs/18/queries-table-expressions.html

All rows, predicates, and selected sets are original hypothetical constructions. No database query was run.

Illustration note: The site-library robot beside a laptop is a concept illustration. It does not show a live database, missing measurement incident, or verified query result.