Skip to content

Conversation

@mgartner
Copy link
Collaborator

@mgartner mgartner commented Dec 9, 2025

Backport 1/3 commits from #159001.

/cc @cockroachdb/release


opt: fix placeholder scan NULL semantics

Fixes #158945

Release note (bug fix): A bug has been fixed which could cause incorrect
results. The bug has existed since v21.2. From v21.2 up to v25.3, the
bug only presented when all of the following were true:

  • The query was run with an explicit or implicit prepared statement.
  • The query had an equality filter on a placeholder and a UNIQUE
    column.
  • The column contained NULL values.
  • The placeholder was assigned to NULL during execution.
    In this case, the query could return rows in which the column's value is
    NULL, which violates SQL NULL-equality semantics. The correct result set
    should always be empty.
    Starting in v25.4, the requirements were loosened slightly. It was no
    longer necessary for the column to be UNIQUE. The bug could reproduce if
    the column was included in any index.

Release justification: Low-risk bug fix.

Fixes cockroachdb#158945

Release note (bug fix): A bug has been fixed which could cause incorrect
results. The bug has existed since v21.2. From v21.2 up to v25.3, the
bug only presented when all of the following were true:
  - The query was run with an explicit or implicit prepared statement.
  - The query had an equality filter on a placeholder and a UNIQUE
    column.
  - The column contained NULL values.
  - The placeholder was assigned to NULL during execution.
In this case, the query could return rows in which the column's value is
NULL, which violates SQL NULL-equality semantics. The correct result set
should always be empty.
Starting in v25.4, the requirements were loosened slightly. It was no
longer necessary for the column to be UNIQUE. The bug could reproduce if
the column was included in any index.
@mgartner mgartner requested review from a team and michae2 December 9, 2025 18:36
@mgartner mgartner requested a review from a team as a code owner December 9, 2025 18:36
@blathers-crl
Copy link

blathers-crl bot commented Dec 9, 2025

Thanks for opening a backport.

Before merging, please confirm that it falls into one of the following categories (select one):

  • Non-production code changes. Includes test-only changes, build system changes, etc.
  • Fixes for serious issues. Defined in the policy as correctness, stability, or security issues, data corruption/loss, significant performance regressions, breaking working and widely used functionality, or an inability to detect and debug production issues.
  • Other approved changes. These changes must be gated behind a disabled-by-default feature flag unless there is a strong justification not to.

Add a brief release justification to the PR description explaining your selection.

Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy.

All backports must be reviewed by the TL and EM for the owning area.

@blathers-crl blathers-crl bot added backport Label PR's that are backports to older release branches T-sql-queries SQL Queries Team labels Dec 9, 2025
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@blathers-crl
Copy link

blathers-crl bot commented Dec 9, 2025

❌ PR #159070 does not comply with backport policy

Confidence: high
Explanation: The pull request does not comply with the CockroachDB backport policy for several reasons. First, the release justification provided ('Low-risk bug fix') does not explain why the policy exception is warranted under the release justification exception clause. Moreover, the PR fixes a bug that, while potentially causing incorrect results under specific conditions, does not fall under the 'critical' category as it is not directly related to data corruption, significant performance regression, or causing the database to return incorrect results consistently or in common scenarios. Lastly, there is no evidence the bug fix is gated behind a feature flag, which is required unless the fix addresses a critical bug, which is not the case here.
Recommendation: Consider adding a more detailed release justification for why this bug fix should be backported, reflecting how it meets critical bug criteria or reconsider the backport. Alternatively, gate the modifications behind a feature flag.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Label PR's that are backports to older release branches T-sql-queries SQL Queries Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants