Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f9b2704f
Commit
f9b2704f
authored
Apr 23, 2015
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testcase for: MDEV-7893 table_elimination works wrong ...
parent
20109712
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
mysql-test/r/table_elim.result
mysql-test/r/table_elim.result
+32
-0
mysql-test/t/table_elim.test
mysql-test/t/table_elim.test
+31
-0
No files found.
mysql-test/r/table_elim.result
View file @
f9b2704f
...
...
@@ -677,3 +677,35 @@ USA
CAN
DROP TABLE t1, t2, t3;
SET optimizer_switch=@save_optimizer_switch;
#
# MDEV-7893: table_elimination works wrong with on computed expression and compound unique key
# (just a testcase)
CREATE TABLE t1 (
PostID int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1266 Using storage engine MyISAM for table 't1'
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)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1266 Using storage engine MyISAM for table 't2'
INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30);
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;
PostID Voted
1 NULL
DROP TABLE t1,t2;
mysql-test/t/table_elim.test
View file @
f9b2704f
...
...
@@ -610,3 +610,34 @@ SELECT t1.alpha3 FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code = t3.code )
DROP
TABLE
t1
,
t2
,
t3
;
SET
optimizer_switch
=@
save_optimizer_switch
;
--
echo
#
--
echo
# MDEV-7893: table_elimination works wrong with on computed expression and compound unique key
--
echo
# (just a testcase)
CREATE
TABLE
t1
(
PostID
int
(
10
)
unsigned
NOT
NULL
)
ENGINE
=
InnoDB
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
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
INSERT
INTO
t2
(
EntityID
,
UserID
)
VALUES
(
1
,
30
),
(
2
,
30
);
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
;
DROP
TABLE
t1
,
t2
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment