Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Scalar subqueries from the empty input return non-nullable type and in some cases it leads to wrong results. For example:
SELECT (SELECT 1 FROM (SELECT NULL) WHERE 1 = 0)
Returns 0, but expected NULL according to the SQL standard:
Let SS be a <scalar subquery>. Case: a) If the cardinality of SS is greater than 1 (one), then an exception condition is raised: cardinality violation. b) If the cardinality of SS is 0 (zero), then the value of the <scalar subquery> is the null value. c) Otherwise, let C be the column of <query expression> simply contained in SS. The value of SS is the value of C in the unique row of the result of the <scalar subquery>.
Attachments
Issue Links
- links to