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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0213cd79
Commit
0213cd79
authored
Sep 28, 2009
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
f165fa96
a31f655d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
4 deletions
+67
-4
mysql-test/r/subselect4.result
mysql-test/r/subselect4.result
+31
-0
mysql-test/t/subselect4.test
mysql-test/t/subselect4.test
+32
-0
sql/sql_select.cc
sql/sql_select.cc
+4
-4
No files found.
mysql-test/r/subselect4.result
View file @
0213cd79
...
...
@@ -27,4 +27,35 @@ SELECT 1;
1
1
DROP TABLE t1,t2,t3;
#
# Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing
# query
#
CREATE TABLE t1 (
a INT,
b INT,
PRIMARY KEY (a),
KEY b (b)
);
INSERT INTO t1 VALUES (1, 1), (2, 1);
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 SELECT * FROM t1;
CREATE TABLE t3 LIKE t1;
INSERT INTO t3 SELECT * FROM t1;
# Should not crash.
# Should have 1 impossible where and 2 dependent subqs.
EXPLAIN
SELECT
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
FROM t3 WHERE 1 = 0 GROUP BY 1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 DEPENDENT SUBQUERY t1 index NULL PRIMARY 4 NULL 2 Using index
2 DEPENDENT SUBQUERY t2 index b b 5 NULL 2 Using where; Using index; Using join buffer
# should return 0 rows
SELECT
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
FROM t3 WHERE 1 = 0 GROUP BY 1;
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
DROP TABLE t1,t2,t3;
End of 5.0 tests.
mysql-test/t/subselect4.test
View file @
0213cd79
...
...
@@ -28,5 +28,37 @@ SELECT 1;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing
--
echo
# query
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
PRIMARY
KEY
(
a
),
KEY
b
(
b
)
);
INSERT
INTO
t1
VALUES
(
1
,
1
),
(
2
,
1
);
CREATE
TABLE
t2
LIKE
t1
;
INSERT
INTO
t2
SELECT
*
FROM
t1
;
CREATE
TABLE
t3
LIKE
t1
;
INSERT
INTO
t3
SELECT
*
FROM
t1
;
--
echo
# Should not crash.
--
echo
# Should have 1 impossible where and 2 dependent subqs.
EXPLAIN
SELECT
(
SELECT
1
FROM
t1
,
t2
WHERE
t2
.
b
>
t3
.
b
)
FROM
t3
WHERE
1
=
0
GROUP
BY
1
;
--
echo
# should return 0 rows
SELECT
(
SELECT
1
FROM
t1
,
t2
WHERE
t2
.
b
>
t3
.
b
)
FROM
t3
WHERE
1
=
0
GROUP
BY
1
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
End
of
5.0
tests
.
sql/sql_select.cc
View file @
0213cd79
...
...
@@ -3308,12 +3308,12 @@ add_key_equal_fields(KEY_FIELD **key_fields, uint and_level,
@retval FALSE it's something else
*/
inline
static
bool
static
bool
is_local_field
(
Item
*
field
)
{
field
=
field
->
real_item
();
return
field
->
type
()
==
Item
::
FIELD_ITEM
&&
!
((
Item_field
*
)
field
)
->
depended_from
;
return
field
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
&&
!
(
field
->
used_tables
()
&
OUTER_REF_TABLE_BIT
)
&&
!
((
Item_field
*
)
field
->
real_item
()
)
->
depended_from
;
}
...
...
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