-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityT-sql-queriesSQL Queries TeamSQL Queries Team
Description
Describe the problem
An unexpected result in UNION.
The third SELECT is the UNION of above two SELECTs, but the result is not the sum of the results of above two SELECTs.
To Reproduce
CREATE TABLE t1 (c0 BOOL AS (1 IS NULL) STORED, CONSTRAINT "primary" PRIMARY KEY(c0));
CREATE TABLE t2 (c0 INT);
INSERT INTO t2 (c0) VALUES(1);
INSERT INTO t1 DEFAULT VALUES;
SELECT t1.c0 FROM t2 FULL OUTER JOIN t1 ON false WHERE false IN (t1.c0 IS NULL); -- {f}
SELECT t1.c0 FROM t2 FULL OUTER JOIN t1 ON false WHERE NOT false IN (t1.c0 IS NULL); -- {NULL}
SELECT t1.c0 FROM t2 FULL OUTER JOIN t1 ON false WHERE false IN (t1.c0 IS NULL) UNION SELECT t1.c0 FROM t2 FULL OUTER JOIN t1 ON false WHERE NOT false IN (t1.c0 IS NULL); -- {f}Expected behavior
The result of the third SELECT should be {f}, {NULL}, while it only return one row.
Additional data / screenshots
If applicable, add screenshots to help explain your problem.
Environment:
- CockroachDB version [5cd0309]
- Server OS: [Ubuntu 20.04]
- Client app [
cockroach sql]
Additional context
Jira issue: CRDB-18273
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the communityT-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Done