A scalar subquery fails closed when row count is wrong.

highlighted = computed this step

Scalar rejects zero or many

A scalar subquery must not return more than one row in this finite model.

scalar row count is guarded\text{scalar row count is guarded}

Reject many rows

The many-row case is rejected, and result rows are 0.

many result rows=0\text{many result rows}=0

Subquery examples are tiny finite table evaluations; SQL dialects, optimizer rewrites, NULL truth tables beyond the explicit NOT IN caveat, performance, and product behavior are out of scope.

Scalar rejects many rows: outer tablesourceRowidnamecity_id01Ada1012Ben2023Cy30 Scalar rejects many rows: inner tablesourceRownamevalue0regionUS1tierA per-row subquery evaluationsourceRowouterValuestatusreasoninnerRows0nonerejectscalar_row_count[0, 1]1nonerejectscalar_row_count[0, 1]2nonerejectscalar_row_count[0, 1] result rowssourceRowidnamecity_idnonenonenonenone subquery factsfactvaluemodescalarouterRowCount3innerRowCount2resultRowCount0rejectedyesrejectionReasonscalar_row_countnullInInnernorowOrdersource

Reject zero rows

The zero-row case is rejected, and result rows are 0.

zero result rows=0\text{zero result rows}=0

Subquery examples are tiny finite table evaluations; SQL dialects, optimizer rewrites, NULL truth tables beyond the explicit NOT IN caveat, performance, and product behavior are out of scope.

Scalar rejects zero rows: outer tablesourceRowidnamecity_id01Ada1012Ben2023Cy30 Scalar rejects zero rows: inner tablesourceRownamevaluenonenonenone per-row subquery evaluationsourceRowouterValuestatusreasoninnerRows0nonerejectscalar_row_count[]1nonerejectscalar_row_count[]2nonerejectscalar_row_count[] result rowssourceRowidnamecity_idnonenonenonenone subquery factsfactvaluemodescalarouterRowCount3innerRowCount0resultRowCount0rejectedyesrejectionReasonscalar_row_countnullInInnernorowOrdersource

Read the reason

Both rejection reasons are scalar_row_count.

wrong row count\text{wrong row count}

Summary

The model fails closed instead of choosing an arbitrary value.

no guessed scalar\text{no guessed scalar}