1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

Merge branch '10.5' into 10.6

This commit is contained in:
Yuchen Pei
2024-07-16 15:54:22 +08:00
62 changed files with 3237 additions and 1217 deletions

View File

@@ -1070,7 +1070,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
case QUERY_COMPRESSED_EVENT:
{
Query_log_event *qe= (Query_log_event*)ev;
if (!qe->is_trans_keyword())
if (!qe->is_trans_keyword(print_event_info->is_xa_trans()))
{
if (shall_skip_database(qe->db))
goto end;

View File

@@ -573,6 +573,22 @@ privilege\&.
.sp -1
.IP \(bu 2.3
.\}
.\" mysqlbinlog: flashback option
.\" flashback option: mysqlbinlog
\fB\-\-flashback\fR,
\fB\-B\fR
.sp
Support flashback mode\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqlbinlog: force-if-open option
.\" force-if-open option: mysqlbinlog
\fB\-\-force\-if\-open\fR

View File

@@ -894,22 +894,6 @@ instead\&.
.sp -1
.IP \(bu 2.3
.\}
.\" mysqldump: flashback option
.\" flashback option: mysqldump
\fB\-\-flashback\fR,
\fB\-B\fR
.sp
Support flashback mode\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqldump: flush-logs option
.\" flush-logs option: mysqldump
\fB\-\-flush\-logs\fR,

View File

@@ -4,4 +4,4 @@
# - r_engine_stats depends on buffer pool state and whether old record versions
# were purged.
--replace_regex /("(r_[a-z_]*_time_ms|r_buffer_size)": )[^, \n]*/\1"REPLACED"/ /("r_engine_stats":) {[^}]*}/\1 REPLACED/
--replace_regex /("(r_[a-z_]*_time_ms|r_buffer_size|r_partial_match_buffer_size)": )[^, \n]*/\1"REPLACED"/ /("r_engine_stats":) {[^}]*}/\1 REPLACED/

View File

@@ -1,4 +0,0 @@
if (`select version() like '%valgrind%' || version() like '%asan%'`)
{
skip Does not run with binaries built with valgrind or asan;
}

View File

@@ -692,21 +692,25 @@ ANALYZE
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"materialization": {
"r_strategy": "index_lookup",
"r_loops": 2,
"query_block": {
"select_id": 2,
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}

View File

@@ -7671,10 +7671,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 2,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -7731,10 +7733,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 2,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -7815,10 +7819,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -7872,10 +7878,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -7924,10 +7932,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -7976,10 +7986,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -8030,10 +8042,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -8082,10 +8096,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -8134,10 +8150,12 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
"materialization": {
"query_block": {
"select_id": 3,
"table": {
"message": "Select tables optimized away"
}
}
}
}
@@ -8223,10 +8241,12 @@ EXPLAIN
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"message": "Impossible WHERE"
"materialization": {
"query_block": {
"select_id": 2,
"table": {
"message": "Impossible WHERE"
}
}
}
}
@@ -9294,27 +9314,29 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"temporary_table": {
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 5,
"filtered": 100,
"attached_condition": "d_tab.e > 1",
"materialized": {
"query_block": {
"select_id": 3,
"filesort": {
"sort_key": "t2.e",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 5,
"filtered": 100,
"attached_condition": "t2.e > 1"
"materialization": {
"query_block": {
"select_id": 2,
"temporary_table": {
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 5,
"filtered": 100,
"attached_condition": "d_tab.e > 1",
"materialized": {
"query_block": {
"select_id": 3,
"filesort": {
"sort_key": "t2.e",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 5,
"filtered": 100,
"attached_condition": "t2.e > 1"
}
}
}
}
@@ -9396,27 +9418,29 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"temporary_table": {
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 5,
"filtered": 100,
"attached_condition": "d_tab.max_f > 20",
"materialized": {
"query_block": {
"select_id": 3,
"having_condition": "max_f > 20",
"filesort": {
"sort_key": "t2.e",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 5,
"filtered": 100
"materialization": {
"query_block": {
"select_id": 2,
"temporary_table": {
"table": {
"table_name": "<derived3>",
"access_type": "ALL",
"rows": 5,
"filtered": 100,
"attached_condition": "d_tab.max_f > 20",
"materialized": {
"query_block": {
"select_id": 3,
"having_condition": "max_f > 20",
"filesort": {
"sort_key": "t2.e",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 5,
"filtered": 100
}
}
}
}
@@ -10827,16 +10851,18 @@ EXPLAIN
"attached_condition": "t4.c = `<subquery2>`.`sum(b)`",
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"having_condition": "`f1(a)` > 1 and `sum(b)` > 123",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "t1.a + 1 > 10"
"materialization": {
"query_block": {
"select_id": 2,
"having_condition": "`f1(a)` > 1 and `sum(b)` > 123",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "t1.a + 1 > 10"
}
}
}
}

View File

@@ -574,14 +574,16 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100
"materialization": {
"query_block": {
"select_id": 2,
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 10,
"filtered": 100
}
}
}
}
@@ -906,13 +908,15 @@ EXPLAIN
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
"materialization": {
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
}

View File

@@ -1134,15 +1134,17 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "t2.x < 5 and t2.x > 1"
"materialization": {
"query_block": {
"select_id": 2,
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "t2.x < 5 and t2.x > 1"
}
}
}
}
@@ -1183,15 +1185,17 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "t2.x < 5 and t2.x > 1"
"materialization": {
"query_block": {
"select_id": 3,
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "t2.x < 5 and t2.x > 1"
}
}
}
}
@@ -1257,16 +1261,18 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 2,
"having_condition": "`MAX(t2.y)` < 14",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "t2.x < 5"
"materialization": {
"query_block": {
"select_id": 2,
"having_condition": "`MAX(t2.y)` < 14",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "t2.x < 5"
}
}
}
}
@@ -1307,16 +1313,18 @@ EXPLAIN
"filtered": 100,
"materialized": {
"unique": 1,
"query_block": {
"select_id": 3,
"having_condition": "`MAX(t2.y)` < 14",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "t2.x < 5"
"materialization": {
"query_block": {
"select_id": 3,
"having_condition": "`MAX(t2.y)` < 14",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "t2.x < 5"
}
}
}
}
@@ -5088,4 +5096,91 @@ SELECT * FROM v1
GROUP BY a HAVING a = (a IS NULL OR a IS NULL);
a
DROP VIEW v1;
#
# MDEV-32608: Expression with constant subquery causes a crash
# in pushdown from HAVING
#
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (2, 1), (3, 2);
EXPLAIN FORMAT=JSON SELECT * FROM t1
GROUP BY b
HAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3;
EXPLAIN
{
"query_block": {
"select_id": 1,
"having_condition": "t1.a = (subquery#2)",
"filesort": {
"sort_key": "t1.b",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "(subquery#2) + t1.b = 3"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
]
}
}
}
}
SELECT * FROM t1
GROUP BY b
HAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3;
a b
2 1
EXPLAIN FORMAT=JSON SELECT * FROM t1
GROUP BY b
HAVING (SELECT MAX(b) FROM t1) = a AND a > b;
EXPLAIN
{
"query_block": {
"select_id": 1,
"having_condition": "t1.a = (subquery#2)",
"filesort": {
"sort_key": "t1.b",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "(subquery#2) > t1.b"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
]
}
}
}
}
SELECT * FROM t1
GROUP BY b
HAVING (SELECT MAX(b) FROM t1) = a AND a > b;
a b
2 1
DROP TABLE t1;
End of 10.5 tests

View File

@@ -1562,4 +1562,30 @@ SELECT * FROM v1
DROP VIEW v1;
--echo #
--echo # MDEV-32608: Expression with constant subquery causes a crash
--echo # in pushdown from HAVING
--echo #
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (2, 1), (3, 2);
let $q=
SELECT * FROM t1
GROUP BY b
HAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3;
eval EXPLAIN FORMAT=JSON $q;
eval $q;
let $q=
SELECT * FROM t1
GROUP BY b
HAVING (SELECT MAX(b) FROM t1) = a AND a > b;
eval EXPLAIN FORMAT=JSON $q;
eval $q;
DROP TABLE t1;
--echo End of 10.5 tests

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
--source include/not_msan.inc
--source include/not_valgrind_build.inc
--source include/not_valgrind.inc
--echo # MDEV-20699 do not cache SP in SHOW CREATE
--echo # Warmup round, this might allocate some memory for session variable

View File

@@ -0,0 +1,982 @@
set @save_optimizer_switch=@@optimizer_switch;
create table t1 (a int);
create table t2 (b int);
insert into t1 values (null), (1), (2), (3);
insert into t2 values (3), (4);
set @@optimizer_switch = "materialization=on,in_to_exists=off,semijoin=off";
explain format=json select * from t1 where a in (select b from t2);
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 4,
"filtered": 100,
"attached_condition": "<in_optimizer>(t1.a,t1.a in (subquery#2))"
},
"subqueries": [
{
"materialization": {
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
}
]
}
}
# "Complete match" execution strategy
analyze format=json select * from t1 where a in (select b from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 25,
"attached_condition": "<in_optimizer>(t1.a,t1.a in (subquery#2))"
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup",
"r_loops": 3,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
# "Partial match" is used due to NOT IN
# Force rowid-merge partial partial matching
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
analyze format=json select * from t1 where a not in (select b from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 50,
"attached_condition": "!<in_optimizer>(t1.a,t1.a in (subquery#2))"
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;array merge for partial match",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"r_partial_match_buffer_size": "REPLACED",
"r_partial_match_array_sizes": ["2"],
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
# Force table scan partial matching
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on";
analyze format=json select * from t1 where a not in (select b from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 50,
"attached_condition": "!<in_optimizer>(t1.a,t1.a in (subquery#2))"
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
# Subselect in GROUP BY
analyze format=json select a from t1 group by a in (select b from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
"sort_key": "<in_optimizer>(t1.a,t1.a in (subquery#2))",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 3,
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
}
}
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
analyze format=json select a from t1 group by a not in (select b from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"filesort": {
"sort_key": "!<in_optimizer>(t1.a,t1.a in (subquery#2))",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 3,
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;array merge for partial match",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"r_partial_match_buffer_size": "REPLACED",
"r_partial_match_array_sizes": ["2"],
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
}
}
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=on";
# Subselect in ORDER BY
analyze format=json select a from t1 order by a in (select b from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"read_sorted_file": {
"r_rows": 4,
"filesort": {
"sort_key": "<in_optimizer>(t1.a,t1.a in (subquery#2))",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 4,
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,addon_fields",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
# Subselect in HAVING
analyze format=json select a from t1 having a not in (select b from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"having_condition": "!<in_optimizer>(t1.a,t1.a in (subquery#2))",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 4,
"r_index_lookups": 3,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
# Nested IN
analyze format=json select a from t1 where a in (select a from t1 where a in (select b from t2));
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 25,
"attached_condition": "<in_optimizer>(t1.a,t1.a in (subquery#2))"
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup",
"r_loops": 3,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 25,
"attached_condition": "<in_optimizer>(t1.a,t1.a in (subquery#3))"
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup",
"r_loops": 3,
"query_block": {
"select_id": 3,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
}
]
}
}
create table t3 (c int);
insert into t3 (c) values (3), (null), (4);
# Subquery in ON-clause of outer join
analyze format=json select a from t1 left join t2 on a not in (select c from t3);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"const_condition": "1",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
},
"block-nl-join": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
},
"buffer_type": "flat",
"buffer_size": "87",
"join_type": "BNL",
"attached_condition": "trigcond(trigcond(!<in_optimizer>(t1.a,t1.a in (subquery#2))))",
"r_loops": 4,
"r_filtered": 50,
"r_unpack_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_effective_rows": 2
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 4,
"r_index_lookups": 3,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t3",
"access_type": "ALL",
"r_loops": 1,
"rows": 3,
"r_rows": 3,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
analyze format=json
select (b, b + 1, b + 2) not in
(select count(distinct a), a + 1, a + 2 from t1 group by a + 1, a + 2)
from t2;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 2,
"r_index_lookups": 2,
"r_partial_matches": 2,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"read_sorted_file": {
"r_rows": 4,
"filesort": {
"sort_key": "t1.a + 1, t1.a + 2",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"r_used_priority_queue": false,
"r_output_rows": 4,
"r_buffer_size": "REPLACED",
"r_sort_mode": "sort_key,addon_fields",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
}
}
]
}
}
drop table t1, t2, t3;
#
# Tables with more than one column
#
create table t1 (a1 char(1), a2 char(1));
insert into t1 values (null, 'b');
create table t2 (b1 char(1), b2 char(2));
insert into t2 values ('a','b'), ('c', 'd'), (null, 'e'), ('f', 'g');
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
explain format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
EXPLAIN
{
"query_block": {
"select_id": 1,
"const_condition": "!<in_optimizer>((NULL,'b'),(NULL,'b') in (subquery#2))",
"table": {
"table_name": "t1",
"access_type": "system",
"rows": 1,
"filtered": 100
},
"subqueries": [
{
"materialization": {
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100
}
}
}
}
]
}
}
analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"const_condition": "!<in_optimizer>((NULL,'b'),(NULL,'b') in (subquery#2))",
"table": {
"table_name": "t1",
"access_type": "system",
"r_loops": 0,
"rows": 1,
"r_rows": null,
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": null
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;array merge for partial match",
"r_loops": 1,
"r_partial_matches": 1,
"r_partial_match_buffer_size": "REPLACED",
"r_partial_match_array_sizes": ["4", "3"],
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on";
analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"const_condition": "!<in_optimizer>((NULL,'b'),(NULL,'b') in (subquery#2))",
"table": {
"table_name": "t1",
"access_type": "system",
"r_loops": 0,
"rows": 1,
"r_rows": null,
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": null
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 1,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
# Subquery in SELECT list
explain format=json select t1.*, (a1, a2) in (select * from t2) as in_res from t1;
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "system",
"rows": 1,
"filtered": 100
},
"subqueries": [
{
"materialization": {
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 4,
"filtered": 100
}
}
}
}
]
}
}
analyze format=json select t1.*, (a1, a2) in (select * from t2) as in_res from t1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "system",
"r_loops": 0,
"rows": 1,
"r_rows": null,
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": null
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 1,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
analyze format=json select t1.*, (a1, a2) not in (select * from t2) as in_res from t1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "system",
"r_loops": 0,
"rows": 1,
"r_rows": null,
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": null
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;full scan for partial match",
"r_loops": 1,
"r_partial_matches": 1,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
analyze format=json select t1.*, (a1, a2) in (select * from t2) as in_res from t1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "system",
"r_loops": 0,
"rows": 1,
"r_rows": null,
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": null
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;array merge for partial match",
"r_loops": 1,
"r_partial_matches": 1,
"r_partial_match_buffer_size": "REPLACED",
"r_partial_match_array_sizes": ["4", "3"],
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
analyze format=json select t1.*, (a1, a2) not in (select * from t2) as in_res from t1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "system",
"r_loops": 0,
"rows": 1,
"r_rows": null,
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": null
},
"subqueries": [
{
"materialization": {
"r_strategy": "index_lookup;array merge for partial match",
"r_loops": 1,
"r_partial_matches": 1,
"r_partial_match_buffer_size": "REPLACED",
"r_partial_match_array_sizes": ["4", "3"],
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 1,
"rows": 4,
"r_rows": 4,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_filtered": 100
}
}
}
}
]
}
}
drop table t1,t2;
set @@optimizer_switch=@save_optimizer_switch;

View File

@@ -0,0 +1,99 @@
set @save_optimizer_switch=@@optimizer_switch;
create table t1 (a int);
create table t2 (b int);
insert into t1 values (null), (1), (2), (3);
insert into t2 values (3), (4);
set @@optimizer_switch = "materialization=on,in_to_exists=off,semijoin=off";
explain format=json select * from t1 where a in (select b from t2);
--echo # "Complete match" execution strategy
--source include/analyze-format.inc
analyze format=json select * from t1 where a in (select b from t2);
--echo # "Partial match" is used due to NOT IN
--echo # Force rowid-merge partial partial matching
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
--source include/analyze-format.inc
analyze format=json select * from t1 where a not in (select b from t2);
--echo # Force table scan partial matching
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on";
--source include/analyze-format.inc
analyze format=json select * from t1 where a not in (select b from t2);
--echo # Subselect in GROUP BY
--source include/analyze-format.inc
analyze format=json select a from t1 group by a in (select b from t2);
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
--source include/analyze-format.inc
analyze format=json select a from t1 group by a not in (select b from t2);
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=on";
--echo # Subselect in ORDER BY
--source include/analyze-format.inc
analyze format=json select a from t1 order by a in (select b from t2);
--echo # Subselect in HAVING
--source include/analyze-format.inc
analyze format=json select a from t1 having a not in (select b from t2);
--echo # Nested IN
--source include/analyze-format.inc
analyze format=json select a from t1 where a in (select a from t1 where a in (select b from t2));
create table t3 (c int);
insert into t3 (c) values (3), (null), (4);
--echo # Subquery in ON-clause of outer join
--source include/analyze-format.inc
analyze format=json select a from t1 left join t2 on a not in (select c from t3);
--source include/analyze-format.inc
analyze format=json
select (b, b + 1, b + 2) not in
(select count(distinct a), a + 1, a + 2 from t1 group by a + 1, a + 2)
from t2;
drop table t1, t2, t3;
--echo #
--echo # Tables with more than one column
--echo #
create table t1 (a1 char(1), a2 char(1));
insert into t1 values (null, 'b');
create table t2 (b1 char(1), b2 char(2));
insert into t2 values ('a','b'), ('c', 'd'), (null, 'e'), ('f', 'g');
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
explain format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
--source include/analyze-format.inc
analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=on";
--source include/analyze-format.inc
analyze format=json select * from t1 where (a1, a2) not in (select b1, b2 from t2);
--echo # Subquery in SELECT list
explain format=json select t1.*, (a1, a2) in (select * from t2) as in_res from t1;
--source include/analyze-format.inc
analyze format=json select t1.*, (a1, a2) in (select * from t2) as in_res from t1;
--source include/analyze-format.inc
analyze format=json select t1.*, (a1, a2) not in (select * from t2) as in_res from t1;
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
--source include/analyze-format.inc
analyze format=json select t1.*, (a1, a2) in (select * from t2) as in_res from t1;
--source include/analyze-format.inc
analyze format=json select t1.*, (a1, a2) not in (select * from t2) as in_res from t1;
drop table t1,t2;
set @@optimizer_switch=@save_optimizer_switch;

