Skip to content

Instantly share code, notes, and snippets.

# Time: 240319 11:13:38
# User@Host: root[root] @ localhost []
# Thread_id: 3 Schema: test QC_hit: No
# Query_time: 0.358257 Lock_time: 0.000121 Rows_sent: 1 Rows_examined: 18501
# Rows_affected: 0 Bytes_sent: 66
# Pages_accessed: 20020 Pages_read: 0 Pages_updated: 0 Old_rows_read: 0
# Pages_read_time: 0.0000 Engine_time: 338.2396
# Full_scan: Yes Full_join: No Tmp_table: No Tmp_table_on_disk: No
# Filesort: No Filesort_on_disk: No Merge_passes: 0 Priority_queue: No
#
diff --git a/sql/field.h b/sql/field.h
index d5c1b049ff1..b766665e002 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1636,9 +1636,12 @@ class Field: public Value_source
{ return max_length;}
virtual bool is_packable() const { return false; }
- uint offset(const uchar *record) const
+ uint offset() const
diff --git a/sql/field.h b/sql/field.h
index 7f1c243a180..d5c1b049ff1 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1526,7 +1526,7 @@ class Field: public Value_source
ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg;
}
inline void move_field(uchar *ptr_arg) { ptr=ptr_arg; }
- inline uchar *record_ptr() // record[0] or wherever the field was moved to
+ inline uchar *record_ptr() const // record[0] or wherever the field was moved to
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index e41f1b08c5a..09b6067be4f 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -93,6 +93,7 @@ static const char *ha_par_ext= PAR_EXT;
table->record[0] during index condition evaluation (if present).
*/
using IndexOperationFunc= std::function<int(uchar* read_buf)>;
+#if 0
static int index_reader(TABLE* table,
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index c95761309a7..27d66d5a35c 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1192,7 +1192,7 @@ void Sp_handler_procedure::recursion_level_error(THD *thd,
*/
bool
-sp_head::execute(THD *thd, bool merge_da_on_success)
+sp_head::execute(THD *thd, bool merge_da_on_success, const char *sp_name)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index a62aa1c158b..0c42ebb4892 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8129,6 +8129,8 @@ best_access_path(JOIN *join,
if (table->opt_range[key].key_parts >= max_key_part) // (2)
{
double rows= (double) table->opt_range[key].rows;
+ // psergey: make records optimistic:
+ records= rows/2;
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index 3b7961c2349..b41de0cc859 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -9041,5 +9041,342 @@ JS
drop table t1,t2,t3,t10,t11;
set optimizer_trace=DEFAULT;
#
+# MDEV-32034: Second SELECT from view created from
+# INFORMATION_SCHEMA.OPTIMIZER_TRACE gives NULL
diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result
index 141db4221b5..ceedb4f6bb7 100644
--- a/mysql-test/main/join.result
+++ b/mysql-test/main/join.result
@@ -3408,7 +3408,7 @@ drop table t1,t2,t3;
drop table t1000,t10,t03;
# End of 10.3 tests
#
-# MDEV-30975
+# MDEV-30975: Wrong result with cross Join given join order
--- /tmp/log-on.txt 2024-02-09 13:07:36.292363361 +0300
+++ /tmp/log-off.txt 2024-02-09 13:08:34.117609771 +0300
@@ -1,3 +1,6 @@
+MariaDB [test]> set optimizer_use_condition_selectivity=1;
+Query OK, 0 rows affected (0.000 sec)
+
MariaDB [test]> SET optimizer_trace='enabled=on';
Query OK, 0 rows affected (0.000 sec)
@@ -207,12 +210,12 @@
--- 10.6-distinct-review-cp/sql/sql_select.cc 2024-02-06 13:07:15.670758859 +0300
+++ 10.6-distinct-review/sql/sql_select.cc 2024-02-06 13:04:14.656527307 +0300
@@ -27145,8 +27145,22 @@
}
+/*
+ @brief
+ Setup aggregate functions.
+