When a table is LEFT JOIN
ed, the fact that a joined column is NOT NULL
is not relevant. When the LEFT JOIN
finds no rows, the result is still NULL
.
SELECT CASE WHEN other_table.not_null_column IS NOT NULL THEN 1 END
FROM some_table
LEFT JOIN other_table ON (other_table.id = some_table.id);
Based on the definition of “NOT_NULL_COLUMN”, this condition is always “TRUE”.
Individual “WHERE” clause conditions should not be unconditionally true or false plsql:S3651
I guess the same false positive would happen with WHERE not_null_column IS NULL
.
- Rule: plsql:S3651
- Language: Oracle PL/SQL
- SonarQube 9.9.1