View File

@@ -0,0 +1,23 @@
#
# MDEV-34542 Assertion `lock_trx_has_sys_table_locks(trx) == __null'
# failed in void row_mysql_unfreeze_data_dictionary(trx_t*)
#
#
CREATE TABLE t1 (c1 CHAR(1) ,c2 INT) ENGINE=INNODB
PARTITION BY LINEAR HASH ((c2)) PARTITIONS 512;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
set @old_table_open_cache= @@table_open_cache;
XA START 'a';
INSERT INTO mysql.innodb_index_stats SELECT * FROM mysql.innodb_index_stats WHERE table_name='';
SET GLOBAL table_open_cache=10;
INSERT into t2 (a) VALUES (1);
SELECT * FROM t1;
c1 c2
XA END 'a';
XA PREPARE 'a';
SELECT sleep(3);
sleep(3)
0
XA ROLLBACK 'a';
DROP TABLE t1, t2;
SET GLOBAL table_open_cache=@old_table_open_cache;

View File

@@ -0,0 +1,26 @@
--source include/have_innodb.inc
--source include/have_partition.inc
--echo #
--echo # MDEV-34542 Assertion `lock_trx_has_sys_table_locks(trx) == __null'
--echo # failed in void row_mysql_unfreeze_data_dictionary(trx_t*)
--echo #
--echo #
CREATE TABLE t1 (c1 CHAR(1) ,c2 INT) ENGINE=INNODB
PARTITION BY LINEAR HASH ((c2)) PARTITIONS 512;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
set @old_table_open_cache= @@table_open_cache;
XA START 'a';
INSERT INTO mysql.innodb_index_stats SELECT * FROM mysql.innodb_index_stats WHERE table_name='';
SET GLOBAL table_open_cache=10;
INSERT into t2 (a) VALUES (1);
SELECT * FROM t1;
XA END 'a';
XA PREPARE 'a';
# Added sleep to make sure that InnoDB main thread is to remove
# the innodb_index_stats from table cache
SELECT sleep(3);
XA ROLLBACK 'a';
DROP TABLE t1, t2;
SET GLOBAL table_open_cache=@old_table_open_cache;

View File

@@ -1164,6 +1164,84 @@ include/sync_with_master_gtid.inc
connection server_1;
set @@binlog_format = @sav_binlog_format;
set @@global.binlog_format = @sav_binlog_format;
#
# MDEV-33921.1: If a slave's replication of an XA transaction results in
# an empty transaction, e.g. due to replication filters, the slave
# should not binlog any part of the XA transaction.
connection server_1;
create database db1;
create database db2;
create table db1.t1 (a int) engine=innodb;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
include/stop_slave.inc
connection server_2;
include/stop_slave.inc
SET @@GLOBAL.replicate_ignore_db= "";
SET @@GLOBAL.replicate_do_db= "db2";
include/start_slave.inc
connection server_1;
use db1;
XA START "x1";
insert into db1.t1 values (1);
XA END "x1";
XA PREPARE "x1";
XA COMMIT "x1";
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
connection server_2;
include/save_master_gtid.inc
connection server_3;
include/start_slave.inc
include/sync_with_master_gtid.inc
#
# 33921.2: If the slave shuts down after "preparing" a filtered-to-empty
# XA transaction (and not completing it), then when the respective
# XA completion (COMMIT in this test) command is replicated, the slave
# should not throw ER_XAER_NOTA. Note that internally, the error is
# thrown, but it is ignored because the target db is filtered.
connection server_3;
include/stop_slave.inc
connection server_1;
use db1;
XA START "x2";
insert into db1.t1 values (2);
XA END "x2";
XA PREPARE "x2";
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
# Connection named slave is needed for reconnection
connect slave,localhost,root,,;
connect slave1,localhost,root,,;
include/rpl_restart_server.inc [server_number=2]
connection server_2;
include/stop_slave.inc
SET @@GLOBAL.replicate_do_db= "db2";
include/start_slave.inc
connection server_1;
XA COMMIT "x2";
connection server_2;
include/sync_with_master_gtid.inc
include/save_master_gtid.inc
connection server_3;
include/start_slave.inc
include/sync_with_master_gtid.inc
#
# 33921.3: Ensure XA commands are not considered by mysqlbinlog's
# --database filter
connection server_1;
# MYSQL_BINLOG datadir/binlog_file --start-position=pre_xa_pos --database=db2 --result-file=assert_file
include/assert_grep.inc [Mysqlbinlog should output all XA commands from the filtered transaction]
connection server_2;
include/stop_slave.inc
SET @@GLOBAL.replicate_do_db="";
include/start_slave.inc
connection server_1;
drop database db1;
drop database db2;
connection server_1;
include/rpl_end.inc
# End of rpl_xa_empty_transaction.test

View File

@@ -55,9 +55,7 @@ SET sql_log_bin=1;
# Restart the slave mysqld server, and verify that the GTID position is
# read correctly from the new mysql.gtid_slave_pos_innodb table.
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--shutdown_server
--source include/wait_until_disconnected.inc
@@ -94,9 +92,7 @@ DROP TABLE mysql.gtid_slave_pos;
RENAME TABLE mysql.gtid_slave_pos_innodb TO mysql.gtid_slave_pos;
SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--shutdown_server
--source include/wait_until_disconnected.inc
@@ -132,9 +128,7 @@ SET sql_log_bin=0;
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--shutdown_server
--source include/wait_until_disconnected.inc
@@ -176,9 +170,7 @@ INSERT INTO mysql.gtid_slave_pos SELECT * FROM mysql.gtid_slave_pos_InnoDB;
DROP TABLE mysql.gtid_slave_pos_InnoDB;
SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--write_line "wait" $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--shutdown_server
--source include/wait_until_disconnected.inc
@@ -272,9 +264,7 @@ while (!$done)
# MDEV-15373 engine gtid_slave_pos table name disobeys lower-case-table-names
# This snippet verifies that engine gtid_slave_pos table is found,
# its data are up-to-date.
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--connection server_2
--shutdown_server
--source include/wait_until_disconnected.inc

View File

@@ -32,6 +32,10 @@
# MDEV-25616: Binlog event for XA COMMIT is generated without matching
# XA START, replication aborts
#
# MDEV-33921: Replication fails when XA transactions are used where the slave
# has replicate_do_db set and the client has touched a different
# database when running DML such as inserts.
#
--source include/have_log_bin.inc
--let $rpl_server_count= 3
@@ -167,6 +171,129 @@ set @@global.binlog_format = row;
set @@binlog_format = @sav_binlog_format;
set @@global.binlog_format = @sav_binlog_format;
--echo #
--echo # MDEV-33921.1: If a slave's replication of an XA transaction results in
--echo # an empty transaction, e.g. due to replication filters, the slave
--echo # should not binlog any part of the XA transaction.
#
# Note that the MDEV-33921 report is actually about that XA END is filtered
# out (not executed), and then its corresponding XA PREPARE errors because the
# XA state of the transaction is incorrect. This test case inherently tests
# both bugs.
--connection server_1
create database db1;
create database db2;
create table db1.t1 (a int) engine=innodb;
--source include/save_master_gtid.inc
--connection server_3
--source include/sync_with_master_gtid.inc
--source include/stop_slave.inc
--connection server_2
--source include/stop_slave.inc
SET @@GLOBAL.replicate_ignore_db= "";
SET @@GLOBAL.replicate_do_db= "db2";
--source include/start_slave.inc
--connection server_1
--let $pre_xa_gtid= `SELECT @@global.gtid_binlog_pos`
use db1;
XA START "x1";
insert into db1.t1 values (1);
XA END "x1";
XA PREPARE "x1";
XA COMMIT "x1";
--source include/save_master_gtid.inc
--connection server_2
--source include/sync_with_master_gtid.inc
--let $slave_binlogged_gtid= `SELECT @@global.gtid_binlog_pos`
if (`SELECT strcmp("$slave_binlogged_gtid","$pre_xa_gtid")`)
{
--die Slave binlogged an empty XA transaction yet should not have
}
--connection server_2
--source include/save_master_gtid.inc
--connection server_3
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--echo #
--echo # 33921.2: If the slave shuts down after "preparing" a filtered-to-empty
--echo # XA transaction (and not completing it), then when the respective
--echo # XA completion (COMMIT in this test) command is replicated, the slave
--echo # should not throw ER_XAER_NOTA. Note that internally, the error is
--echo # thrown, but it is ignored because the target db is filtered.
--connection server_3
--source include/stop_slave.inc
--connection server_1
--let $pre_xa_gtid= `SELECT @@global.gtid_binlog_pos`
# Used by mysqlbinlog in part 3
--let $pre_xa_pos = query_get_value(SHOW MASTER STATUS, Position, 1)
use db1;
XA START "x2";
insert into db1.t1 values (2);
XA END "x2";
XA PREPARE "x2";
--source include/save_master_gtid.inc
--connection server_2
--source include/sync_with_master_gtid.inc
--let $rpl_server_number= 2
--echo # Connection named slave is needed for reconnection
--connect(slave,localhost,root,,)
--connect(slave1,localhost,root,,)
--source include/rpl_restart_server.inc
--connection server_2
--source include/stop_slave.inc
SET @@GLOBAL.replicate_do_db= "db2";
--source include/start_slave.inc
--connection server_1
XA COMMIT "x2";
--connection server_2
--source include/sync_with_master_gtid.inc
--source include/save_master_gtid.inc
--connection server_3
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
--echo #
--echo # 33921.3: Ensure XA commands are not considered by mysqlbinlog's
--echo # --database filter
--connection server_1
--let $datadir= `select @@datadir`
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let assert_file= $MYSQLTEST_VARDIR/tmp/binlog_decoded.out
--echo # MYSQL_BINLOG datadir/binlog_file --start-position=pre_xa_pos --database=db2 --result-file=assert_file
--exec $MYSQL_BINLOG $datadir/$binlog_file --start-position=$pre_xa_pos --database=db2 --result-file=$assert_file
--let assert_text= Mysqlbinlog should output all XA commands from the filtered transaction
--let assert_count= 4
--let assert_select= XA START|XA END|XA PREPARE|XA COMMIT
--source include/assert_grep.inc
--connection server_2
--source include/stop_slave.inc
SET @@GLOBAL.replicate_do_db="";
--source include/start_slave.inc
--connection server_1
drop database db1;
drop database db2;
#
# Cleanup
--connection server_1

View File

@@ -42,7 +42,7 @@ public:
}
const char *fully_qualified_func_name() const override
{ return "sysconst_test()"; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sysconst_test>(thd, this); }
};

View File

@@ -45,7 +45,7 @@ public:
unsigned_flag= 1;
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_inet_aton>(thd, this); }
};
@@ -72,7 +72,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_inet_ntoa>(thd, this); }
};
@@ -118,7 +118,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_inet6_aton>(thd, this); }
String *val_str(String *to) override;
@@ -156,7 +156,7 @@ public:
return FALSE;
}
String *val_str_ascii(String *to) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_inet6_ntoa>(thd, this); }
};
@@ -178,7 +178,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_is_ipv4>(thd, this); }
longlong val_int() override;
@@ -201,7 +201,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv6") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_is_ipv6>(thd, this); }
longlong val_int() override;
@@ -223,7 +223,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_compat") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_is_ipv4_compat>(thd, this); }
longlong val_int() override;
};
@@ -244,7 +244,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_mapped") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); }
longlong val_int() override;
};

View File

@@ -1523,6 +1523,22 @@ int ha_prepare(THD *thd)
error=1;
}
}
else if (thd->rgi_slave)
{
/*
Slave threads will always process XA COMMITs in the binlog handler (see
MDEV-25616 and MDEV-30423), so if this is a slave thread preparing a
transaction which proved empty during replication (e.g. because of
replication filters) then mark it as XA_ROLLBACK_ONLY so the follow up
XA COMMIT will know to roll it back, rather than try to commit and binlog
a standalone XA COMMIT (without its preceding XA START - XA PREPARE).
If the xid_cache is cleared before the completion event comes, before
issuing ER_XAER_NOTA, first check if the event targets an ignored
database, and ignore the error if so.
*/
thd->transaction->xid_state.set_rollback_only();
}
DBUG_RETURN(error);
}

View File

@@ -1284,6 +1284,25 @@ bool Item::eq(const Item *item, bool binary_cmp) const
}
Item *Item::multiple_equality_transformer(THD *thd, uchar *arg)
{
if (const_item())
{
/*
Mark constant item in the condition with the MARKER_IMMUTABLE flag.
It is needed to prevent cleanup of the sub-items of this item and following
fix_fields() call that can cause a crash on this step of the optimization.
This flag will be removed at the end of the pushdown optimization by
remove_immutable_flag_processor processor.
*/
int new_flag= MARKER_IMMUTABLE;
this->walk(&Item::set_extraction_flag_processor, false,
(void*)&new_flag);
}
return this;
}
Item *Item::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
{
if (!needs_charset_converter(tocs))
@@ -2753,7 +2772,7 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
@retval 0 on a failure
*/
Item* Item_func_or_sum::build_clone(THD *thd)
Item* Item_func_or_sum::do_build_clone(THD *thd) const
{
Item *copy_tmp_args[2]= {0,0};
Item **copy_args= copy_tmp_args;
@@ -3073,7 +3092,7 @@ Item_sp::init_result_field(THD *thd, uint max_length, uint maybe_null,
0 if an error occurred
*/
Item* Item_ref::build_clone(THD *thd)
Item* Item_ref::do_build_clone(THD *thd) const
{
Item_ref *copy= (Item_ref *) get_copy(thd);
if (unlikely(!copy) ||
@@ -3886,7 +3905,7 @@ void Item_decimal::set_decimal_value(my_decimal *value_par)
}
Item *Item_decimal::clone_item(THD *thd)
Item *Item_decimal::do_clone_const_item(THD *thd) const
{
return new (thd->mem_root) Item_decimal(thd, name.str, &decimal_value, decimals,
max_length);
@@ -3907,7 +3926,7 @@ my_decimal *Item_float::val_decimal(my_decimal *decimal_value)
}
Item *Item_float::clone_item(THD *thd)
Item *Item_float::do_clone_const_item(THD *thd) const
{
return new (thd->mem_root) Item_float(thd, name.str, value, decimals,
max_length);
@@ -4071,7 +4090,7 @@ Item *Item_null::safe_charset_converter(THD *thd, CHARSET_INFO *tocs)
return this;
}
Item *Item_null::clone_item(THD *thd)
Item *Item_null::do_clone_const_item(THD *thd) const
{
return new (thd->mem_root) Item_null(thd, name.str);
}
@@ -4877,7 +4896,7 @@ bool Item_param::basic_const_item() const
}
Item *Item_param::value_clone_item(THD *thd)
Item *Item_param::value_clone_item(THD *thd) const
{
MEM_ROOT *mem_root= thd->mem_root;
switch (value.type_handler()->cmp_type()) {
@@ -4891,12 +4910,15 @@ Item *Item_param::value_clone_item(THD *thd)
case DECIMAL_RESULT:
return 0; // Should create Item_decimal. See MDEV-11361.
case STRING_RESULT:
{
String value_copy = value.m_string; // to preserve constness of the func
return new (mem_root) Item_string(thd, name,
Lex_cstring(value.m_string.ptr(),
value.m_string.length()),
value.m_string.charset(),
Lex_cstring(value_copy.ptr(),
value_copy.length()),
value_copy.charset(),
collation.derivation,
collation.repertoire);
}
case TIME_RESULT:
break;
case ROW_RESULT:
@@ -4910,7 +4932,7 @@ Item *Item_param::value_clone_item(THD *thd)
/* see comments in the header file */
Item *
Item_param::clone_item(THD *thd)
Item_param::do_clone_const_item(THD *thd) const
{
// There's no "default". See comments in Item_param::save_in_field().
switch (state) {
@@ -7000,7 +7022,7 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
}
Item *Item_string::clone_item(THD *thd)
Item *Item_string::do_clone_const_item(THD *thd) const
{
LEX_CSTRING val;
str_value.get_value(&val);
@@ -7064,7 +7086,7 @@ int Item_int::save_in_field(Field *field, bool no_conversions)
}
Item *Item_int::clone_item(THD *thd)
Item *Item_int::do_clone_const_item(THD *thd) const
{
return new (thd->mem_root) Item_int(thd, name.str, value, max_length, unsigned_flag);
}
@@ -7093,7 +7115,7 @@ int Item_decimal::save_in_field(Field *field, bool no_conversions)
}
Item *Item_int_with_ref::clone_item(THD *thd)
Item *Item_int_with_ref::do_clone_const_item(THD *thd) const
{
DBUG_ASSERT(ref->const_item());
/*
@@ -7189,7 +7211,7 @@ Item *Item_uint::neg(THD *thd)
}
Item *Item_uint::clone_item(THD *thd)
Item *Item_uint::do_clone_const_item(THD *thd) const
{
return new (thd->mem_root) Item_uint(thd, name.str, value, max_length);
}
@@ -7429,7 +7451,7 @@ void Item_date_literal::print(String *str, enum_query_type query_type)
}
Item *Item_date_literal::clone_item(THD *thd)
Item *Item_date_literal::do_clone_const_item(THD *thd) const
{
return new (thd->mem_root) Item_date_literal(thd, &cached_time);
}
@@ -7454,7 +7476,7 @@ void Item_datetime_literal::print(String *str, enum_query_type query_type)
}
Item *Item_datetime_literal::clone_item(THD *thd)
Item *Item_datetime_literal::do_clone_const_item(THD *thd) const
{
return new (thd->mem_root) Item_datetime_literal(thd, &cached_time, decimals);
}
@@ -7479,7 +7501,7 @@ void Item_time_literal::print(String *str, enum_query_type query_type)
}
Item *Item_time_literal::clone_item(THD *thd)
Item *Item_time_literal::do_clone_const_item(THD *thd) const
{
return new (thd->mem_root) Item_time_literal(thd, &cached_time, decimals);
}
@@ -10435,7 +10457,7 @@ void Item_cache_temporal::store_packed(longlong val_arg, Item *example_arg)
}
Item *Item_cache_temporal::clone_item(THD *thd)
Item *Item_cache_temporal::do_clone_const_item(THD *thd) const
{
Item_cache *tmp= type_handler()->Item_get_cache(thd, this);
Item_cache_temporal *item= static_cast<Item_cache_temporal*>(tmp);

View File

@@ -30,6 +30,7 @@
#include "sql_time.h"
#include "sql_schema.h"
#include "mem_root_array.h"
#include <typeinfo>
#include "cset_narrowing.h"
@@ -1866,10 +1867,61 @@ public:
raise_error_not_evaluable();
return true; // Error
}
/* cloning of constant items (0 if it is not const) */
virtual Item *clone_item(THD *thd) { return 0; }
/* deep copy item */
virtual Item* build_clone(THD *thd) { return get_copy(thd); }
/*
Create a shallow copy of the item (usually invoking copy constructor).
For deep copying see build_clone().
Return value:
- pointer to a copy of the Item
- nullptr if the item is not copyable
*/
Item *get_copy(THD *thd) const
{
Item *copy= do_get_copy(thd);
if (copy)
{
// Make sure the copy is of same type as this item
DBUG_ASSERT(typeid(*copy) == typeid(*this));
}
return copy;
}
/*
Creates a clone of the item by deep copying.
Return value:
- pointer to a clone of the Item
- nullptr if the item is not clonable
*/
Item* build_clone(THD *thd) const
{
Item *clone= do_build_clone(thd);
if (clone)
{
// Make sure the clone is of same type as this item
DBUG_ASSERT(typeid(*clone) == typeid(*this));
}
return clone;
}
/*
Clones the constant item
Return value:
- pointer to a clone of the Item
- nullptr if the item is not clonable */
Item *clone_const_item(THD *thd) const
{
Item *clone= do_clone_const_item(thd);
if (clone)
{
// Make sure the clone is of same type as this item
DBUG_ASSERT(typeid(*clone) == typeid(*this));
}
return clone;
}
virtual cond_result eq_cmp_result() const { return COND_OK; }
inline uint float_length(uint decimals_par) const
{ return decimals < FLOATING_POINT_DECIMALS ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;}
@@ -2397,12 +2449,6 @@ public:
*/
virtual bool find_not_null_fields(table_map allowed) { return false; }
/*
Does not guarantee deep copy (depends on copy ctor).
See build_clone() for deep copy.
*/
virtual Item *get_copy(THD *thd)=0;
bool cache_const_expr_analyzer(uchar **arg);
Item* cache_const_expr_transformer(THD *thd, uchar *arg);
@@ -2506,8 +2552,7 @@ public:
{ return this; }
virtual Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg)
{ return this; }
virtual Item *multiple_equality_transformer(THD *thd, uchar *arg)
{ return this; }
virtual Item *multiple_equality_transformer(THD *thd, uchar *arg);
virtual bool expr_cache_is_needed(THD *) { return FALSE; }
virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs);
bool needs_charset_converter(uint32 length, CHARSET_INFO *tocs) const
@@ -2729,12 +2774,33 @@ public:
DBUG_ASSERT(fixed());
return false;
}
protected:
/*
Service function for public method get_copy(). See comments for get_copy()
above. Override this method in derived classes to create shallow copies of
the item
*/
virtual Item *do_get_copy(THD *thd) const = 0;
/*
Service function for public method build_clone(). See comments for
build_clone() above. Override this method in derived classes to create
deep copies (clones) of the item where possible
*/
virtual Item* do_build_clone(THD *thd) const = 0;
/*
Service function for public method clone_const_item(). See comments for
clone_const_item() above
*/
virtual Item *do_clone_const_item(THD *thd) const { return nullptr; }
};
MEM_ROOT *get_thd_memroot(THD *thd);
template <class T>
inline Item* get_item_copy (THD *thd, T* item)
inline Item* get_item_copy (THD *thd, const T* item)
{
Item *copy= new (get_thd_memroot(thd)) T(*item);
if (likely(copy))
@@ -3189,7 +3255,8 @@ public:
bool append_for_log(THD *thd, String *str) override;
Item *get_copy(THD *) override { return nullptr; }
Item *do_get_copy(THD *) const override { return nullptr; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
/*
Override the inherited create_field_for_create_select(),
@@ -3234,6 +3301,9 @@ public:
:Item_splocal(thd, rh, sp_var_name, sp_var_idx, &type_handler_null,
pos_in_q, len_in_q)
{ }
Item *do_get_copy(THD *) const override { return nullptr; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
};
@@ -3266,6 +3336,9 @@ public:
Item **this_item_addr(THD *thd, Item **) override;
bool append_for_log(THD *thd, String *str) override;
void print(String *str, enum_query_type query_type) override;
Item *do_get_copy(THD *) const override { return nullptr; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
};
@@ -3286,6 +3359,9 @@ public:
{ }
bool fix_fields(THD *thd, Item **it) override;
void print(String *str, enum_query_type query_type) override;
Item *do_get_copy(THD *) const override { return nullptr; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
};
@@ -3329,7 +3405,8 @@ public:
purposes.
*/
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *) override { return nullptr; }
Item *do_get_copy(THD *) const override { return nullptr; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
private:
uint m_case_expr_id;
@@ -3409,8 +3486,9 @@ public:
{
return mark_unsupported_function("name_const()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_name_const>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -3782,8 +3860,9 @@ public:
bool cleanup_excluding_const_fields_processor(void *arg) override
{ return field && const_item() ? 0 : cleanup_processor(arg); }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_field>(thd, this); }
Item* do_build_clone(THD *thd) const override { return get_copy(thd); }
bool is_outer_field() const override
{
DBUG_ASSERT(fixed());
@@ -3807,7 +3886,7 @@ public:
:Item_field(thd, field),
Item_args()
{ }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_field_row>(thd, this); }
const Type_handler *type_handler() const override
@@ -3896,7 +3975,7 @@ public:
const Type_handler *type_handler() const override
{ return &type_handler_null; }
bool basic_const_item() const override { return true; }
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
bool const_is_null() const override { return true; }
bool is_null() override { return true; }
@@ -3910,8 +3989,9 @@ public:
Item_basic_constant *make_string_literal_concat(THD *thd,
const LEX_CSTRING *)
override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_null>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
class Item_null_result :public Item_null
@@ -4120,7 +4200,7 @@ class Item_param :public Item_basic_value,
PValue value;
const String *value_query_val_str(THD *thd, String* str) const;
Item *value_clone_item(THD *thd);
Item *value_clone_item(THD *thd) const;
bool is_evaluable_expression() const override;
bool can_return_value() const;
@@ -4346,7 +4426,7 @@ public:
basic_const_item returned TRUE.
*/
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override;
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
void set_param_type_and_swap_value(Item_param *from);
Rewritable_query_parameter *get_rewritable_query_parameter() override
@@ -4356,7 +4436,9 @@ public:
bool append_for_log(THD *thd, String *str) override;
bool check_vcol_func_processor(void *) override { return false; }
Item *get_copy(THD *) override { return nullptr; }
Item *do_get_copy(THD *thd) const override { return nullptr; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
bool add_as_clone(THD *thd);
void sync_clones();
bool register_clone(Item_param *i) { return m_clones.push_back(i); }
@@ -4446,13 +4528,14 @@ public:
String *val_str(String*) override;
int save_in_field(Field *field, bool no_conversions) override;
bool is_order_clause_position() const override { return true; }
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
void print(String *str, enum_query_type query_type) override;
Item *neg(THD *thd) override;
decimal_digits_t decimal_precision() const override
{ return (decimal_digits_t) (max_length - MY_TEST(value < 0)); }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_int>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -4482,6 +4565,9 @@ public:
predicate at various condition optimization stages in sql_select.
*/
}
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_bool>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -4493,6 +4579,8 @@ public:
void set_join_tab_idx(uint8 join_tab_idx_arg) override
{ DBUG_ASSERT(0); }
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_bool_static>(thd, this); }
};
extern const Item_bool_static Item_false, Item_true;
@@ -4504,11 +4592,11 @@ public:
Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {}
Item_uint(THD *thd, const char *str_arg, longlong i, uint length);
double val_real() override { return ulonglong2double((ulonglong)value); }
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
Item *neg(THD *thd) override;
decimal_digits_t decimal_precision() const override
{ return decimal_digits_t(max_length); }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_uint>(thd, this); }
};
@@ -4559,7 +4647,7 @@ public:
const my_decimal *const_ptr_my_decimal() const override
{ return &decimal_value; }
int save_in_field(Field *field, bool no_conversions) override;
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
void print(String *str, enum_query_type query_type) override
{
decimal_value.to_string(&str_value);
@@ -4569,8 +4657,9 @@ public:
decimal_digits_t decimal_precision() const override
{ return decimal_value.precision(); }
void set_decimal_value(my_decimal *value_par);
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_decimal>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -4612,11 +4701,12 @@ public:
}
String *val_str(String*) override;
my_decimal *val_decimal(my_decimal *) override;
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
Item *neg(THD *thd) override;
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_float>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -4732,7 +4822,7 @@ public:
int save_in_field(Field *field, bool no_conversions) override;
const Type_handler *type_handler() const override
{ return &type_handler_varchar; }
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override
{
return const_charset_converter(thd, tocs, true);
@@ -4775,8 +4865,9 @@ public:
const LEX_CSTRING *) override;
Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_string>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -4796,6 +4887,9 @@ public:
{
return true;
}
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_string_with_introducer>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -4985,8 +5079,9 @@ public:
return field->store_hex_hybrid(str_value.ptr(), str_value.length());
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_hex_hybrid>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -5024,8 +5119,9 @@ public:
collation.collation);
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_hex_string>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -5081,8 +5177,9 @@ public:
{
m_value= value;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_timestamp_literal>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -5149,7 +5246,7 @@ public:
{
return cached_time.get_mysql_time();
}
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
longlong val_int() override
{
return update_null() ? 0 : cached_time.to_longlong();
@@ -5171,8 +5268,9 @@ public:
return update_null() ? 0 : cached_time.valid_date_to_packed();
}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_date_literal>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -5198,7 +5296,7 @@ public:
{
return cached_time.get_mysql_time();
}
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
longlong val_int() override { return cached_time.to_longlong(); }
double val_real() override { return cached_time.to_double(); }
String *val_str(String *to) override
@@ -5214,8 +5312,9 @@ public:
{
return Time(thd, this).to_native(to, decimals);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_time_literal>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -5251,7 +5350,7 @@ public:
{
return cached_time.get_mysql_time();
}
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
longlong val_int() override
{
return update_null() ? 0 : cached_time.to_longlong();
@@ -5273,8 +5372,9 @@ public:
return update_null() ? 0 : cached_time.valid_datetime_to_packed();
}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_datetime_literal>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -5560,7 +5660,7 @@ public:
virtual bool fix_length_and_dec()= 0;
bool const_item() const override { return const_item_cache; }
table_map used_tables() const override { return used_tables_cache; }
Item* build_clone(THD *thd) override;
Item* do_build_clone(THD *thd) const override;
Sql_mode_dependency value_depends_on_sql_mode() const override
{
return Item_args::value_depends_on_sql_mode_bit_or().soft_to_hard();
@@ -5810,11 +5910,11 @@ public:
DBUG_ASSERT(ref);
return (*ref)->is_outer_field();
}
Item* build_clone(THD *thd) override;
Item *do_build_clone(THD *thd) const override;
/**
Checks if the item tree that ref points to contains a subquery.
*/
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_ref>(thd, this); }
bool excl_dep_on_table(table_map tab_map) override
{
@@ -5895,7 +5995,7 @@ public:
longlong val_datetime_packed(THD *) override;
longlong val_time_packed(THD *) override;
Ref_Type ref_type() override { return DIRECT_REF; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_direct_ref>(thd, this); }
Item *remove_item_direct_ref() override
{ return (*ref)->remove_item_direct_ref(); }
@@ -6064,9 +6164,9 @@ public:
{
return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_wrapper>(thd, this); }
Item *build_clone(THD *) override { return nullptr; }
Item *do_build_clone(THD *) const override { return nullptr; }
};
@@ -6278,7 +6378,7 @@ public:
my_decimal *val_decimal_result(my_decimal *val) override;
bool val_bool_result() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_direct_view_ref>(thd, this); }
Item *field_transformer_for_having_pushdown(THD *, uchar *) override
{ return this; }
@@ -6342,6 +6442,9 @@ public:
table_map not_null_tables() const override { return 0; }
Ref_Type ref_type() override { return OUTER_REF; }
bool check_inner_refs_processor(void * arg) override;
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_outer_ref>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -6378,7 +6481,7 @@ public:
bool val_native(THD *thd, Native *to) override;
void print(String *str, enum_query_type query_type) override;
table_map used_tables() const override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_ref_null_helper>(thd, this); }
};
@@ -6404,7 +6507,7 @@ public:
{
return ref->save_in_field(field, no_conversions);
}
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
Item *real_item() override { return ref; }
};
@@ -6541,8 +6644,9 @@ public:
{ return get_date_from_string(thd, ltime, fuzzydate); }
void copy() override;
int save_in_field(Field *field, bool no_conversions) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_copy_string>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -6612,8 +6716,9 @@ public:
DBUG_ASSERT(sane());
return null_value || m_value.to_native(to, decimals);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_copy_timestamp>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -6891,8 +6996,9 @@ public:
param->set_default();
return false;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_default_specification>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -6925,8 +7031,9 @@ public:
return false;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_ignore_specification>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7275,8 +7382,9 @@ public:
bool cache_value() override;
int save_in_field(Field *field, bool no_conversions) override;
Item *convert_to_basic_const_item(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_int>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7289,6 +7397,7 @@ public:
{
return type_handler_year.Item_get_date_with_warn(thd, this, to, mode);
}
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7313,7 +7422,7 @@ public:
is a constant and need not be optimized further.
Important when storing packed datetime values.
*/
Item *clone_item(THD *thd) override;
Item *do_clone_const_item(THD *thd) const override;
Item *convert_to_basic_const_item(THD *thd) override;
virtual Item *make_literal(THD *) =0;
};
@@ -7325,7 +7434,7 @@ public:
Item_cache_time(THD *thd)
:Item_cache_temporal(thd, &type_handler_time2) { }
bool cache_value() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_time>(thd, this); }
Item *make_literal(THD *) override;
longlong val_datetime_packed(THD *thd) override
@@ -7365,7 +7474,7 @@ class Item_cache_datetime: public Item_cache_temporal
public:
Item_cache_datetime(THD *thd)
:Item_cache_temporal(thd, &type_handler_datetime2) { }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_datetime>(thd, this); }
Item *make_literal(THD *) override;
longlong val_datetime_packed(THD *) override
@@ -7400,7 +7509,7 @@ class Item_cache_date: public Item_cache_temporal
public:
Item_cache_date(THD *thd)
:Item_cache_temporal(thd, &type_handler_newdate) { }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_date>(thd, this); }
Item *make_literal(THD *) override;
longlong val_datetime_packed(THD *) override
@@ -7433,8 +7542,9 @@ class Item_cache_timestamp: public Item_cache
public:
Item_cache_timestamp(THD *thd)
:Item_cache(thd, &type_handler_timestamp2) { }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_timestamp>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
bool cache_value() override;
String* val_str(String *to) override
{
@@ -7493,8 +7603,9 @@ public:
:Item_cache_real(thd, &type_handler_double)
{ }
String *val_str(String *str) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_double>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7505,8 +7616,9 @@ public:
:Item_cache_real(thd, &type_handler_float)
{ }
String *val_str(String *str) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_float>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7528,8 +7640,9 @@ public:
}
bool cache_value() override;
Item *convert_to_basic_const_item(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_decimal>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7558,8 +7671,9 @@ public:
int save_in_field(Field *field, bool no_conversions) override;
bool cache_value() override;
Item *convert_to_basic_const_item(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_str>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7583,8 +7697,9 @@ public:
*/
return Item::safe_charset_converter(thd, tocs);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_str_for_nullif>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7660,8 +7775,9 @@ public:
}
bool cache_value() override;
void set_null() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_row>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -7730,7 +7846,8 @@ public:
make_and_init_table_field(root, &name, Record_addr(maybe_null()),
*this, table);
}
Item* get_copy(THD *) override { return nullptr; }
Item *do_get_copy(THD *) const override { return nullptr; }
Item *do_build_clone(THD *) const override { return nullptr; }
};
@@ -7884,7 +8001,7 @@ public:
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override;
Item *get_tmp_table_item(THD *thd) override
{ return m_item->get_tmp_table_item(thd); }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_direct_ref_to_item>(thd, this); }
COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
bool link_item_fields,
@@ -7955,7 +8072,7 @@ public:
{ return m_item->excl_dep_on_grouping_fields(sel); }
bool is_expensive() override { return m_item->is_expensive(); }
void set_item(Item *item) { m_item= item; }
Item *build_clone(THD *thd) override
Item *do_build_clone(THD *thd) const override
{
Item *clone_item= m_item->build_clone(thd);
if (clone_item)

View File

@@ -5546,17 +5546,16 @@ void Item_cond::neg_arguments(THD *thd)
0 if an error occurred
*/
Item *Item_cond::build_clone(THD *thd)
Item *Item_cond::do_build_clone(THD *thd) const
{
List_iterator_fast<Item> li(list);
Item *item;
Item_cond *copy= (Item_cond *) get_copy(thd);
if (!copy)
return 0;
copy->list.empty();
while ((item= li++))
for (const Item &item : list)
{
Item *arg_clone= item->build_clone(thd);
Item *arg_clone= item.build_clone(thd);
if (!arg_clone)
return 0;
if (copy->list.push_back(arg_clone, thd->mem_root))

View File

@@ -295,7 +295,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("istrue") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_istrue>(thd, this); }
};
@@ -316,7 +316,7 @@ public:
return name;
}
bool find_not_null_fields(table_map allowed) override { return false; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_isnottrue>(thd, this); }
bool eval_not_null_tables(void *) override
{ not_null_tables_cache= 0; return false; }
@@ -337,7 +337,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("isfalse") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_isfalse>(thd, this); }
};
@@ -358,7 +358,7 @@ public:
return name;
}
bool find_not_null_fields(table_map allowed) override { return false; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_isnotfalse>(thd, this); }
bool eval_not_null_tables(void *) override
{ not_null_tables_cache= 0; return false; }
@@ -435,7 +435,7 @@ public:
void restore_first_argument();
Item* get_wrapped_in_subselect_item()
{ return args[1]; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_in_optimizer>(thd, this); }
enum precedence precedence() const override { return args[1]->precedence(); }
};
@@ -608,10 +608,10 @@ public:
return add_key_fields_optimize_op(join, key_fields, and_level,
usable_tables, sargables, false);
}
Item *build_clone(THD *thd) override
Item *do_build_clone(THD *thd) const override
{
Item_bool_rowready_func2 *clone=
(Item_bool_rowready_func2 *) Item_func::build_clone(thd);
(Item_bool_rowready_func2 *) Item_func::do_build_clone(thd);
if (clone)
{
clone->cmp.comparators= 0;
@@ -646,7 +646,7 @@ public:
Item_args::propagate_equal_fields(thd, Context_boolean(), cond);
return this;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_xor>(thd, this); }
};
@@ -670,7 +670,7 @@ public:
Item *neg_transformer(THD *thd) override;
bool fix_fields(THD *, Item **) override;
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_not>(thd, this); }
};
@@ -723,7 +723,7 @@ public:
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_trig_cond>(thd, this); }
};
@@ -771,7 +771,7 @@ public:
return name;
}
Item *neg_transformer(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_nop_all>(thd, this); }
};
@@ -816,7 +816,7 @@ public:
uint in_equality_no;
uint exists2in_reserved_items() override { return 1; };
friend class Arg_comparator;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_eq>(thd, this); }
};
@@ -845,7 +845,7 @@ public:
return add_key_fields_optimize_op(join, key_fields, and_level,
usable_tables, sargables, true);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_equal>(thd, this); }
};
@@ -865,7 +865,7 @@ public:
return name;
}
Item *negated_item(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ge>(thd, this); }
};
@@ -885,7 +885,7 @@ public:
return name;
}
Item *negated_item(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_gt>(thd, this); }
};
@@ -905,7 +905,7 @@ public:
return name;
}
Item *negated_item(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_le>(thd, this); }
};
@@ -925,7 +925,7 @@ public:
return name;
}
Item *negated_item(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_lt>(thd, this); }
};
@@ -950,7 +950,7 @@ public:
Item *negated_item(THD *thd) override;
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
table_map usable_tables, SARGABLE_PARAM **sargables) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ne>(thd, this); }
};
@@ -1051,7 +1051,7 @@ public:
cond);
return this;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_between>(thd, this); }
longlong val_int_cmp_string();
@@ -1087,7 +1087,7 @@ public:
fix_char_length(2); // returns "1" or "0" or "-1"
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_strcmp>(thd, this); }
};
@@ -1126,7 +1126,7 @@ public:
str->append(func_name_cstring());
print_args(str, 0, query_type);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_interval>(thd, this); }
};
@@ -1158,7 +1158,7 @@ public:
return name;
}
table_map not_null_tables() const override { return 0; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_coalesce>(thd, this); }
};
@@ -1253,7 +1253,7 @@ public:
}
table_map not_null_tables() const override { return 0; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ifnull>(thd, this); }
};
@@ -1332,7 +1332,7 @@ public:
bool eval_not_null_tables(void *opt_arg) override;
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge)
override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_if>(thd, this); }
private:
void cache_type_info(Item *source);
@@ -1358,7 +1358,7 @@ public:
{
return fix_length_and_dec2_eliminate_null(args + 1);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_nvl2>(thd, this); }
};
@@ -1452,7 +1452,7 @@ public:
cond, &args[2]);
return this;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_nullif>(thd, this); }
Item *derived_field_transformer_for_having(THD *thd, uchar *arg) override
{ reset_first_arg_if_needed(); return this; }
@@ -2402,7 +2402,7 @@ public:
return this;
}
Item *find_item() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_case_searched>(thd, this); }
};
@@ -2452,7 +2452,7 @@ public:
Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
override;
Item *find_item() override;
Item *build_clone(THD *thd) override
Item *do_build_clone(THD *thd) const override
{
Item_func_case_simple *clone= (Item_func_case_simple *)
Item_func_case::build_clone(thd);
@@ -2461,7 +2461,7 @@ public:
return NULL;
return clone;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_case_simple>(thd, this); }
};
@@ -2481,7 +2481,7 @@ public:
void print(String *str, enum_query_type query_type) override;
bool fix_length_and_dec() override;
Item *find_item() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_decode_oracle>(thd, this); }
};
@@ -2653,11 +2653,11 @@ public:
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge)
override;
bool count_sargable_conds(void *arg) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_in>(thd, this); }
Item *build_clone(THD *thd) override
Item *do_build_clone(THD *thd) const override
{
Item_func_in *clone= (Item_func_in *) Item_func::build_clone(thd);
Item_func_in *clone= (Item_func_in *) Item_func::do_build_clone(thd);
if (clone)
{
clone->array= 0;
@@ -2805,7 +2805,7 @@ public:
table_map not_null_tables() const override { return 0; }
bool find_not_null_fields(table_map allowed) override;
Item *neg_transformer(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_isnull>(thd, this); }
};
@@ -2861,7 +2861,7 @@ public:
Item *neg_transformer(THD *thd) override;
void print(String *str, enum_query_type query_type) override;
void top_level_item() override { abort_on_null=1; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_isnotnull>(thd, this); }
};
@@ -3024,7 +3024,7 @@ public:
bool find_selective_predicates_list_processor(void *arg) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_like>(thd, this); }
};
@@ -3121,7 +3121,7 @@ public:
return name;
}
enum precedence precedence() const override { return IN_PRECEDENCE; }
Item *get_copy(THD *) override { return 0; }
Item *do_get_copy(THD *thd) const override { return 0; }
void print(String *str, enum_query_type query_type) override
{
print_op(str, query_type);
@@ -3165,7 +3165,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_instr") };
return name;
}
Item *get_copy(THD *thd) override { return 0; }
Item *do_get_copy(THD *thd) const override { return 0; }
};
@@ -3264,7 +3264,7 @@ public:
}
bool eval_not_null_tables(void *opt_arg) override;
bool find_not_null_fields(table_map allowed) override;
Item *build_clone(THD *thd) override;
Item *do_build_clone(THD *thd) const override;
bool excl_dep_on_table(table_map tab_map) override;
bool excl_dep_on_grouping_fields(st_select_lex *sel) override;
@@ -3453,7 +3453,7 @@ public:
void set_context_field(Item_field *ctx_field) { context_field= ctx_field; }
void set_link_equal_fields(bool flag) { link_equal_fields= flag; }
Item* get_copy(THD *thd) override { return 0; }
Item* do_get_copy(THD *thd) const override { return 0; }
/*
This does not comply with the specification of the virtual method,
but Item_equal items are processed distinguishly anyway
@@ -3624,7 +3624,7 @@ public:
table_map usable_tables, SARGABLE_PARAM **sargables)
override;
SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cond_and>(thd, this); }
};
@@ -3652,7 +3652,7 @@ public:
table_map not_null_tables() const override { return and_tables_cache; }
Item *copy_andor_structure(THD *thd) override;
Item *neg_transformer(THD *thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cond_or>(thd, this); }
};
@@ -3667,7 +3667,7 @@ public:
return name;
}
bool need_parentheses_in_default() override { return false; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dyncol_check>(thd, this); }
};
@@ -3683,7 +3683,7 @@ public:
return name;
}
bool need_parentheses_in_default() override { return false; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dyncol_exists>(thd, this); }
};
@@ -3716,7 +3716,7 @@ public:
return name;
}
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_cursor_isopen>(thd, this); }
};
@@ -3735,7 +3735,7 @@ public:
return name;
}
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_cursor_found>(thd, this); }
};
@@ -3754,7 +3754,7 @@ public:
return name;
}
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_cursor_notfound>(thd, this); }
};

View File

@@ -1290,7 +1290,7 @@ public:
bool fix_length_and_dec() override;
const Type_handler *type_handler() const override
{ return &type_handler_slong; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_hash>(thd, this); }
LEX_CSTRING func_name_cstring() const override
{
@@ -1306,7 +1306,7 @@ public:
:Item_func_hash(thd, item)
{}
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_hash_mariadb_100403>(thd, this); }
LEX_CSTRING func_name_cstring() const override
{
@@ -1372,7 +1372,7 @@ public:
{
return Cursor_ref::print_func(str, func_name_cstring());
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_cursor_rowcount>(thd, this); }
};
@@ -1397,7 +1397,7 @@ public:
return mark_unsupported_function(func_name(), "()", arg,
VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_connection_id>(thd, this); }
};
@@ -1469,7 +1469,7 @@ public:
decimal_digits_t decimal_precision() const override
{ return args[0]->decimal_precision(); }
bool need_parentheses_in_default() override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_signed>(thd, this); }
};
@@ -1504,7 +1504,7 @@ public:
}
decimal_digits_t decimal_precision() const override { return max_length; }
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_unsigned>(thd, this); }
};
@@ -1545,7 +1545,7 @@ public:
}
void print(String *str, enum_query_type query_type) override;
bool need_parentheses_in_default() override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_decimal_typecast>(thd, this); }
};
@@ -1600,7 +1600,7 @@ public:
nr.to_string(str, decimals);
return str;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_float_typecast>(thd, this); }
};
@@ -1622,7 +1622,7 @@ public:
return name;
}
double val_real() override { return val_real_with_truncate(DBL_MAX); }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_double_typecast>(thd, this); }
};
@@ -1652,7 +1652,7 @@ public:
longlong int_op() override;
double real_op() override;
my_decimal *decimal_op(my_decimal *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_plus>(thd, this); }
};
@@ -1691,7 +1691,7 @@ public:
Item_func_additive_op::fix_length_and_dec_int();
fix_unsigned_flag();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_minus>(thd, this); }
};
@@ -1714,7 +1714,7 @@ public:
bool fix_length_and_dec() override;
bool check_partition_func_processor(void *int_arg) override {return FALSE;}
bool check_vcol_func_processor(void *arg) override { return FALSE;}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_mul>(thd, this); }
};
@@ -1737,7 +1737,7 @@ public:
void fix_length_and_dec_double();
void fix_length_and_dec_int();
void result_precision() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_div>(thd, this); }
};
@@ -1765,7 +1765,7 @@ public:
bool check_partition_func_processor(void *int_arg) override {return FALSE;}
bool check_vcol_func_processor(void *arg) override { return FALSE;}
bool need_parentheses_in_default() override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_int_div>(thd, this); }
};
@@ -1803,7 +1803,7 @@ public:
}
bool check_partition_func_processor(void *int_arg) override {return FALSE;}
bool check_vcol_func_processor(void *arg) override { return FALSE;}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_mod>(thd, this); }
};
@@ -1834,7 +1834,7 @@ public:
decimal_digits_t decimal_precision() const override
{ return args[0]->decimal_precision(); }
bool need_parentheses_in_default() override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_neg>(thd, this); }
};
@@ -1856,7 +1856,7 @@ public:
void fix_length_and_dec_double();
void fix_length_and_dec_decimal();
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_abs>(thd, this); }
};
@@ -1888,7 +1888,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("exp") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_exp>(thd, this); }
};
@@ -1903,7 +1903,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("ln") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ln>(thd, this); }
};
@@ -1919,7 +1919,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("log") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_log>(thd, this); }
};
@@ -1934,7 +1934,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("log2") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_log2>(thd, this); }
};
@@ -1949,7 +1949,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("log10") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_log10>(thd, this); }
};
@@ -1964,7 +1964,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("sqrt") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sqrt>(thd, this); }
};
@@ -1979,7 +1979,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("pow") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_pow>(thd, this); }
};
@@ -1994,7 +1994,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("acos") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_acos>(thd, this); }
};
@@ -2008,7 +2008,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("asin") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_asin>(thd, this); }
};
@@ -2023,7 +2023,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("atan") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_atan>(thd, this); }
};
@@ -2037,7 +2037,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("cos") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_cos>(thd, this); }
};
@@ -2051,7 +2051,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("sin") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sin>(thd, this); }
};
@@ -2065,7 +2065,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("tan") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_tan>(thd, this); }
};
@@ -2079,7 +2079,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("cot") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_cot>(thd, this); }
};
@@ -2126,7 +2126,7 @@ public:
my_decimal *decimal_op(my_decimal *) override;
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool time_op(THD *thd, MYSQL_TIME *ltime) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ceiling>(thd, this); }
};
@@ -2146,7 +2146,7 @@ public:
my_decimal *decimal_op(my_decimal *) override;
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool time_op(THD *thd, MYSQL_TIME *ltime) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_floor>(thd, this); }
};
@@ -2196,7 +2196,7 @@ public:
*/
return args[0]->real_type_handler()->Item_func_round_fix_length_and_dec(this);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_round>(thd, this); }
};
@@ -2226,7 +2226,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_rand>(thd, this); }
};
@@ -2275,7 +2275,7 @@ public:
return mark_unsupported_function(func_name(), "()", arg,
VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override { return 0; }
Item *do_get_copy(THD *thd) const override { return 0; }
/* This function is used in insert, update and delete */
void store_pointer_to_row_counter(ha_rows *row_counter)
{
@@ -2300,7 +2300,7 @@ public:
decimal_digits_t decimal_precision() const override { return 1; }
bool fix_length_and_dec() override { fix_char_length(2); return FALSE; }
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sign>(thd, this); }
};
@@ -2327,7 +2327,7 @@ public:
max_length= float_length(decimals);
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_units>(thd, this); }
};
@@ -2433,7 +2433,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("least") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_min>(thd, this); }
};
@@ -2446,7 +2446,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("greatest") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_max>(thd, this); }
};
@@ -2486,7 +2486,7 @@ public:
Type_std_attributes::set(*args[0]);
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_rollup_const>(thd, this); }
};
@@ -2512,7 +2512,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("octet_length") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_octet_length>(thd, this); }
};
@@ -2532,7 +2532,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("bit_length") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_bit_length>(thd, this); }
};
@@ -2547,7 +2547,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("char_length") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_char_length>(thd, this); }
};
@@ -2582,7 +2582,7 @@ public:
override
{ return this; }
bool const_item() const override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_coercibility>(thd, this); }
};
@@ -2619,7 +2619,7 @@ public:
return agg_arg_charsets_for_comparison(cmp_collation, args, 2);
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_locate>(thd, this); }
};
@@ -2638,7 +2638,7 @@ public:
return name;
}
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_field>(thd, this); }
};
@@ -2657,7 +2657,7 @@ public:
return name;
}
bool fix_length_and_dec() override { max_length=3; return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ascii>(thd, this); }
};
@@ -2675,7 +2675,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("ord") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ord>(thd, this); }
};
@@ -2697,7 +2697,7 @@ public:
return name;
}
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_find_in_set>(thd, this); }
};
@@ -2743,7 +2743,7 @@ public:
return name;
}
enum precedence precedence() const override { return BITOR_PRECEDENCE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_bit_or>(thd, this); }
};
@@ -2759,7 +2759,7 @@ public:
return name;
}
enum precedence precedence() const override { return BITAND_PRECEDENCE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_bit_and>(thd, this); }
};
@@ -2775,7 +2775,7 @@ public:
return name;
}
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_bit_count>(thd, this); }
};
@@ -2791,7 +2791,7 @@ public:
return name;
}
enum precedence precedence() const override { return SHIFT_PRECEDENCE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_shift_left>(thd, this); }
};
@@ -2807,7 +2807,7 @@ public:
return name;
}
enum precedence precedence() const override { return SHIFT_PRECEDENCE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_shift_right>(thd, this); }
};
@@ -2827,7 +2827,7 @@ public:
str->append(func_name_cstring());
args[0]->print_parenthesised(str, query_type, precedence());
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_bit_neg>(thd, this); }
};
@@ -2857,7 +2857,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_last_insert_id>(thd, this); }
};
@@ -2890,7 +2890,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_benchmark>(thd, this); }
};
@@ -2921,7 +2921,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sleep>(thd, this); }
};
@@ -3078,7 +3078,7 @@ class Item_func_udf_float :public Item_udf_func
const Type_handler *type_handler() const override
{ return &type_handler_double; }
bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_udf_float>(thd, this); }
};
@@ -3105,7 +3105,7 @@ public:
return &type_handler_slonglong;
}
bool fix_length_and_dec() override { decimals= 0; max_length= 21; return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_udf_int>(thd, this); }
};
@@ -3133,7 +3133,7 @@ public:
const Type_handler *type_handler() const override
{ return &type_handler_newdecimal; }
bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_udf_decimal>(thd, this); }
};
@@ -3173,7 +3173,7 @@ public:
const Type_handler *type_handler() const override
{ return string_type_handler(); }
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_udf_str>(thd, this); }
};
@@ -3278,7 +3278,7 @@ class Item_func_get_lock final :public Item_func_lock
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override final
Item *do_get_copy(THD *thd) const override final
{ return get_item_copy<Item_func_get_lock>(thd, this); }
};
@@ -3294,7 +3294,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("release_all_locks") };
return name;
}
Item *get_copy(THD *thd) override final
Item *do_get_copy(THD *thd) const override final
{ return get_item_copy<Item_func_release_all_locks>(thd, this); }
};
@@ -3318,7 +3318,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override final
Item *do_get_copy(THD *thd) const override final
{ return get_item_copy<Item_func_release_lock>(thd, this); }
};
@@ -3359,7 +3359,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_master_pos_wait>(thd, this); }
};
@@ -3388,7 +3388,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_master_gtid_wait>(thd, this); }
};
@@ -3509,7 +3509,7 @@ public:
bool register_field_in_bitmap(void *arg) override;
bool set_entry(THD *thd, bool create_if_not_exists);
void cleanup() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_set_user_var>(thd, this); }
bool excl_dep_on_table(table_map tab_map) override { return false; }
};
@@ -3542,7 +3542,7 @@ public:
table_map used_tables() const override
{ return const_item() ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_get_user_var>(thd, this); }
private:
bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override;
@@ -3625,8 +3625,9 @@ public:
void set_value(const char *str, uint length, CHARSET_INFO* cs);
const Type_handler *type_handler() const override
{ return &type_handler_double; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_user_var_as_out_param>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -3688,7 +3689,7 @@ public:
void cleanup() override;
bool check_vcol_func_processor(void *arg) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_get_system_var>(thd, this); }
};
@@ -3751,9 +3752,9 @@ public:
{
return mark_unsupported_function("match ... against()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_match>(thd, this); }
Item *build_clone(THD *thd) override { return 0; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
private:
/**
Check whether storage engine for given table,
@@ -3803,7 +3804,7 @@ public:
return name;
}
enum precedence precedence() const override { return BITXOR_PRECEDENCE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_bit_xor>(thd, this); }
};
@@ -3831,7 +3832,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_is_free_lock>(thd, this); }
};
@@ -3858,7 +3859,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_is_used_lock>(thd, this); }
};
@@ -3919,7 +3920,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_row_count>(thd, this); }
};
@@ -4057,7 +4058,7 @@ public:
{
return TRUE;
}
Item *get_copy(THD *) override { return 0; }
Item *do_get_copy(THD *thd) const override { return 0; }
bool eval_not_null_tables(void *opt_arg) override
{
not_null_tables_cache= 0;
@@ -4092,7 +4093,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_found_rows>(thd, this); }
};
@@ -4115,7 +4116,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_oracle_sql_rowcount>(thd, this); }
};
@@ -4145,7 +4146,7 @@ public:
max_length= 11;
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sqlcode>(thd, this); }
};
@@ -4172,7 +4173,7 @@ public:
return mark_unsupported_function(func_name(), "()", arg,
VCOL_NON_DETERMINISTIC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_uuid_short>(thd, this); }
};
@@ -4213,7 +4214,7 @@ public:
Item_func::update_used_tables();
copy_flags(last_value, item_base_t::MAYBE_NULL);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_last_value>(thd, this); }
};
@@ -4258,7 +4259,7 @@ public:
}
}
bool const_item() const override { return 0; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_nextval>(thd, this); }
void print(String *str, enum_query_type query_type) override;
bool check_vcol_func_processor(void *arg) override
@@ -4281,7 +4282,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("lastval") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_lastval>(thd, this); }
};
@@ -4306,7 +4307,7 @@ public:
return name;
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_setval>(thd, this); }
};

View File

@@ -219,7 +219,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_geometry_from_text>(thd, this); }
};
@@ -241,7 +241,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_geometry_from_wkb>(thd, this); }
};
@@ -267,7 +267,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_geometry_from_json>(thd, this); }
};
@@ -284,7 +284,7 @@ public:
}
String *val_str_ascii(String *) override;
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_as_wkt>(thd, this); }
};
@@ -309,7 +309,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_as_wkb>(thd, this); }
};
@@ -336,7 +336,7 @@ public:
}
bool fix_length_and_dec() override;
String *val_str_ascii(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_as_geojson>(thd, this); }
};
@@ -359,7 +359,7 @@ public:
set_maybe_null();
return FALSE;
};
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_geometry_type>(thd, this); }
};
@@ -398,7 +398,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_convexhull>(thd, this); }
};
@@ -418,7 +418,7 @@ public:
{
return &type_handler_point;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_centroid>(thd, this); }
};
@@ -437,7 +437,7 @@ public:
{
return &type_handler_polygon;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_envelope>(thd, this); }
};
@@ -475,7 +475,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_boundary>(thd, this); }
};
@@ -498,7 +498,7 @@ public:
{
return &type_handler_point;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_point>(thd, this); }
};
@@ -527,7 +527,7 @@ public:
}
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_spatial_decomp>(thd, this); }
};
@@ -564,7 +564,7 @@ public:
}
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_spatial_decomp_n>(thd, this); }
};
@@ -624,7 +624,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("geometrycollection") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_geometrycollection>(thd, this); }
};
@@ -644,7 +644,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("linestring") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_linestring>(thd, this); }
};
@@ -664,7 +664,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("polygon") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_polygon>(thd, this); }
};
@@ -686,7 +686,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("multilinestring") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_multilinestring>(thd, this); }
};
@@ -708,7 +708,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("multipoint") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_multipoint>(thd, this); }
};
@@ -730,7 +730,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("multipolygon") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_multipolygon>(thd, this); }
};
@@ -782,7 +782,7 @@ public:
usable_tables, sargables, false);
}
bool need_parentheses_in_default() override { return false; }
Item *build_clone(THD *thd) override { return 0; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
};
@@ -794,7 +794,7 @@ public:
{ }
longlong val_int() override;
LEX_CSTRING func_name_cstring() const override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_spatial_mbr_rel>(thd, this); }
};
@@ -810,7 +810,7 @@ public:
{ }
longlong val_int() override;
LEX_CSTRING func_name_cstring() const override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_spatial_precise_rel>(thd, this); }
};
@@ -837,7 +837,7 @@ public:
return name;
}
bool need_parentheses_in_default() override { return false; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_spatial_relate>(thd, this); }
};
@@ -874,7 +874,7 @@ public:
{
Item_func::print(str, query_type);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_spatial_operation>(thd, this); }
};
@@ -935,7 +935,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_buffer>(thd, this); }
};
@@ -954,7 +954,7 @@ public:
bool fix_length_and_dec() override
{ set_maybe_null(); return FALSE; }
bool need_parentheses_in_default() override { return false; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_isempty>(thd, this); }
};
@@ -975,7 +975,7 @@ public:
}
bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_issimple>(thd, this); }
};
@@ -992,7 +992,7 @@ public:
}
bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_isclosed>(thd, this); }
};
@@ -1006,7 +1006,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_isring") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_isring>(thd, this); }
};
@@ -1023,7 +1023,7 @@ public:
}
bool fix_length_and_dec() override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dimension>(thd, this); }
};
@@ -1045,7 +1045,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_x>(thd, this); }
};
@@ -1067,7 +1067,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_y>(thd, this); }
};
@@ -1085,7 +1085,7 @@ public:
}
bool fix_length_and_dec() override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_numgeometries>(thd, this); }
};
@@ -1103,7 +1103,7 @@ public:
}
bool fix_length_and_dec() override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_numinteriorring>(thd, this); }
};
@@ -1121,7 +1121,7 @@ public:
}
bool fix_length_and_dec() override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_numpoints>(thd, this); }
};
@@ -1143,7 +1143,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_area>(thd, this); }
};
@@ -1167,7 +1167,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_glength>(thd, this); }
};
@@ -1185,7 +1185,7 @@ public:
}
bool fix_length_and_dec() override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_srid>(thd, this); }
};
@@ -1206,7 +1206,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_distance") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_distance>(thd, this); }
};
@@ -1224,7 +1224,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_distance_sphere") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sphere_distance>(thd, this); }
};
@@ -1248,7 +1248,7 @@ public:
{
return &type_handler_point;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_pointonsurface>(thd, this); }
};
@@ -1270,7 +1270,7 @@ class Item_func_gis_debug: public Item_long_func
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_gis_debug>(thd, this); }
};
#endif

View File

@@ -101,7 +101,7 @@ public:
static const Lex_cstring fmt(STRING_WITH_LEN("json"));
return to->set_format_name(fmt);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_valid>(thd, this); }
enum Functype functype() const override { return JSON_VALID_FUNC; }
};
@@ -122,7 +122,7 @@ public:
return name;
}
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_exists>(thd, this); }
longlong val_int() override;
};
@@ -170,7 +170,7 @@ public:
{
return je->check_and_get_value_scalar(res, error);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_value>(thd, this); }
};
@@ -198,7 +198,7 @@ public:
{
return je->check_and_get_value_complex(res, error);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_query>(thd, this); }
};
@@ -217,7 +217,7 @@ public:
}
bool fix_length_and_dec() override;
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_quote>(thd, this); }
};
@@ -236,7 +236,7 @@ public:
}
bool fix_length_and_dec() override;
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_unquote>(thd, this); }
};
@@ -291,7 +291,7 @@ public:
double val_real() override;
my_decimal *val_decimal(my_decimal *) override;
uint get_n_paths() const override { return arg_count - 1; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_extract>(thd, this); }
};
@@ -314,7 +314,7 @@ public:
}
bool fix_length_and_dec() override;
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_contains>(thd, this); }
};
@@ -341,7 +341,7 @@ public:
bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override;
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_contains_path>(thd, this); }
};
@@ -363,7 +363,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_array") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_array>(thd, this); }
};
@@ -384,7 +384,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_array_append") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_array_append>(thd, this); }
};
@@ -400,7 +400,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_array_insert") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_array_insert>(thd, this); }
};
@@ -418,7 +418,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_object") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_object>(thd, this); }
};
@@ -436,7 +436,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_preserve") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_merge>(thd, this); }
};
@@ -451,7 +451,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_merge_patch>(thd, this); }
};
@@ -482,7 +482,7 @@ public:
}
bool fix_length_and_dec() override;
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_length>(thd, this); }
};
@@ -502,7 +502,7 @@ public:
}
bool fix_length_and_dec() override { max_length= 10; return FALSE; }
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_depth>(thd, this); }
};
@@ -520,7 +520,7 @@ public:
}
bool fix_length_and_dec() override;
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_type>(thd, this); }
};
@@ -546,7 +546,7 @@ public:
return (mode_insert ?
(mode_replace ? json_set : json_insert) : json_replace);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_insert>(thd, this); }
};
@@ -566,7 +566,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_remove") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_remove>(thd, this); }
};
@@ -587,7 +587,7 @@ public:
}
bool fix_length_and_dec() override;
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_keys>(thd, this); }
};
@@ -616,7 +616,7 @@ public:
bool fix_length_and_dec() override;
String *val_str(String *) override;
uint get_n_paths() const override { return arg_count > 4 ? arg_count - 4 : 0; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_search>(thd, this); }
};
@@ -644,7 +644,7 @@ public:
bool fix_length_and_dec() override;
String *val_str(String *str) override;
String *val_json(String *str) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_format>(thd, this); }
};
@@ -690,7 +690,7 @@ public:
String* val_str(String *str) override;
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_arrayagg>(thd, this); }
};
@@ -739,7 +739,7 @@ public:
String* val_str(String* str) override;
Item *copy_or_same(THD* thd) override;
void no_rows_in_result() override {}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_json_objectagg>(thd, this); }
};

View File

@@ -180,7 +180,7 @@ void Item_row::bring_value()
}
Item* Item_row::build_clone(THD *thd)
Item* Item_row::do_build_clone(THD *thd) const
{
Item **copy_args= static_cast<Item**>
(alloc_root(thd->mem_root, sizeof(Item*) * arg_count));

View File

@@ -148,9 +148,9 @@ public:
}
bool check_vcol_func_processor(void *arg) override {return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_row>(thd, this); }
Item *build_clone(THD *thd) override;
Item *do_build_clone(THD *thd) const override;
};
#endif /* ITEM_ROW_INCLUDED */

View File

@@ -155,7 +155,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("md5") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_md5>(thd, this); }
};
@@ -171,7 +171,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("sha") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sha>(thd, this); }
};
@@ -187,7 +187,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("sha2") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sha2>(thd, this); }
};
@@ -204,7 +204,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("to_base64") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_to_base64>(thd, this); }
};
@@ -221,7 +221,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("from_base64") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_from_base64>(thd, this); }
};
@@ -252,7 +252,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("aes_encrypt") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_aes_encrypt>(thd, this); }
};
@@ -267,7 +267,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("aes_decrypt") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_aes_decrypt>(thd, this); }
};
@@ -301,7 +301,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("concat") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_concat>(thd, this); }
};
@@ -332,7 +332,7 @@ public:
print_sql_mode_qualified_name(str, query_type);
print_args_parenthesized(str, query_type);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{
return get_item_copy<Item_func_concat_operator_oracle>(thd, this);
}
@@ -357,7 +357,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("decode_histogram") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_decode_histogram>(thd, this); }
};
@@ -374,7 +374,7 @@ public:
return name;
}
table_map not_null_tables() const override { return 0; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_concat_ws>(thd, this); }
};
@@ -390,7 +390,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("reverse") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_reverse>(thd, this); }
};
@@ -416,7 +416,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("replace") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_replace>(thd, this); }
};
@@ -441,7 +441,7 @@ public:
print_sql_mode_qualified_name(str, query_type);
print_args_parenthesized(str, query_type);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_replace_oracle>(thd, this); }
};
@@ -481,7 +481,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_replace") };
return name;
}
Item *get_copy(THD *thd) override { return 0;}
Item *do_get_copy(THD *thd) const override { return 0;}
};
@@ -526,7 +526,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_substr") };
return name;
}
Item *get_copy(THD *thd) override { return 0; }
Item *do_get_copy(THD *thd) const override { return 0; }
};
@@ -544,7 +544,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("insert") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_insert>(thd, this); }
};
@@ -571,7 +571,7 @@ public:
return name;
}
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_lcase>(thd, this); }
};
@@ -585,7 +585,7 @@ public:
return name;
}
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ucase>(thd, this); }
};
@@ -603,7 +603,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("left") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_left>(thd, this); }
};
@@ -620,7 +620,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("right") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_right>(thd, this); }
};
@@ -649,7 +649,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("substr") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_substr>(thd, this); }
};
@@ -685,7 +685,7 @@ public:
print_sql_mode_qualified_name(str, query_type);
print_args_parenthesized(str, query_type);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_substr_oracle>(thd, this); }
};
@@ -702,7 +702,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("substring_index") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_substr_index>(thd, this); }
};
@@ -745,7 +745,7 @@ public:
}
void print(String *str, enum_query_type query_type) override;
virtual LEX_CSTRING mode_name() const { return { "both", 4}; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_trim>(thd, this); }
};
@@ -766,7 +766,7 @@ public:
set_maybe_null();
return res;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_trim_oracle>(thd, this); }
};
@@ -789,7 +789,7 @@ public:
}
LEX_CSTRING mode_name() const override
{ return { STRING_WITH_LEN("leading") }; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ltrim>(thd, this); }
};
@@ -810,7 +810,7 @@ public:
set_maybe_null();
return res;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_ltrim_oracle>(thd, this); }
};
@@ -829,7 +829,7 @@ public:
}
LEX_CSTRING mode_name() const override
{ return { STRING_WITH_LEN("trailing") }; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_rtrim>(thd, this); }
};
@@ -850,7 +850,7 @@ public:
set_maybe_null();
return res;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_rtrim_oracle>(thd, this); }
};
@@ -893,7 +893,7 @@ public:
}
static char *alloc(THD *thd, const char *password, size_t pass_len,
enum PW_Alg al);
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_password>(thd, this); }
};
@@ -920,7 +920,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("des_encrypt") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_des_encrypt>(thd, this); }
};
@@ -947,7 +947,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("des_decrypt") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_des_decrypt>(thd, this); }
};
@@ -992,7 +992,7 @@ public:
{
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_encrypt>(thd, this); }
};
@@ -1016,7 +1016,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("encode") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_encode>(thd, this); }
protected:
virtual void crypto_transform(String *);
@@ -1041,7 +1041,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("decode") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_decode>(thd, this); }
protected:
void crypto_transform(String *) override;
@@ -1087,7 +1087,7 @@ public:
}
const char *fully_qualified_func_name() const override
{ return "database()"; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_database>(thd, this); }
};
@@ -1115,7 +1115,7 @@ public:
base_flags&= ~item_base_t::MAYBE_NULL;
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sqlerrm>(thd, this); }
};
@@ -1153,7 +1153,7 @@ public:
{
return save_str_value_in_field(field, &str_value);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_user>(thd, this); }
};
@@ -1215,7 +1215,7 @@ public:
return mark_unsupported_function(fully_qualified_func_name(), arg,
VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_current_role>(thd, this); }
};
@@ -1232,7 +1232,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("soundex") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_soundex>(thd, this); }
};
@@ -1250,7 +1250,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("elt") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_elt>(thd, this); }
};
@@ -1268,7 +1268,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("make_set") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_make_set>(thd, this); }
};
@@ -1289,7 +1289,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("format") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_format>(thd, this); }
};
@@ -1318,7 +1318,7 @@ public:
return name;
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_char>(thd, this); }
};
@@ -1338,7 +1338,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("chr") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_chr>(thd, this); }
};
@@ -1355,7 +1355,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("repeat") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_repeat>(thd, this); }
};
@@ -1371,7 +1371,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("space") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_space>(thd, this); }
};
@@ -1392,7 +1392,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_binlog_gtid_pos>(thd, this); }
};
@@ -1434,7 +1434,7 @@ public:
return name;
}
Sql_mode_dependency value_depends_on_sql_mode() const override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_rpad>(thd, this); }
};
@@ -1468,7 +1468,7 @@ public:
print_sql_mode_qualified_name(str, query_type);
print_args_parenthesized(str, query_type);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_rpad_oracle>(thd, this); }
};
@@ -1494,7 +1494,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("lpad") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_lpad>(thd, this); }
};
@@ -1528,7 +1528,7 @@ public:
print_sql_mode_qualified_name(str, query_type);
print_args_parenthesized(str, query_type);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_lpad_oracle>(thd, this); }
};
@@ -1551,7 +1551,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_conv>(thd, this); }
};
@@ -1601,7 +1601,7 @@ public:
fix_char_length(char_length);
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_hex>(thd, this); }
};
@@ -1627,7 +1627,7 @@ public:
max_length=(1+args[0]->max_length)/2;
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_unhex>(thd, this); }
};
@@ -1666,7 +1666,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("like_range_min") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_like_range_min>(thd, this); }
};
@@ -1681,7 +1681,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("like_range_max") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_like_range_max>(thd, this); }
};
#endif
@@ -1713,7 +1713,7 @@ public:
return name;
}
bool need_parentheses_in_default() override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_binary>(thd, this); }
};
@@ -1740,7 +1740,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_load_file>(thd, this); }
};
@@ -1761,7 +1761,7 @@ class Item_func_export_set: public Item_str_func
static LEX_CSTRING name= {STRING_WITH_LEN("export_set") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_export_set>(thd, this); }
};
@@ -1788,7 +1788,7 @@ public:
max_length= (uint32) MY_MIN(max_result_length, MAX_BLOB_WIDTH);
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_quote>(thd, this); }
};
@@ -1884,7 +1884,7 @@ public:
return name;
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_conv_charset>(thd, this); }
int save_in_field(Field*, bool) override;
};
@@ -1912,7 +1912,7 @@ public:
return args[0]->field_for_view_update();
}
bool need_parentheses_in_default() override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_set_collation>(thd, this); }
};
@@ -1947,7 +1947,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("charset") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_charset>(thd, this); }
};
@@ -1963,7 +1963,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("collation") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_collation>(thd, this); }
};
@@ -2003,7 +2003,7 @@ public:
override
{ return this; }
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_weight_string>(thd, this); }
};
@@ -2022,7 +2022,7 @@ public:
}
bool fix_length_and_dec() override { max_length=10; return FALSE; }
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_crc32>(thd, this); }
};
@@ -2043,7 +2043,7 @@ public:
set_maybe_null();
return FALSE; }
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_uncompressed_length>(thd, this); }
};
@@ -2070,7 +2070,7 @@ public:
return name;
}
String *val_str(String *) override ZLIB_DEPENDED_FUNCTION
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_compress>(thd, this); }
};
@@ -2092,7 +2092,7 @@ public:
return name;
}
String *val_str(String *) override ZLIB_DEPENDED_FUNCTION
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_uncompress>(thd, this); }
};
@@ -2126,7 +2126,7 @@ Item_func_uuid(THD *thd, bool without_separators_arg): Item_str_func(thd),
return mark_unsupported_function(func_name(), "()", arg,
VCOL_NON_DETERMINISTIC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_uuid>(thd, this); }
};
@@ -2153,7 +2153,7 @@ public:
String *val_str(String *) override;
void print(String *str, enum_query_type query_type) override;
enum Functype functype() const override { return DYNCOL_FUNC; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dyncol_create>(thd, this); }
};
@@ -2171,7 +2171,7 @@ public:
}
String *val_str(String *) override;
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dyncol_add>(thd, this); }
};
@@ -2193,7 +2193,7 @@ public:
decimals= 0;
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dyncol_json>(thd, this); }
};
@@ -2243,7 +2243,7 @@ public:
bool get_dyn_value(THD *thd, DYNAMIC_COLUMN_VALUE *val, String *tmp);
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_dyncol_get>(thd, this); }
};
@@ -2265,7 +2265,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dyncol_list>(thd, this); }
};
@@ -2291,7 +2291,7 @@ public:
return name;
}
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_temptable_rowid>(thd, this); }
};
#ifdef WITH_WSREP
@@ -2315,7 +2315,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_wsrep_last_written_gtid>(thd, this); }
};
@@ -2336,7 +2336,7 @@ public:
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_wsrep_last_seen_gtid>(thd, this); }
};
@@ -2354,7 +2354,7 @@ public:
return name;
}
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_wsrep_sync_wait_upto>(thd, this); }
};
#endif /* WITH_WSREP */

View File

@@ -42,6 +42,7 @@
#include "sql_parse.h" // check_stack_overrun
#include "sql_cte.h"
#include "sql_test.h"
#include "my_json_writer.h"
double get_post_group_estimate(JOIN* join, double join_op_rows);
@@ -196,6 +197,7 @@ void Item_in_subselect::cleanup()
in_strategy&= ~SUBS_STRATEGY_CHOSEN;
*/
first_execution= TRUE;
materialization_tracker= NULL;
pushed_cond_guards= NULL;
Item_subselect::cleanup();
DBUG_VOID_RETURN;
@@ -1639,6 +1641,7 @@ Item_in_subselect::Item_in_subselect(THD *thd, Item * left_exp,
st_select_lex *select_lex):
Item_exists_subselect(thd), left_expr_cache(0), first_execution(TRUE),
in_strategy(SUBS_NOT_TRANSFORMED),
materialization_tracker(NULL),
pushed_cond_guards(NULL), do_not_convert_to_sj(FALSE), is_jtbm_merged(FALSE),
is_jtbm_const_tab(FALSE), is_flattenable_semijoin(FALSE),
is_registered_semijoin(FALSE),
@@ -3686,6 +3689,26 @@ bool Item_in_subselect::init_cond_guards()
return FALSE;
}
/**
Initialize the tracker which will be used to provide information for
the output of EXPLAIN and ANALYZE
*/
void Item_in_subselect::init_subq_materialization_tracker(THD *thd)
{
if (test_strategy(SUBS_MATERIALIZATION | SUBS_PARTIAL_MATCH_ROWID_MERGE |
SUBS_PARTIAL_MATCH_TABLE_SCAN))
{
Explain_query *qw= thd->lex->explain;
DBUG_ASSERT(qw);
Explain_node *node= qw->get_node(unit->first_select()->select_number);
if (!node)
return;
node->subq_materialization= new(qw->mem_root)
Explain_subq_materialization(qw->mem_root);
materialization_tracker= node->subq_materialization->get_tracker();
}
}
bool
Item_allany_subselect::select_transformer(JOIN *join)
@@ -4284,12 +4307,14 @@ int subselect_uniquesubquery_engine::exec()
empty_result_set= TRUE;
table->status= 0;
Item_in_subselect *in_subs= item->get_IN_subquery();
Subq_materialization_tracker *tracker= in_subs->get_materialization_tracker();
DBUG_ASSERT(in_subs);
DBUG_ASSERT(thd);
if (!tab->preread_init_done && tab->preread_init())
DBUG_RETURN(1);
if (tracker)
tracker->increment_loops_count();
if (in_subs->left_expr_has_null())
{
/*
@@ -5043,6 +5068,9 @@ subselect_hash_sj_engine::choose_partial_match_strategy(
partial_match_key_parts_arg);
if (pm_buff_size > thd->variables.rowid_merge_buff_size)
strategy= PARTIAL_MATCH_SCAN;
else
item->get_IN_subquery()->get_materialization_tracker()->
report_partial_match_buffer_size(pm_buff_size);
}
}
@@ -5820,6 +5848,7 @@ int subselect_hash_sj_engine::exec()
}
}
item_in->get_materialization_tracker()->report_exec_strategy(strategy);
if (pm_engine)
lookup_engine= pm_engine;
item_in->change_engine(lookup_engine);
@@ -6302,6 +6331,9 @@ int subselect_partial_match_engine::exec()
DBUG_ASSERT(!(item_in->left_expr_has_null() &&
item_in->is_top_level_item()));
Subq_materialization_tracker *tracker= item_in->get_materialization_tracker();
tracker->increment_loops_count();
if (!item_in->left_expr_has_null())
{
/* Try to find a matching row by index lookup. */
@@ -6315,6 +6347,7 @@ int subselect_partial_match_engine::exec()
else
{
/* Search for a complete match. */
tracker->increment_index_lookups();
if ((lookup_res= lookup_engine->index_lookup()))
{
/* An error occurred during lookup(). */
@@ -6359,6 +6392,7 @@ int subselect_partial_match_engine::exec()
if (tmp_table->file->inited)
tmp_table->file->ha_index_end();
tracker->increment_partial_matches();
if (partial_match())
{
/* The result of IN is UNKNOWN. */
@@ -6566,6 +6600,8 @@ subselect_rowid_merge_engine::init(MY_BITMAP *non_null_key_parts,
0, 0))
return TRUE;
item->get_IN_subquery()->get_materialization_tracker()->
report_partial_merge_keys(merge_keys, merge_keys_count);
return FALSE;
}
@@ -7024,3 +7060,12 @@ void Item_subselect::init_expr_cache_tracker(THD *thd)
DBUG_ASSERT(expr_cache->type() == Item::EXPR_CACHE_ITEM);
node->cache_tracker= ((Item_cache_wrapper *)expr_cache)->init_tracker(qw->mem_root);
}
void Subq_materialization_tracker::report_partial_merge_keys(
Ordered_key **merge_keys, uint merge_keys_count)
{
partial_match_array_sizes.resize(merge_keys_count, 0);
for (uint i= 0; i < merge_keys_count; i++)
partial_match_array_sizes[i]= merge_keys[i]->get_key_buff_elements();
}

View File

@@ -18,6 +18,7 @@
/* subselect Item */
#include "item.h"
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
@@ -43,6 +44,8 @@ typedef class st_select_lex SELECT_LEX;
*/
typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
class Cached_item;
class Subq_materialization_tracker;
class Explain_subq_materialization;
/* base class for subselects */
@@ -274,8 +277,8 @@ public:
void register_as_with_rec_ref(With_element *with_elem);
void init_expr_cache_tracker(THD *thd);
Item* build_clone(THD *thd) override { return 0; }
Item* get_copy(THD *thd) override { return 0; }
Item* do_build_clone(THD *thd) const override { return nullptr; }
Item *do_get_copy(THD *thd) const override { return 0; }
st_select_lex *wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl);
@@ -498,6 +501,8 @@ protected:
bool was_null;
/* A bitmap of possible execution strategies for an IN predicate. */
uchar in_strategy;
/* Tracker collecting execution parameters of a materialized subquery */
Subq_materialization_tracker *materialization_tracker;
protected:
/* Used to trigger on/off conditions that were pushed down to subselect */
bool *pushed_cond_guards;
@@ -522,6 +527,7 @@ protected:
left_expr could later be changed to something on the execution arena.
*/
Item *left_expr_orig;
public:
/* Priority of this predicate in the convert-to-semi-join-nest process. */
int sj_convert_priority;
@@ -623,7 +629,7 @@ public:
Item_in_subselect(THD *thd_arg, Item * left_expr, st_select_lex *select_lex);
Item_in_subselect(THD *thd_arg):
Item_exists_subselect(thd_arg), left_expr_cache(0), first_execution(TRUE),
in_strategy(SUBS_NOT_TRANSFORMED),
in_strategy(SUBS_NOT_TRANSFORMED), materialization_tracker(NULL),
pushed_cond_guards(NULL), func(NULL), do_not_convert_to_sj(FALSE),
is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE), upper_item(0),
converted_from_in_predicate(FALSE) {}
@@ -775,6 +781,9 @@ public:
{ return left_expr; }
inline Item* left_exp_orig() const
{ return left_expr_orig; }
void init_subq_materialization_tracker(THD *thd);
Subq_materialization_tracker *get_materialization_tracker() const
{ return materialization_tracker; }
friend class Item_ref_null_helper;
friend class Item_is_not_null_test;
@@ -1159,6 +1168,15 @@ public:
select_result_interceptor *result,
bool temp= FALSE) override;
bool no_tables() const override;//=>base class
/* Possible execution strategies that can be used to compute hash semi-join.*/
enum exec_strategy {
UNDEFINED= 0,
COMPLETE_MATCH, /* Use regular index lookups. */
PARTIAL_MATCH, /* Use some partial matching strategy. */
PARTIAL_MATCH_MERGE, /* Use partial matching through index merging. */
PARTIAL_MATCH_SCAN, /* Use partial matching through table scan. */
IMPOSSIBLE /* Subquery materialization is not applicable. */
};
protected:
/* The engine used to compute the IN predicate. */
@@ -1170,15 +1188,6 @@ protected:
uint count_partial_match_columns;
uint count_null_only_columns;
uint count_columns_with_nulls;
/* Possible execution strategies that can be used to compute hash semi-join.*/
enum exec_strategy {
UNDEFINED,
COMPLETE_MATCH, /* Use regular index lookups. */
PARTIAL_MATCH, /* Use some partial matching strategy. */
PARTIAL_MATCH_MERGE, /* Use partial matching through index merging. */
PARTIAL_MATCH_SCAN, /* Use partial matching through table scan. */
IMPOSSIBLE /* Subquery materialization is not applicable. */
};
/* The chosen execution strategy. Computed after materialization. */
exec_strategy strategy;
exec_strategy get_strategy_using_schema();
@@ -1311,6 +1320,7 @@ public:
rownum_t get_max_null_row() { return max_null_row; }
MY_BITMAP * get_null_key() { return &null_key; }
ha_rows get_null_count() { return null_count; }
ha_rows get_key_buff_elements() { return key_buff_elements; }
/*
Get the search key element that corresponds to the i-th key part of this
index.
@@ -1551,4 +1561,93 @@ public:
void cleanup() override;
enum_engine_type engine_type() override { return TABLE_SCAN_ENGINE; }
};
/**
@brief Subquery materialization tracker
@details
Used to track various parameters of the materialized subquery execution,
such as the execution strategy, sizes of buffers employed, etc
*/
class Subq_materialization_tracker
{
public:
using Strategy = subselect_hash_sj_engine::exec_strategy;
Subq_materialization_tracker(MEM_ROOT *mem_root)
: exec_strategy(Strategy::UNDEFINED),
partial_match_buffer_size(0),
partial_match_array_sizes(mem_root),
loops_count(0),
index_lookups_count(0),
partial_matches_count(0)
{}
void report_partial_merge_keys(Ordered_key **merge_keys,
uint merge_keys_count);
void report_exec_strategy(Strategy es)
{
exec_strategy= es;
}
void report_partial_match_buffer_size(longlong sz)
{
partial_match_buffer_size= sz;
}
void increment_loops_count()
{
loops_count++;
}
void increment_index_lookups()
{
index_lookups_count++;
}
void increment_partial_matches()
{
partial_matches_count++;
}
void print_json_members(Json_writer *writer) const;
private:
Strategy exec_strategy;
ulonglong partial_match_buffer_size;
Dynamic_array<ha_rows> partial_match_array_sizes;
/* Number of times subquery predicate was evaluated */
ulonglong loops_count;
/*
Number of times we made a lookup in the materialized temptable
(we do this when all parts of left_expr are not NULLs)
*/
ulonglong index_lookups_count;
/*
Number of times we had to check for a partial match (either by
scanning the materialized subquery or by doing a merge)
*/
ulonglong partial_matches_count;
const char *get_exec_strategy() const
{
switch (exec_strategy)
{
case Strategy::UNDEFINED:
return "undefined";
case Strategy::COMPLETE_MATCH:
return "index_lookup";
case Strategy::PARTIAL_MATCH_MERGE:
return "index_lookup;array merge for partial match";
case Strategy::PARTIAL_MATCH_SCAN:
return "index_lookup;full scan for partial match";
default:
return "unsupported";
}
}
};
#endif /* ITEM_SUBSELECT_INCLUDED */

View File

@@ -866,7 +866,7 @@ public:
}
Item *copy_or_same(THD* thd) override;
void remove() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_sum>(thd, this); }
bool supports_removal() const override
@@ -941,7 +941,7 @@ public:
return has_with_distinct() ? name_distinct : name_normal;
}
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_count>(thd, this); }
bool supports_removal() const override
@@ -999,7 +999,7 @@ public:
count= 0;
Item_sum_sum::cleanup();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_avg>(thd, this); }
bool supports_removal() const override
@@ -1088,7 +1088,7 @@ public:
m_stddev= Stddev();
Item_sum_double::cleanup();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_variance>(thd, this); }
};
@@ -1114,7 +1114,7 @@ class Item_sum_std final :public Item_sum_variance
return sample ? stddev_samp_name : std_name;
}
Item *copy_or_same(THD* thd) override final;
Item *get_copy(THD *thd) override final
Item *do_get_copy(THD *thd) const override final
{ return get_item_copy<Item_sum_std>(thd, this); }
};
@@ -1217,7 +1217,7 @@ public:
return sum_name;
}
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_min>(thd, this); }
};
@@ -1236,7 +1236,7 @@ public:
return sum_name;
}
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_max>(thd, this); }
};
@@ -1329,7 +1329,7 @@ public:
return sum_name;
}
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_or>(thd, this); }
private:
@@ -1350,7 +1350,7 @@ public:
return sum_min_name;
}
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_and>(thd, this); }
private:
@@ -1369,7 +1369,7 @@ public:
return sum_min_name;
}
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_xor>(thd, this); }
private:
@@ -1513,7 +1513,7 @@ public:
{
return sp_result_field;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_sp>(thd, this); }
Item *copy_or_same(THD *thd) override;
};
@@ -1579,8 +1579,9 @@ public:
String *val_str(String *str) override
{ return val_string_from_real(str); }
double val_real() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_avg_field_double>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -1609,8 +1610,9 @@ public:
return VDec(this).to_string_round(str, decimals);
}
my_decimal *val_decimal(my_decimal *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_avg_field_decimal>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -1631,8 +1633,9 @@ public:
bool is_null() override { update_null_value(); return null_value; }
const Type_handler *type_handler() const override
{ return &type_handler_double; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_variance_field>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -1644,8 +1647,9 @@ public:
{ }
enum Type type() const override { return FIELD_STD_ITEM; }
double val_real() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_std_field>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
@@ -1743,7 +1747,7 @@ class Item_sum_udf_float :public Item_udf_sum
bool fix_length_and_dec() override
{ fix_num_length_and_dec(); return FALSE; }
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_udf_float>(thd, this); }
};
@@ -1770,7 +1774,7 @@ public:
}
bool fix_length_and_dec() override { decimals=0; max_length=21; return FALSE; }
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_udf_int>(thd, this); }
};
@@ -1812,7 +1816,7 @@ public:
{ return string_type_handler(); }
bool fix_length_and_dec() override;
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_udf_str>(thd, this); }
};
@@ -1844,7 +1848,7 @@ public:
bool fix_length_and_dec() override
{ fix_num_length_and_dec(); return FALSE; }
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_udf_decimal>(thd, this); }
};
@@ -2104,7 +2108,7 @@ public:
void print(String *str, enum_query_type query_type) override;
bool change_context_processor(void *cntx) override
{ context= (Name_resolution_context *)cntx; return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_group_concat>(thd, this); }
qsort_cmp2 get_comparator_function_for_distinct();
qsort_cmp2 get_comparator_function_for_order_by();

