Skip to content

Instantly share code, notes, and snippets.

Trying this on MySQL 8.0.36-debug
create table ten(a int);
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table twenty(a int);
insert into twenty select a from ten;
insert into twenty select a+10 from ten;
The default join order is:
# Tried on 8.0.35, 8.0.36-debug
create table ten(a int);
insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table twenty(a int);
insert into twenty select a from ten;
insert into twenty select a+10 from ten;
explain
analyze format=json SELECT COUNT(DISTINCT (c0)) FROM autoinc;
11:26
(gdb) wher
#0 tree_insert (tree=tree@entry=0x7fff28016d78, key=0x7fff2804c361, key_size=key_size@entry=0, custom_arg=0x7fff28016b18) at /home/psergey/dev-git2/10.6-dbg-review/mysys/tree.c:245
#1 0x0000555555f675a7 in Unique::unique_add (ptr=<optimized out>, this=0x7fff28016c50) at /home/psergey/dev-git2/10.6-dbg-review/sql/uniques.h:66
#2 Aggregator_distinct::add (this=0x7fff28016ae0) at /home/psergey/dev-git2/10.6-dbg-review/sql/item_sum.cc:1017
#3 0x0000555555cb1148 in Item_sum::aggregator_add (this=0x7fff28013570) at /home/psergey/dev-git2/10.6-dbg-review/sql/item_sum.h:571
#4 Item_sum::reset_and_add (this=0x7fff28013570) at /home/psergey/dev-git2/10.6-dbg-review/sql/item_sum.h:452
#5 init_sum_functions (func_ptr=0x7fff28014fe0, end_ptr=0x7fff28014fe8) at /home/psergey/dev-git2/10.6-dbg-review/sql/sql_select.cc:27186
#6 0x0000555555cdb864 in end_send_group (join=0x7fff280147d0, join_tab=<optimized out>, end_of_record
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 220d2f5432d..3c7ccbb132a 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1220,7 +1220,8 @@ void thd_gmt_sec_to_TIME(MYSQL_THD thd, MYSQL_TIME *ltime, my_time_t t)
}
-/**
+/*
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 220d2f5432d..3c7ccbb132a 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1220,7 +1220,8 @@ void thd_gmt_sec_to_TIME(MYSQL_THD thd, MYSQL_TIME *ltime, my_time_t t)
}
-/**
+/*
"table": {
"table_name": "lineitem",
"access_type": "range",
"possible_keys": ["i_l_shipdate", "i_l_quantity"],
"key": "i_l_quantity",
"key_length": "9",
"used_key_parts": ["l_quantity"],
"loops": 1,
"r_loops": 1,
(gdb) wher 1
#0 Item_subselect::const_item (this=0x7fff0c019a70) at /home/psergey/dev-git2/10.5/sql/item_subselect.cc:1001
(More stack frames follow...)
(gdb) p this
$473 = (const Item_singlerow_subselect * const) 0x7fff0c019a70
(gdb) p this->with_recursive_reference
$474 = false
(gdb) p dbug_print_item(this)
[Thread 0x7fff3ffff700 (LWP 12798) exited]
$475 = 0x555557a80420 <dbug_item_print_buf> "(subquery#6)"
Running this testcase:
--echo #
--echo # MDEV-29070 SIGSEGV in my_decimal::operator= and Assertion `0' failed
--echo # in Item_type_holder::val_decimal on SELECT
--echo #
...
WITH RECURSIVE x (x) AS (
diff --git a/sql/rowid_filter.cc b/sql/rowid_filter.cc
index c23aaba4cd3..9ca2d3849f3 100644
--- a/sql/rowid_filter.cc
+++ b/sql/rowid_filter.cc
@@ -591,10 +591,11 @@ Rowid_filter::build_return_code Range_rowid_filter::build()
{
rc= (quick_get_next_result == HA_ERR_END_OF_FILE ? SUCCESS
: FATAL_ERROR);
- /* It's supposed that thd error state will be set(with
- file->print_error(res, MYF(0)) call) inside of quick->get_next() call,
diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result
index d057babbd22..6bc00da6f4c 100644
--- a/mysql-test/main/rowid_filter_innodb.result
+++ b/mysql-test/main/rowid_filter_innodb.result
@@ -2741,6 +2741,10 @@ SET debug_dbug = '+d,innodb_report_deadlock';
SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a FOR UPDATE;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET debug_dbug = @saved_dbug;
+SET debug_dbug = '+d,innodb_report_deadlock';
+SELECT a FROM t1,two WHERE c < 'k' AND b > 't' ORDER BY a FOR UPDATE;