MDEV-13374: Server crashes in first_linear_tab / st_select_lex::set_explain_type
- Support first_linear_tab() traversal for degenerate joins
This commit is contained in:
parent
c508691a93
commit
0b30ce4f31
@ -3173,3 +3173,15 @@ Nth_value(i,1) OVER()
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# A regression after MDEV-13351:
|
||||||
|
# MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type
|
||||||
|
# upon UNION with aggregate function
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (i INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1;
|
||||||
|
fld
|
||||||
|
1
|
||||||
|
2
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -1954,3 +1954,14 @@ UNION ALL
|
|||||||
;
|
;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # A regression after MDEV-13351:
|
||||||
|
--echo # MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type
|
||||||
|
--echo # upon UNION with aggregate function
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (i INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
@ -8627,7 +8627,7 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls
|
|||||||
JOIN_TAB *tab= join->join_tab;
|
JOIN_TAB *tab= join->join_tab;
|
||||||
if (const_tbls == WITHOUT_CONST_TABLES)
|
if (const_tbls == WITHOUT_CONST_TABLES)
|
||||||
{
|
{
|
||||||
if (join->const_tables == join->table_count)
|
if (join->const_tables == join->table_count || !tab)
|
||||||
return NULL;
|
return NULL;
|
||||||
tab += join->const_tables;
|
tab += join->const_tables;
|
||||||
}
|
}
|
||||||
@ -8650,6 +8650,10 @@ JOIN_TAB *first_linear_tab(JOIN *join,
|
|||||||
enum enum_with_const_tables const_tbls)
|
enum enum_with_const_tables const_tbls)
|
||||||
{
|
{
|
||||||
JOIN_TAB *first= join->join_tab;
|
JOIN_TAB *first= join->join_tab;
|
||||||
|
|
||||||
|
if (!first)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (const_tbls == WITHOUT_CONST_TABLES)
|
if (const_tbls == WITHOUT_CONST_TABLES)
|
||||||
first+= join->const_tables;
|
first+= join->const_tables;
|
||||||
|
|
||||||
@ -8736,7 +8740,7 @@ JOIN_TAB *first_depth_first_tab(JOIN* join)
|
|||||||
{
|
{
|
||||||
JOIN_TAB* tab;
|
JOIN_TAB* tab;
|
||||||
/* This means we're starting the enumeration */
|
/* This means we're starting the enumeration */
|
||||||
if (join->const_tables == join->top_join_tab_count)
|
if (join->const_tables == join->top_join_tab_count || !join->join_tab)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
tab= join->join_tab + join->const_tables;
|
tab= join->join_tab + join->const_tables;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user