View File

@@ -67,7 +67,7 @@ public:
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_period_add>(thd, this); }
};
@@ -90,7 +90,7 @@ public:
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
return FALSE;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_period_diff>(thd, this); }
};
@@ -120,7 +120,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_to_days>(thd, this); }
};
@@ -153,7 +153,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_to_seconds>(thd, this); }
};
@@ -181,7 +181,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dayofmonth>(thd, this); }
};
@@ -210,7 +210,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_month>(thd, this); }
};
@@ -236,7 +236,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_monthname>(thd, this); }
};
@@ -264,7 +264,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dayofyear>(thd, this); }
};
@@ -292,7 +292,7 @@ public:
{
return !has_time_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_hour>(thd, this); }
};
@@ -320,7 +320,7 @@ public:
{
return !has_time_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_minute>(thd, this); }
};
@@ -348,7 +348,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_quarter>(thd, this); }
};
@@ -376,7 +376,7 @@ public:
{
return !has_time_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_second>(thd, this); }
};
@@ -414,7 +414,7 @@ public:
{
return arg_count == 2;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_week>(thd, this); }
};
@@ -447,7 +447,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_yearweek>(thd, this); }
};
@@ -477,7 +477,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_year>(thd, this); }
};
@@ -512,7 +512,7 @@ public:
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_weekday>(thd, this); }
};
@@ -539,7 +539,7 @@ class Item_func_dayname :public Item_str_func
{
return !has_date_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_dayname>(thd, this); }
};
@@ -608,7 +608,7 @@ public:
}
longlong int_op() override;
my_decimal *decimal_op(my_decimal* buf) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_unix_timestamp>(thd, this); }
};
@@ -636,7 +636,7 @@ public:
}
longlong int_op() override;
my_decimal *decimal_op(my_decimal* buf) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_time_to_sec>(thd, this); }
};
@@ -744,7 +744,7 @@ public:
return name;
}
void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_curtime_local>(thd, this); }
};
@@ -759,7 +759,7 @@ public:
return name;
}
void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_curtime_utc>(thd, this); }
};
@@ -791,7 +791,7 @@ public:
return name;
}
void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_curdate_local>(thd, this); }
};
@@ -806,7 +806,7 @@ public:
return name;
}
void store_now_in_TIME(THD* thd, MYSQL_TIME *now_time) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_curdate_utc>(thd, this); }
};
@@ -849,7 +849,7 @@ public:
int save_in_field(Field *field, bool no_conversions) override;
void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override;
enum Functype functype() const override { return NOW_FUNC; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_now_local>(thd, this); }
};
@@ -870,7 +870,7 @@ public:
return mark_unsupported_function(func_name(), "()", arg,
VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_now_utc>(thd, this); }
};
@@ -898,7 +898,7 @@ public:
VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC);
}
enum Functype functype() const override { return SYSDATE_FUNC; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sysdate_local>(thd, this); }
};
@@ -921,7 +921,7 @@ public:
{
return has_date_args() || has_time_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_from_days>(thd, this); }
};
@@ -958,7 +958,7 @@ public:
return false;
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_date_format>(thd, this); }
};
@@ -973,7 +973,7 @@ public:
return name;
}
bool check_vcol_func_processor(void *arg) override { return false; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_time_format>(thd, this); }
};
@@ -1027,7 +1027,7 @@ public:
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_tochar>(thd, this); }
};
@@ -1050,7 +1050,7 @@ class Item_func_from_unixtime :public Item_datetimefunc
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_from_unixtime>(thd, this); }
};
@@ -1100,7 +1100,7 @@ class Item_func_convert_tz :public Item_datetimefunc
}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
void cleanup() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_convert_tz>(thd, this); }
};
@@ -1123,7 +1123,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("sec_to_time") };
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_sec_to_time>(thd, this); }
};
@@ -1147,7 +1147,7 @@ public:
void print(String *str, enum_query_type query_type) override;
enum precedence precedence() const override { return INTERVAL_PRECEDENCE; }
bool need_parentheses_in_default() override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_date_add_interval>(thd, this); }
};
@@ -1259,7 +1259,7 @@ class Item_extract :public Item_int_func,
}
return true;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_extract>(thd, this); }
};
@@ -1306,7 +1306,7 @@ public:
}
void print(String *str, enum_query_type query_type) override;
bool need_parentheses_in_default() override { return true; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_char_typecast>(thd, this); }
};
@@ -1347,7 +1347,7 @@ public:
{
return args[0]->type_handler()->Item_date_typecast_fix_length_and_dec(this);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_date_typecast>(thd, this); }
};
@@ -1373,7 +1373,7 @@ public:
Item_time_typecast_fix_length_and_dec(this);
}
Sql_mode_dependency value_depends_on_sql_mode() const override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_time_typecast>(thd, this); }
};
@@ -1399,7 +1399,7 @@ public:
Item_datetime_typecast_fix_length_and_dec(this);
}
Sql_mode_dependency value_depends_on_sql_mode() const override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_datetime_typecast>(thd, this); }
};
@@ -1417,7 +1417,7 @@ public:
return name;
}
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_makedate>(thd, this); }
};
@@ -1459,7 +1459,7 @@ public:
return (null_value= Sec6_add(dt.get_mysql_time(), it.get_mysql_time(), 1).
to_datetime(ltime));
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_timestamp>(thd, this); }
};
@@ -1491,7 +1491,7 @@ public:
static LEX_CSTRING subtime= { STRING_WITH_LEN("subtime") };
return sign > 0 ? addtime : subtime;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_add_time>(thd, this); }
};
@@ -1517,7 +1517,7 @@ public:
return FALSE;
}
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_timediff>(thd, this); }
};
@@ -1544,7 +1544,7 @@ public:
return name;
}
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_maketime>(thd, this); }
};
@@ -1572,7 +1572,7 @@ public:
{
return !has_time_args();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_microsecond>(thd, this); }
};
@@ -1601,7 +1601,7 @@ public:
return FALSE;
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_timestamp_diff>(thd, this); }
};
@@ -1632,7 +1632,7 @@ public:
return FALSE;
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_get_format>(thd, this); }
};
@@ -1656,7 +1656,7 @@ public:
return name;
}
bool fix_length_and_dec() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_str_to_date>(thd, this); }
};
@@ -1673,7 +1673,7 @@ public:
return name;
}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_last_day>(thd, this); }
};

