Details
Description
Table Elimination works wrong for the view. Ex:
(EDIT : Table Elimination doesn't have anything to do with this bug)
Test:
CREATE TABLE t1 ( |
PostID int(10) unsigned NOT NULL |
) DEFAULT CHARSET=utf8; |
|
INSERT INTO t1 (PostID) VALUES (1), (2); |
|
CREATE TABLE t2 ( |
VoteID int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, |
EntityID int(10) unsigned NOT NULL, |
UserID int(10) unsigned NOT NULL, |
UNIQUE KEY EntityID (EntityID,UserID) |
) DEFAULT CHARSET=utf8; |
|
INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30); |
|
CREATE VIEW v1 as SELECT t1.*, T.Voted as Voted |
FROM |
t1 LEFT JOIN ( |
SELECT 1 AS Voted, EntityID |
FROM t2 |
WHERE t2.UserID = '20' ) AS T |
ON T.EntityID = t1.PostID |
WHERE t1.PostID='1' |
LIMIT 1;
|
SELECT * FROM v1; |
|
DROP VIEW v1; |
DROP TABLE t1,t2; |
Actual result:
PostID Voted
|
1 1
|
Expected result:
PostID Voted
|
1 NULL |
Attachments
Issue Links
- causes
-
MDEV-31277 Wrong result on 2-nd execution of PS to select from view using derived
- Closed
- is part of
-
MDEV-27691 make working view-protocol
- Open