View File

@@ -49,7 +49,7 @@ public:
return name;
}
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_history>(thd, this); }
};
@@ -65,7 +65,7 @@ public:
return (trt_field == TR_table::FLD_BEGIN_TS) ? begin_name : commit_name;
}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_trt_ts>(thd, this); }
bool fix_length_and_dec() override
{ fix_attributes_datetime(decimals); return FALSE; }
@@ -110,7 +110,7 @@ public:
}
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_trt_id>(thd, this); }
};
@@ -127,7 +127,7 @@ public:
return name;
}
longlong val_int() override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_trt_trx_sees>(thd, this); }
};

View File

@@ -150,7 +150,7 @@ public:
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_row_number>(thd, this); }
};
@@ -225,7 +225,7 @@ public:
}
Item_sum_int::cleanup();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_rank>(thd, this); }
};
@@ -298,7 +298,7 @@ class Item_sum_dense_rank: public Item_sum_int
}
Item_sum_int::cleanup();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_dense_rank>(thd, this); }
};
@@ -362,7 +362,7 @@ class Item_sum_first_value : public Item_sum_hybrid_simple
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_first_value>(thd, this); }
};
@@ -389,7 +389,7 @@ class Item_sum_last_value : public Item_sum_hybrid_simple
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_last_value>(thd, this); }
};
@@ -411,7 +411,7 @@ class Item_sum_nth_value : public Item_sum_hybrid_simple
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_nth_value>(thd, this); }
};
@@ -433,7 +433,7 @@ class Item_sum_lead : public Item_sum_hybrid_simple
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_lead>(thd, this); }
};
@@ -455,7 +455,7 @@ class Item_sum_lag : public Item_sum_hybrid_simple
return name;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_lag>(thd, this); }
};
@@ -570,7 +570,7 @@ class Item_sum_percent_rank: public Item_sum_double,
Partition_row_count::set_partition_row_count(count);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_percent_rank>(thd, this); }
private:
@@ -658,7 +658,7 @@ class Item_sum_cume_dist: public Item_sum_double,
Partition_row_count::set_partition_row_count(count);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_cume_dist>(thd, this); }
};
@@ -735,7 +735,7 @@ class Item_sum_ntile : public Item_sum_int,
Partition_row_count::set_partition_row_count(count);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_ntile>(thd, this); }
private:
@@ -899,7 +899,7 @@ public:
Partition_row_count::set_partition_row_count(count);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_percentile_disc>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec) override;
void setup_hybrid(THD *thd, Item *item);
@@ -1036,7 +1036,7 @@ public:
Partition_row_count::set_partition_row_count(count);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_sum_percentile_cont>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec) override;
void setup_hybrid(THD *thd, Item *item);
@@ -1391,7 +1391,7 @@ public:
void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) override { return 0; }
Item *do_get_copy(THD *thd) const override { return 0; }
};

View File

@@ -221,7 +221,7 @@ public:
return { STRING_WITH_LEN("xpath_rootelement") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_rootelement>(thd, this); }
};
@@ -237,7 +237,7 @@ public:
return { STRING_WITH_LEN("xpath_union") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_union>(thd, this); }
};
@@ -277,7 +277,7 @@ public:
return { STRING_WITH_LEN("xpath_selfbyname") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_selfbyname>(thd, this); }
};
@@ -294,7 +294,7 @@ public:
return { STRING_WITH_LEN("xpath_childbyname") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_childbyname>(thd, this); }
};
@@ -313,7 +313,7 @@ public:
return { STRING_WITH_LEN("xpath_descendantbyname") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_descendantbyname>(thd, this); }
};
@@ -332,7 +332,7 @@ public:
return { STRING_WITH_LEN("xpath_ancestorbyname") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_ancestorbyname>(thd, this); }
};
@@ -350,7 +350,7 @@ public:
return { STRING_WITH_LEN("xpath_parentbyname") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_parentbyname>(thd, this); }
};
@@ -367,7 +367,7 @@ public:
return { STRING_WITH_LEN("xpath_attributebyname") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_attributebyname>(thd, this); }
};
@@ -387,7 +387,7 @@ public:
return { STRING_WITH_LEN("xpath_predicate") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_predicate>(thd, this); }
};
@@ -403,7 +403,7 @@ public:
return { STRING_WITH_LEN("xpath_elementbyindex") };
}
bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_func_elementbyindex>(thd, this); }
};
@@ -434,7 +434,7 @@ public:
}
return args[0]->val_real() ? 1 : 0;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_xpath_cast_bool>(thd, this); }
};
@@ -451,7 +451,7 @@ public:
return { STRING_WITH_LEN("xpath_cast_number") };
}
double val_real() override { return args[0]->val_real(); }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_xpath_cast_number>(thd, this); }
};
@@ -471,7 +471,7 @@ public:
}
bool fix_length_and_dec() override
{ max_length= MAX_BLOB_WIDTH; return FALSE; }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_context_cache>(thd, this); }
};
@@ -495,7 +495,7 @@ public:
return tmp_native_value.element(0).pos + 1;
return 0;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_xpath_position>(thd, this); }
};
@@ -521,7 +521,7 @@ public:
return predicate_supplied_context_size;
return tmp_native_value.elements();
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_xpath_count>(thd, this); }
};
@@ -569,7 +569,7 @@ public:
}
return sum;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_xpath_sum>(thd, this); }
};
@@ -654,7 +654,7 @@ public:
}
return 0;
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_nodeset_to_const_comparator>(thd, this); }
};

View File

@@ -137,7 +137,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_xml_extractvalue>(thd, this); }
};
@@ -158,7 +158,7 @@ public:
return name;
}
String *val_str(String *) override;
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_func_xml_update>(thd, this); }
};

View File

@@ -862,6 +862,7 @@ typedef struct st_print_event_info
uint lc_time_names_number;
uint charset_database_number;
uint verbose;
uchar gtid_ev_flags2;
uint32 flags2;
uint32 server_id;
uint32 domain_id;
@@ -933,6 +934,8 @@ typedef struct st_print_event_info
copy_event_cache_to_file_and_reinit(&body_cache, file);
fflush(file);
}
my_bool is_xa_trans();
} PRINT_EVENT_INFO;
#endif // MYSQL_CLIENT
@@ -2194,7 +2197,7 @@ public: /* !!! Public in this patch to allow old usage */
If true, the event always be applied by slave SQL thread or be printed by
mysqlbinlog
*/
bool is_trans_keyword()
bool is_trans_keyword(bool is_xa)
{
/*
Before the patch for bug#50407, The 'SAVEPOINT and ROLLBACK TO'
@@ -2207,10 +2210,11 @@ public: /* !!! Public in this patch to allow old usage */
but we don't handle these cases and after the patch, both quiries are
binlogged in upper case with no comments.
*/
return !strncmp(query, "BEGIN", q_len) ||
!strncmp(query, "COMMIT", q_len) ||
!strncasecmp(query, "SAVEPOINT", 9) ||
!strncasecmp(query, "ROLLBACK", 8);
return is_xa ? !strncasecmp(query, C_STRING_WITH_LEN("XA "))
: (!strncmp(query, "BEGIN", q_len) ||
!strncmp(query, "COMMIT", q_len) ||
!strncasecmp(query, "SAVEPOINT", 9) ||
!strncasecmp(query, "ROLLBACK", 8));
}
virtual bool is_begin() { return !strcmp(query, "BEGIN"); }
virtual bool is_commit() { return !strcmp(query, "COMMIT"); }

View File

@@ -1837,7 +1837,7 @@ bool Query_log_event::print_query_header(IO_CACHE* file,
if ((flags & LOG_EVENT_SUPPRESS_USE_F))
{
if (!is_trans_keyword())
if (!is_trans_keyword(print_event_info->is_xa_trans()))
print_event_info->db[0]= '\0';
}
else if (db)
@@ -3769,6 +3769,7 @@ st_print_event_info::st_print_event_info()
bzero(time_zone_str, sizeof(time_zone_str));
delimiter[0]= ';';
delimiter[1]= 0;
gtid_ev_flags2= 0;
flags2_inited= 0;
flags2= 0;
sql_mode_inited= 0;
@@ -3802,6 +3803,11 @@ st_print_event_info::st_print_event_info()
#endif
}
my_bool st_print_event_info::is_xa_trans()
{
return (gtid_ev_flags2 &
(Gtid_log_event::FL_PREPARED_XA | Gtid_log_event::FL_COMPLETED_XA));
}
bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_STRING *to)
{
@@ -3913,6 +3919,8 @@ Gtid_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
goto err;
}
print_event_info->gtid_ev_flags2= flags2;
return cache.flush_data();
err:
return 1;

View File

@@ -1447,7 +1447,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
is created we create tables with thd->variables.wsrep_on=false
to avoid replicating wsrep_schema tables to other nodes.
*/
if (WSREP_ON && !is_trans_keyword())
if (WSREP_ON && !is_trans_keyword(false))
{
thd->wsrep_PA_safe= false;
}
@@ -1725,7 +1725,11 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
::do_apply_event(), then the companion SET also have so
we don't need to reset_one_shot_variables().
*/
if (is_trans_keyword() || rpl_filter->db_ok(thd->db.str))
if (rpl_filter->is_db_empty() ||
is_trans_keyword(
(rgi->gtid_ev_flags2 & (Gtid_log_event::FL_PREPARED_XA |
Gtid_log_event::FL_COMPLETED_XA))) ||
rpl_filter->db_ok(thd->db.str))
{
#ifdef WITH_WSREP
if (!wsrep_thd_is_applying(thd))
@@ -2049,6 +2053,16 @@ compare_errors:
actual_error == ER_CONNECTION_KILLED)
thd->reset_killed();
}
else if (actual_error == ER_XAER_NOTA && !rpl_filter->db_ok(get_db()))
{
/*
If there is an XA query whos XID cannot be found, if the replication
filter is active and filters the target database, assume that the XID
cache has been cleared (e.g. by server restart) since it was prepared,
so we can just ignore this event.
*/
thd->clear_error(1);
}
/*
Other cases: mostly we expected no error and get one.
*/

View File

@@ -70,7 +70,7 @@ public:
{
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
}
Item* get_copy(THD *thd) override { return 0; }
Item* do_get_copy(THD *thd) const override { return 0; }
};
class Item_proc_real :public Item_proc
@@ -125,6 +125,8 @@ public:
{ s->set(value, default_charset()); return s; }
my_decimal *val_decimal(my_decimal *) override;
unsigned int size_of() { return sizeof(*this);}
Item *do_get_copy(THD *thd) const override { return nullptr; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
};
@@ -165,6 +167,8 @@ public:
my_decimal *val_decimal(my_decimal *) override;
void cleanup() override { value.free(); }
unsigned int size_of() { return sizeof(*this);}
Item *do_get_copy(THD *thd) const override { return nullptr; }
Item *do_build_clone(THD *thd) const override { return nullptr; }
};
/* The procedure class definitions */

View File

@@ -268,6 +268,13 @@ Rpl_filter::is_on()
}
bool
Rpl_filter::is_db_empty()
{
return do_db.is_empty() && ignore_db.is_empty();
}
/**
Parse and add the given comma-separated sequence of filter rules.

View File

@@ -56,6 +56,7 @@ public:
bool db_ok_with_wild_table(const char *db);
bool is_on();
bool is_db_empty();
/* Setters - add filtering rules */

View File

@@ -140,12 +140,24 @@ public:
DBUG_ASSERT(idx < array.elements);
return *(((Elem*)array.buffer) + idx);
}
/// Const variant of at(), which cannot change data
const Elem& at(size_t idx) const
{
return *(((Elem*)array.buffer) + idx);
}
Elem& operator[](size_t idx)
{
return at(idx);
}
/// Const variant of operator[]
const Elem& operator[](size_t idx) const
{
return at(idx);
}
/// @returns pointer to first element
Elem *front()
{

View File

@@ -24,6 +24,7 @@
#include "my_json_writer.h"
#include "opt_range.h"
#include "sql_expression_cache.h"
#include "item_subselect.h"
const char * STR_DELETING_ALL_ROWS= "Deleting all rows";
const char * STR_IMPOSSIBLE_WHERE= "Impossible WHERE";
@@ -785,6 +786,18 @@ bool Explain_node::print_explain_json_cache(Json_writer *writer,
}
bool Explain_node::print_explain_json_subq_materialization(Json_writer *writer,
bool is_analyze)
{
if (subq_materialization)
{
subq_materialization->print_explain_json(writer, is_analyze);
return true;
}
return false;
}
Explain_basic_join::~Explain_basic_join()
{
if (join_tabs)
@@ -932,6 +945,8 @@ void Explain_select::print_explain_json(Explain_query *query,
Json_writer_nesting_guard guard(writer);
bool started_cache= print_explain_json_cache(writer, is_analyze);
bool started_subq_mat= print_explain_json_subq_materialization(writer,
is_analyze);
if (message ||
select_type == pushed_derived_text ||
@@ -1035,6 +1050,8 @@ void Explain_select::print_explain_json(Explain_query *query,
writer->end_object();
}
if (started_subq_mat)
writer->end_object();
if (started_cache)
writer->end_object();
}
@@ -2758,3 +2775,41 @@ void Explain_range_checked_fer::print_json(Json_writer *writer,
writer->end_object();
}
}
void Explain_subq_materialization::print_explain_json(Json_writer *writer,
bool is_analyze)
{
writer->add_member("materialization").start_object();
if (is_analyze)
tracker.print_json_members(writer);
}
void Subq_materialization_tracker::print_json_members(Json_writer *writer) const
{
writer->add_member("r_strategy").add_str(get_exec_strategy());
if (loops_count)
writer->add_member("r_loops").add_ull(loops_count);
if (index_lookups_count)
writer->add_member("r_index_lookups").add_ull(index_lookups_count);
if (partial_matches_count)
writer->add_member("r_partial_matches").add_ull(partial_matches_count);
if (partial_match_buffer_size)
{
writer->add_member("r_partial_match_buffer_size").
add_size(partial_match_buffer_size);
}
if (partial_match_array_sizes.elements())
{
writer->add_member("r_partial_match_array_sizes").start_array();
for(size_t i= 0; i < partial_match_array_sizes.elements(); i++)
writer->add_ull(partial_match_array_sizes[i]);
writer->end_array();
}
}

View File

@@ -86,6 +86,7 @@ class Explain_node : public Sql_alloc
public:
Explain_node(MEM_ROOT *root) :
cache_tracker(NULL),
subq_materialization(NULL),
connection_type(EXPLAIN_NODE_OTHER),
children(root)
{}
@@ -115,6 +116,12 @@ public:
*/
Expression_cache_tracker* cache_tracker;
/**
If not NULL, this node is a SELECT (or UNION) in a materialized
IN-subquery.
*/
Explain_subq_materialization* subq_materialization;
/*
How this node is connected to its parent.
(NOTE: EXPLAIN_NODE_NON_MERGED_SJ is set very late currently)
@@ -143,6 +150,8 @@ public:
void print_explain_json_for_children(Explain_query *query,
Json_writer *writer, bool is_analyze);
bool print_explain_json_cache(Json_writer *writer, bool is_analyze);
bool print_explain_json_subq_materialization(Json_writer *writer,
bool is_analyze);
virtual ~Explain_node() = default;
};
@@ -1034,4 +1043,26 @@ public:
};
/*
EXPLAIN data structure for subquery materialization.
All decisions are made at execution time so here we just store the tracker
that has all the info.
*/
class Explain_subq_materialization : public Sql_alloc
{
public:
Explain_subq_materialization(MEM_ROOT *mem_root)
: tracker(mem_root)
{}
Subq_materialization_tracker *get_tracker() { return &tracker; }
void print_explain_json(Json_writer *writer, bool is_analyze);
private:
Subq_materialization_tracker tracker;
};
#endif //SQL_EXPLAIN_INCLUDED

View File

@@ -11007,7 +11007,10 @@ void mark_or_conds_to_avoid_pushdown(Item *cond)
(if cond is marked with MARKER_FULL_EXTRACTION or
cond is an AND condition and some of its parts are marked with
MARKER_FULL_EXTRACTION)
In this case condition is transformed and pushed into attach_to_conds
In this case condition is transformed with multiple_equality_transformer
transformer. It transforms all multiple equalities in the extracted
condition into the set of equalities.
After that the transformed condition is attached into attach_to_conds
list.
2. Part of some other condition c1 that can't be entirely pushed
(if с1 isn't marked with any flag).
@@ -11024,10 +11027,6 @@ void mark_or_conds_to_avoid_pushdown(Item *cond)
In this case build_pushable_cond() is called for c1.
This method builds a clone of the c1 part that can be pushed.
Transformation mentioned above is made with multiple_equality_transformer
transformer. It transforms all multiple equalities in the extracted
condition into the set of equalities.
@note
Conditions that can be pushed are collected in attach_to_conds in this way:
1. if cond is an AND condition its parts that can be pushed into WHERE

View File

@@ -537,10 +537,9 @@ public:
class Iterator;
using value_type= T;
using iterator= Iterator;
using const_iterator= const Iterator;
Iterator begin() const { return Iterator(first); }
Iterator end() const { return Iterator(); }
iterator begin() const { return iterator(first); }
iterator end() const { return iterator(); }
class Iterator
{
@@ -561,7 +560,7 @@ public:
return *this;
}
T operator++(int)
Iterator operator++(int)
{
Iterator tmp(*this);
operator++();

View File

@@ -7569,6 +7569,7 @@ __attribute__((optimize("-O0")))
#endif
check_stack_overrun(THD *thd, long margin, uchar *buf __attribute__((unused)))
{
#ifndef __SANITIZE_ADDRESS__
long stack_used;
DBUG_ASSERT(thd == current_thd);
if ((stack_used= available_stack_size(thd->thread_stack, &stack_used)) >=
@@ -7591,6 +7592,7 @@ check_stack_overrun(THD *thd, long margin, uchar *buf __attribute__((unused)))
#ifndef DBUG_OFF
max_stack_used= MY_MAX(max_stack_used, stack_used);
#endif
#endif /* __SANITIZE_ADDRESS__ */
return 0;
}

View File

@@ -1877,6 +1877,11 @@ bool JOIN::build_explain()
curr_tab->tracker= tmp->get_using_temporary_read_tracker();
}
}
if (is_in_subquery())
{
Item_in_subselect *subq= unit->item->get_IN_subquery();
subq->init_subq_materialization_tracker(thd);
}
DBUG_RETURN(0);
}
@@ -17312,7 +17317,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
if (can_change_cond_ref_to_const(func, right_item, left_item,
field_value_owner, field, value))
{
Item *tmp=value->clone_item(thd);
Item *tmp=value->clone_const_item(thd);
if (tmp)
{
tmp->collation.set(right_item->collation);
@@ -17342,7 +17347,7 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
else if (can_change_cond_ref_to_const(func, left_item, right_item,
field_value_owner, field, value))
{
Item *tmp= value->clone_item(thd);
Item *tmp= value->clone_const_item(thd);
if (tmp)
{
tmp->collation.set(left_item->collation);

View File

@@ -585,7 +585,7 @@ public:
LEX_CSTRING tmp= {Ptr, str_length};
return tmp;
}
inline LEX_CSTRING *get_value(LEX_CSTRING *res)
inline LEX_CSTRING *get_value(LEX_CSTRING *res) const
{
res->str= Ptr;
res->length= str_length;

View File

@@ -290,8 +290,9 @@ public:
str->append(tmp);
str->append('\'');
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_literal_fbt>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
// Non-overriding methods
void set_value(const Fbt &value)
@@ -867,8 +868,9 @@ public:
{
return Item::save_in_field(field, no_conversions);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_copy_fbt>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
};
class Item_char_typecast_func_handler_fbt_to_binary:
@@ -968,7 +970,7 @@ public:
Fbt_null tmp(args[0]);
return null_value= tmp.is_null() || tmp.to_native(to);
}
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_typecast_fbt>(thd, this); }
};
@@ -978,8 +980,9 @@ public:
public:
Item_cache_fbt(THD *thd)
:Item_cache(thd, singleton()) { }
Item *get_copy(THD *thd) override
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_cache_fbt>(thd, this); }
Item *do_build_clone(THD *thd) const override { return get_copy(thd); }
bool cache_value() override
{
if (!example)

View File

@@ -180,6 +180,13 @@ void XID_STATE::set_error(uint error)
xid_cache_element->rm_error= error;
}
void XID_STATE::set_rollback_only()
{
xid_cache_element->xa_state= XA_ROLLBACK_ONLY;
if (current_thd)
MYSQL_SET_TRANSACTION_XA_STATE(current_thd->m_transaction_psi,
XA_ROLLBACK_ONLY);
}
void XID_STATE::er_xaer_rmfail() const
{
@@ -547,8 +554,21 @@ bool trans_xa_prepare(THD *thd)
}
else
{
thd->transaction->xid_state.xid_cache_element->xa_state= XA_PREPARED;
MYSQL_SET_TRANSACTION_XA_STATE(thd->m_transaction_psi, XA_PREPARED);
if (thd->transaction->xid_state.xid_cache_element->xa_state !=
XA_ROLLBACK_ONLY)
{
thd->transaction->xid_state.xid_cache_element->xa_state= XA_PREPARED;
MYSQL_SET_TRANSACTION_XA_STATE(thd->m_transaction_psi, XA_PREPARED);
}
else
{
/*
In the non-err case, XA_ROLLBACK_ONLY should only be set by a slave
thread which prepared an empty transaction, to prevent binlogging a
standalone XA COMMIT.
*/
DBUG_ASSERT(thd->rgi_slave && !(thd->transaction->all.ha_list));
}
res= thd->variables.pseudo_slave_mode || thd->slave_thread ?
slave_applier_reset_xa_trans(thd) : 0;
}

View File

@@ -34,6 +34,7 @@ struct XID_STATE {
bool check_has_uncommitted_xa() const;
bool is_explicit_XA() const { return xid_cache_element != 0; }
void set_error(uint error);
void set_rollback_only();
void er_xaer_rmfail() const;
XID *get_xid() const;
enum xa_states get_state_code() const;

View File

@@ -662,9 +662,7 @@ buf_load()
ut_free(dump);
if (i == dump_n) {
os_aio_wait_until_no_pending_reads(true);
}
os_aio_wait_until_no_pending_reads(true);
ut_sprintf_timestamp(now);

View File

@@ -3508,7 +3508,8 @@ dict_stats_fetch_table_stats_step(
ut_a(len == 8);
table->stat_clustered_index_size
= std::max<ulint>(mach_read_from_8(data), 1);
= std::max<ulint>(
(ulint) mach_read_from_8(data), 1);
break;
}
@@ -3526,7 +3527,7 @@ dict_stats_fetch_table_stats_step(
}
table->stat_sum_of_other_index_sizes
= std::max<ulint>(
mach_read_from_8(data),
(ulint) mach_read_from_8(data),
UT_LIST_GET_LEN(table->indexes) - 1);
break;
@@ -3714,13 +3715,13 @@ dict_stats_fetch_index_stats_step(
if (stat_name_len == 4 /* strlen("size") */
&& strncasecmp("size", stat_name, stat_name_len) == 0) {
index->stat_index_size
= std::max<ulint>(stat_value, 1);
= std::max<ulint>((ulint) stat_value, 1);
arg->stats_were_modified = true;
} else if (stat_name_len == 12 /* strlen("n_leaf_pages") */
&& strncasecmp("n_leaf_pages", stat_name, stat_name_len)
== 0) {
index->stat_n_leaf_pages
= std::max<ulint>(stat_value, 1);
= std::max<ulint>((ulint) stat_value, 1);
arg->stats_were_modified = true;
} else if (stat_name_len == 12 /* strlen("n_page_split") */
&& strncasecmp("n_page_split", stat_name, stat_name_len)

View File

@@ -4626,6 +4626,38 @@ static bool lock_release_on_prepare_try(trx_t *trx)
return all_released;
}
/*********************************************************************//**
Removes table locks of the transaction on a table to be dropped. */
static
void
lock_trx_table_locks_remove(
/*========================*/
const lock_t* lock_to_remove) /*!< in: lock to remove */
{
trx_t* trx = lock_to_remove->trx;
ut_ad(lock_to_remove->is_table());
lock_sys.assert_locked(*lock_to_remove->un_member.tab_lock.table);
ut_ad(trx->mutex_is_owner());
for (lock_list::iterator it = trx->lock.table_locks.begin(),
end = trx->lock.table_locks.end(); it != end; ++it) {
const lock_t* lock = *it;
ut_ad(!lock || trx == lock->trx);
ut_ad(!lock || lock->is_table());
ut_ad(!lock || lock->un_member.tab_lock.table);
if (lock == lock_to_remove) {
*it = NULL;
return;
}
}
/* Lock must exist in the vector. */
ut_error;
}
/** Release non-exclusive locks on XA PREPARE,
and release possible other transactions waiting because of these locks. */
void lock_release_on_prepare(trx_t *trx)
@@ -4685,6 +4717,7 @@ void lock_release_on_prepare(trx_t *trx)
case LOCK_IS:
case LOCK_S:
lock_table_dequeue(lock, false);
lock_trx_table_locks_remove(lock);
break;
case LOCK_IX:
case LOCK_X:
@@ -4737,38 +4770,6 @@ void lock_release_on_rollback(trx_t *trx, dict_table_t *table)
trx->mutex_unlock();
}
/*********************************************************************//**
Removes table locks of the transaction on a table to be dropped. */
static
void
lock_trx_table_locks_remove(
/*========================*/
const lock_t* lock_to_remove) /*!< in: lock to remove */
{
trx_t* trx = lock_to_remove->trx;
ut_ad(lock_to_remove->is_table());
lock_sys.assert_locked(*lock_to_remove->un_member.tab_lock.table);
ut_ad(trx->mutex_is_owner());
for (lock_list::iterator it = trx->lock.table_locks.begin(),
end = trx->lock.table_locks.end(); it != end; ++it) {
const lock_t* lock = *it;
ut_ad(!lock || trx == lock->trx);
ut_ad(!lock || lock->is_table());
ut_ad(!lock || lock->un_member.tab_lock.table);
if (lock == lock_to_remove) {
*it = NULL;
return;
}
}
/* Lock must exist in the vector. */
ut_error;
}
/*===================== VALIDATION AND DEBUGGING ====================*/
/** Print info of a table lock.

View File

@@ -3647,11 +3647,11 @@ disable:
void os_aio_free()
{
srv_thread_pool->disable_aio();
delete read_slots;
delete write_slots;
read_slots= nullptr;
write_slots= nullptr;
srv_thread_pool->disable_aio();
}
/** Wait until there are no pending asynchronous writes. */

View File

@@ -151,7 +151,7 @@ public:
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
bool auto_inc_temporary;
#endif
int bulk_size;
int bulk_size= 0;
int direct_dup_insert;
int store_error_num;
uint dup_key_idx;