diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-06 08:59:09 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-06 08:59:09 +0300 |
commit | d6d66c6e90050cb8aefcb55da48f7f849e5b11de (patch) | |
tree | 8a0fd06ca5605d9158e8d68924aff38262e073af | |
parent | f6b09a7ce58f564d8e5c08c799d2fc45cfc10870 (diff) | |
parent | 7c584d8270cf192496f36e993e7759616f3b650b (diff) | |
download | mariadb-git-d6d66c6e90050cb8aefcb55da48f7f849e5b11de.tar.gz |
Merge 10.3 into 10.4
33 files changed, 427 insertions, 481 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 62b7e885578..7252d008ea7 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2014, 2021, MariaDB Corporation. + Copyright (c) 2014, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -875,7 +875,7 @@ parse_page( is_leaf = (!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL))); - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tIndex page\t\t\t|" "\tindex id=%llu,", cur_page_num, id); @@ -928,7 +928,7 @@ parse_page( index.total_data_bytes += data_bytes; index.pages_in_size_range[size_range_id] ++; } - } else { + } else if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tEncrypted Index page\t\t\t|" "\tkey_version " UINT32PF ",%s\n", cur_page_num, key_version, str); } @@ -939,7 +939,7 @@ parse_page( page_type.n_fil_page_undo_log++; undo_page_type = mach_read_from_2(page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE); - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tUndo log page\t\t\t|", cur_page_num); } @@ -949,7 +949,7 @@ parse_page( switch (undo_page_type) { case TRX_UNDO_ACTIVE: page_type.n_undo_state_active++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Undo log of " "an active transaction"); } @@ -957,7 +957,7 @@ parse_page( case TRX_UNDO_CACHED: page_type.n_undo_state_cached++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Page is " "cached for quick reuse"); } @@ -965,7 +965,7 @@ parse_page( case TRX_UNDO_TO_PURGE: page_type.n_undo_state_to_purge++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Will be " "freed in purge when all undo" "data in it is removed"); @@ -974,7 +974,7 @@ parse_page( case TRX_UNDO_PREPARED: page_type.n_undo_state_prepared++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Undo log of " "an prepared transaction"); } @@ -984,14 +984,14 @@ parse_page( page_type.n_undo_state_other++; break; } - if(page_type_dump) { + if(file) { fprintf(file, ", %s\n", str); } break; case FIL_PAGE_INODE: page_type.n_fil_page_inode++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInode page\t\t\t|" "\t%s\n",cur_page_num, str); } @@ -999,7 +999,7 @@ parse_page( case FIL_PAGE_IBUF_FREE_LIST: page_type.n_fil_page_ibuf_free_list++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert buffer free list" " page\t|\t%s\n", cur_page_num, str); } @@ -1007,7 +1007,7 @@ parse_page( case FIL_PAGE_TYPE_ALLOCATED: page_type.n_fil_page_type_allocated++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tFreshly allocated " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1015,7 +1015,7 @@ parse_page( case FIL_PAGE_IBUF_BITMAP: page_type.n_fil_page_ibuf_bitmap++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert Buffer " "Bitmap\t\t|\t%s\n", cur_page_num, str); } @@ -1023,7 +1023,7 @@ parse_page( case FIL_PAGE_TYPE_SYS: page_type.n_fil_page_type_sys++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tSystem page\t\t\t|" "\t%s\n", cur_page_num, str); } @@ -1031,7 +1031,7 @@ parse_page( case FIL_PAGE_TYPE_TRX_SYS: page_type.n_fil_page_type_trx_sys++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tTransaction system " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1039,7 +1039,7 @@ parse_page( case FIL_PAGE_TYPE_FSP_HDR: page_type.n_fil_page_type_fsp_hdr++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tFile Space " "Header\t\t|\t%s\n", cur_page_num, str); } @@ -1047,7 +1047,7 @@ parse_page( case FIL_PAGE_TYPE_XDES: page_type.n_fil_page_type_xdes++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tExtent descriptor " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1055,7 +1055,7 @@ parse_page( case FIL_PAGE_TYPE_BLOB: page_type.n_fil_page_type_blob++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tBLOB page\t\t\t|\t%s\n", cur_page_num, str); } @@ -1063,7 +1063,7 @@ parse_page( case FIL_PAGE_TYPE_ZBLOB: page_type.n_fil_page_type_zblob++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tCompressed BLOB " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1071,7 +1071,7 @@ parse_page( case FIL_PAGE_TYPE_ZBLOB2: page_type.n_fil_page_type_zblob2++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tSubsequent Compressed " "BLOB page\t|\t%s\n", cur_page_num, str); } @@ -1079,7 +1079,7 @@ parse_page( case FIL_PAGE_PAGE_COMPRESSED: page_type.n_fil_page_type_page_compressed++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed " "page\t|\t%s\n", cur_page_num, str); } @@ -1087,7 +1087,7 @@ parse_page( case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED: page_type.n_fil_page_type_page_compressed_encrypted++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed encrypted " "page\t|\t%s\n", cur_page_num, str); } diff --git a/include/my_time.h b/include/my_time.h index b7b54db5586..9f3e61b944f 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -244,9 +244,12 @@ static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals) !ltime->hour && !ltime->minute && !ltime->second) ltime->neg= FALSE; } +#ifdef _WIN32 +#define suseconds_t long +#endif static inline void my_timeval_trunc(struct timeval *tv, uint decimals) { - tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals); + tv->tv_usec-= (suseconds_t) my_time_fraction_remainder(tv->tv_usec, decimals); } diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index cd726f7298f..1d889ffa13d 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -2392,5 +2392,11 @@ DROP TABLE t1; DROP TABLE t1; SET SQL_MODE=DEFAULT; # +# MDEV-27673 Warning after "select progress from information_schema.processlist" +# +select progress from information_schema.processlist limit 1; +progress +0.000 +# # End of 10.3 tests # diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test index c7087958f79..77d0df59e2f 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -2105,7 +2105,10 @@ DROP TABLE t1; DROP TABLE t1; SET SQL_MODE=DEFAULT; - +--echo # +--echo # MDEV-27673 Warning after "select progress from information_schema.processlist" +--echo # +select progress from information_schema.processlist limit 1; --echo # --echo # End of 10.3 tests diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index 5d72cde5dd2..134069d4717 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -5586,6 +5586,28 @@ a DEALLOCATE PREPARE stmt; DROP VIEW v1; DROP TABLE t1; +# +# MDEV-19631: Assertion `0' failed in st_select_lex_unit::optimize or +# different plan upon 2nd execution of PS with EXPLAIN +# +CREATE TABLE t1 (a INT); +PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1 HAVING 6 IN ( SELECT 6 UNION SELECT 5 )'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +# Without the patch the second execution of the 'stmt' prepared statement +# would result in server crash. +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +DEALLOCATE PREPARE stmt; +DROP TABLE t1; # End of 10.2 tests # # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index c99731e768d..062d729b2cc 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -5005,6 +5005,19 @@ DEALLOCATE PREPARE stmt; DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-19631: Assertion `0' failed in st_select_lex_unit::optimize or +--echo # different plan upon 2nd execution of PS with EXPLAIN +--echo # +CREATE TABLE t1 (a INT); +PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1 HAVING 6 IN ( SELECT 6 UNION SELECT 5 )'; +EXECUTE stmt; +--echo # Without the patch the second execution of the 'stmt' prepared statement +--echo # would result in server crash. +EXECUTE stmt; +# Cleanup +DEALLOCATE PREPARE stmt; +DROP TABLE t1; --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 3795e4db894..4dc033d4171 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -8902,6 +8902,19 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp BEGIN RETURN ''; END' at line 2 +# +# MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION + +# Specifying the RESTART clause for the statement CREATE SEQUENCE is a syntax error. +# Check that CREATE PROCEDURE doesn't crash server if the statement +# CREATE SEQUNCE ... RESTART is specified in its body. +# +CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RESTART' at line 1 +# CREATE SEQUNCE ... RESTART and CREATE SEQUNCE ... RESTART WITH ... are +# handled by different grammar rules, so check the both cases. +CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART WITH 100; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RESTART' at line 1 # End of 10.3 tests # # Start of 10.4 tests diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 4fa5085128a..a93689ba4da 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -10461,6 +10461,21 @@ END; $$ DELIMITER ;$$ +--echo # +--echo # MDEV-28220: Assert failure in sp_head::~sp_head on parsing a syntax incorrect statement CREATE SEQUENCE ... RESTART inside CREATE PROCEDURE/CREATE FUNCTION +--echo + +--echo # Specifying the RESTART clause for the statement CREATE SEQUENCE is a syntax error. +--echo # Check that CREATE PROCEDURE doesn't crash server if the statement +--echo # CREATE SEQUNCE ... RESTART is specified in its body. +--echo # +--error ER_PARSE_ERROR +CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART; +--echo # CREATE SEQUNCE ... RESTART and CREATE SEQUNCE ... RESTART WITH ... are +--echo # handled by different grammar rules, so check the both cases. +--error ER_PARSE_ERROR +CREATE PROCEDURE sp1() CREATE SEQUENCE s1 START WITH 300 INCREMENT BY 30 RESTART WITH 100; + --echo # End of 10.3 tests diff --git a/mysql-test/suite/encryption/r/innochecksum.result b/mysql-test/suite/encryption/r/innochecksum.result index 5dc6ed90acc..7c68164e52a 100644 --- a/mysql-test/suite/encryption/r/innochecksum.result +++ b/mysql-test/suite/encryption/r/innochecksum.result @@ -7,7 +7,7 @@ CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FOR CREATE TABLE t4 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1; CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; -# Run innochecksum on t1 +# Run innochecksum on t1, check -S does not cause crash for encrypted file # Run innochecksum on t2 # Run innochecksum on t3 # Run innochecksum on t4 diff --git a/mysql-test/suite/encryption/t/innochecksum.test b/mysql-test/suite/encryption/t/innochecksum.test index 0f44844c103..1dca45a0711 100644 --- a/mysql-test/suite/encryption/t/innochecksum.test +++ b/mysql-test/suite/encryption/t/innochecksum.test @@ -58,9 +58,9 @@ let MYSQLD_DATADIR=`select @@datadir`; --source include/shutdown_mysqld.inc ---echo # Run innochecksum on t1 -- disable_result_log ---exec $INNOCHECKSUM $t1_IBD +--echo # Run innochecksum on t1, check -S does not cause crash for encrypted file +--exec $INNOCHECKSUM -S $t1_IBD --echo # Run innochecksum on t2 diff --git a/mysql-test/suite/galera/t/galera_sst_rsync2.cnf b/mysql-test/suite/galera/t/galera_sst_rsync2.cnf index 0159596f99b..a089baacf36 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync2.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync2.cnf @@ -5,10 +5,10 @@ wsrep_sst_method=rsync [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' -log_bin=@ENV.MYSQLTEST_VARDIR/server1_binlog +log_bin=@ENV.MYSQLTEST_VARDIR/mysqld.1/server1_binlog log_bin_index=@ENV.MYSQLTEST_VARDIR/tmp/server1_binlog_index.index [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' -log_bin=@ENV.MYSQLTEST_VARDIR/server2_binlog +log_bin=@ENV.MYSQLTEST_VARDIR/mysqld.2/server2_binlog log_bin_index=@ENV.MYSQLTEST_VARDIR/tmp/server2_binlog_index.index diff --git a/mysql-test/suite/galera/t/galera_sst_rsync2.test b/mysql-test/suite/galera/t/galera_sst_rsync2.test index f796356cac7..20fae4a751e 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync2.test +++ b/mysql-test/suite/galera/t/galera_sst_rsync2.test @@ -7,6 +7,8 @@ --source suite/galera/include/galera_st_shutdown_slave.inc --source suite/galera/include/galera_st_clean_slave.inc +--let $wsrep_recover_additional=--log-bin=$MYSQLTEST_VARDIR/mysqld.2/server2_binlog --log-bin-index=$MYSQLTEST_VARDIR/tmp/server2_binlog_index.index + --source suite/galera/include/galera_st_kill_slave.inc --source suite/galera/include/galera_st_kill_slave_ddl.inc --source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result index 690c5e64b4a..e2d5cf185d5 100644 --- a/mysql-test/suite/mariabackup/full_backup.result +++ b/mysql-test/suite/mariabackup/full_backup.result @@ -1,6 +1,7 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); # xtrabackup backup +NOT FOUND /InnoDB: Allocated tablespace ID/ in backup.log INSERT INTO t VALUES(2); # xtrabackup prepare # shutdown server diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test index d1d2ea21c08..66bed34cf3d 100644 --- a/mysql-test/suite/mariabackup/full_backup.test +++ b/mysql-test/suite/mariabackup/full_backup.test @@ -4,11 +4,18 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); echo # xtrabackup backup; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backup_log 2>&1; --enable_result_log +# The following warning must not appear after MDEV-27343 fix +--let SEARCH_PATTERN=InnoDB: Allocated tablespace ID +--let SEARCH_FILE=$backup_log +--source include/search_pattern_in_file.inc +--remove_file $backup_log + INSERT INTO t VALUES(2); diff --git a/mysql-test/suite/versioning/r/debug.result b/mysql-test/suite/versioning/r/debug.result index c1c134692a2..0e2c67fd9aa 100644 --- a/mysql-test/suite/versioning/r/debug.result +++ b/mysql-test/suite/versioning/r/debug.result @@ -50,5 +50,17 @@ t4 CREATE TABLE `t4` ( `row_end` timestamp(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING -set global debug_dbug=@old_dbug; drop table t1, t2, t3, t4; +# +# MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() +# +create table t1 (x int) with system versioning; +set debug_dbug='+d,error_vers_wrong_type'; +show create table t1; +ERROR HY000: Incorrect information in file: './test/t1.frm' +show warnings; +Level Code Message +Warning 4110 `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1` +Error 1033 Incorrect information in file: './test/t1.frm' +drop table t1; +set global debug_dbug=@old_dbug; diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result index a01d51f62cd..cbb75a10cf5 100644 --- a/mysql-test/suite/versioning/r/update.result +++ b/mysql-test/suite/versioning/r/update.result @@ -411,6 +411,17 @@ check_row_ts(row_start, row_end) CURRENT ROW drop table t1; # +# MDEV-22973 Assertion in compare_record upon multi-update involving versioned table via view +# +create or replace table t1 (a int, primary key (a)) engine=myisam; +insert into t1 values (0); +create or replace table t2 (pk int, b int, primary key (pk), key(b)) engine=innodb with system versioning; +insert into t2 values (1, 0), (2, 0); +create or replace view v as select a, b from t1, t2; +update v set b= null where a = 0 order by b; +drop view v; +drop table t1, t2; +# # MDEV-24522 Assertion `inited==NONE' fails upon UPDATE on versioned table with unique blob # create table t1 (a int, b int, c text, unique(c), key (b)) engine=myisam with system versioning; @@ -426,3 +437,4 @@ update t1 set a = 3 where b <= 9; update t2 set a = 3 where b <= 9; update t1, t2 set t1.a = 3, t2.a = 3 where t1.b <= 10 and t2.b <= 10 and t1.b = t2.b; drop tables t1, t2; +# End of 10.4 tests diff --git a/mysql-test/suite/versioning/t/debug.test b/mysql-test/suite/versioning/t/debug.test index 5069d7f6002..be58b67546d 100644 --- a/mysql-test/suite/versioning/t/debug.test +++ b/mysql-test/suite/versioning/t/debug.test @@ -1,5 +1,7 @@ --source include/have_debug.inc +--let $datadir=`select @@datadir` + create table t1 (a int); show create table t1; @@ -30,6 +32,18 @@ set debug_dbug='+d,sysvers_show'; show create table t3; create table t4 (a int); show create table t4; +drop table t1, t2, t3, t4; + +--echo # +--echo # MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image() +--echo # +create table t1 (x int) with system versioning; +set debug_dbug='+d,error_vers_wrong_type'; +--replace_result $datadir ./ +--error ER_NOT_FORM_FILE +show create table t1; +--replace_result $datadir ./ +show warnings; +drop table t1; set global debug_dbug=@old_dbug; -drop table t1, t2, t3, t4; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 478f5ad231f..56bbd909256 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -337,6 +337,19 @@ select check_row_ts(row_start, row_end) from t1 for system_time all where row_st drop table t1; --echo # +--echo # MDEV-22973 Assertion in compare_record upon multi-update involving versioned table via view +--echo # +create or replace table t1 (a int, primary key (a)) engine=myisam; +insert into t1 values (0); +create or replace table t2 (pk int, b int, primary key (pk), key(b)) engine=innodb with system versioning; +insert into t2 values (1, 0), (2, 0); +create or replace view v as select a, b from t1, t2; +update v set b= null where a = 0 order by b; +# cleanup +drop view v; +drop table t1, t2; + +--echo # --echo # MDEV-24522 Assertion `inited==NONE' fails upon UPDATE on versioned table with unique blob --echo # create table t1 (a int, b int, c text, unique(c), key (b)) engine=myisam with system versioning; @@ -360,4 +373,6 @@ update t1, t2 set t1.a = 3, t2.a = 3 where t1.b <= 10 and t2.b <= 10 and t1.b = # cleanup drop tables t1, t2; +--echo # End of 10.4 tests + source suite/versioning/common_finish.inc; diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc index 56f8f1f5a1d..fd0e7099666 100644 --- a/plugin/versioning/versioning.cc +++ b/plugin/versioning/versioning.cc @@ -29,7 +29,8 @@ template <TR_table::field_id_t TRT_FIELD> class Create_func_trt : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_trt<TRT_FIELD> s_singleton; @@ -43,7 +44,7 @@ Create_func_trt<TRT_FIELD> Create_func_trt<TRT_FIELD>::s_singleton; template <TR_table::field_id_t TRT_FIELD> Item* -Create_func_trt<TRT_FIELD>::create_native(THD *thd, LEX_CSTRING *name, +Create_func_trt<TRT_FIELD>::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -102,7 +103,8 @@ template <class Item_func_trt_trx_seesX> class Create_func_trt_trx_sees : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list) + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index ce4001fdc56..067a777fb9c 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -472,7 +472,7 @@ read_cnf() encrypt=$(parse_cnf "$encgroups" 'encrypt' 0) tmode=$(parse_cnf "$encgroups" 'ssl-mode' 'DISABLED' | \ - tr [:lower:] [:upper:]) + tr '[[:lower:]]' '[[:upper:]]') case "$tmode" in 'VERIFY_IDENTITY'|'VERIFY_CA'|'REQUIRED'|'DISABLED') diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 67a7afc638f..5f7ae4298b5 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -224,7 +224,7 @@ SSTCERT="$tpem" SSTCA="$tcert" SSTCAP="$tcap" -SSLMODE=$(parse_cnf "$encgroups" 'ssl-mode' | tr [:lower:] [:upper:]) +SSLMODE=$(parse_cnf "$encgroups" 'ssl-mode' | tr '[[:lower:]]' '[[:upper:]]') if [ -z "$SSLMODE" ]; then # Implicit verification if CA is set and the SSL mode diff --git a/sql/ha_partition.h b/sql/ha_partition.h index f622c12d4e4..ad9e32eed76 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -3,7 +3,7 @@ /* Copyright (c) 2005, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1098,10 +1098,6 @@ public: NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION LEVEL which is dynamic, see bug#39084. - HA_READ_RND_SAME: - Not currently used. (Means that the handler supports the rnd_same() call) - (MyISAM, HEAP) - HA_TABLE_SCAN_ON_INDEX: Used to avoid scanning full tables on an index. If this flag is set then the handler always has a primary key (hidden if not defined) and this diff --git a/sql/handler.cc b/sql/handler.cc index 1b914012355..2f348920cd0 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2736,11 +2736,6 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows) return cost; } -void **handler::ha_data(THD *thd) const -{ - return thd_ha_data(thd, ht); -} - THD *handler::ha_thd(void) const { DBUG_ASSERT(!table || !table->in_use || table->in_use == current_thd); @@ -7067,17 +7062,6 @@ void handler::unlock_shared_ha_data() mysql_mutex_unlock(&table_share->LOCK_ha_data); } -/** @brief - Dummy function which accept information about log files which is not need - by handlers -*/ -void signal_log_not_needed(struct handlerton, char *log_file) -{ - DBUG_ENTER("signal_log_not_needed"); - DBUG_PRINT("enter", ("logfile '%s'", log_file)); - DBUG_VOID_RETURN; -} - void handler::set_lock_type(enum thr_lock_type lock) { table->reginfo.lock_type= lock; @@ -7146,177 +7130,6 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) #endif /* WITH_WSREP */ -#ifdef TRANS_LOG_MGM_EXAMPLE_CODE -/* - Example of transaction log management functions based on assumption that logs - placed into a directory -*/ -#include <my_dir.h> -#include <my_sys.h> -int example_of_iterator_using_for_logs_cleanup(handlerton *hton) -{ - void *buffer; - int res= 1; - struct handler_iterator iterator; - struct handler_log_file_data data; - - if (!hton->create_iterator) - return 1; /* iterator creator is not supported */ - - if ((*hton->create_iterator)(hton, HA_TRANSACTLOG_ITERATOR, &iterator) != - HA_ITERATOR_OK) - { - /* error during creation of log iterator or iterator is not supported */ - return 1; - } - while((*iterator.next)(&iterator, (void*)&data) == 0) - { - printf("%s\n", data.filename.str); - if (data.status == HA_LOG_STATUS_FREE && - mysql_file_delete(INSTRUMENT_ME, - data.filename.str, MYF(MY_WME))) - goto err; - } - res= 0; -err: - (*iterator.destroy)(&iterator); - return res; -} - - -/* - Here we should get info from handler where it save logs but here is - just example, so we use constant. - IMHO FN_ROOTDIR ("/") is safe enough for example, because nobody has - rights on it except root and it consist of directories only at lest for - *nix (sorry, can't find windows-safe solution here, but it is only example). -*/ -#define fl_dir FN_ROOTDIR - - -/** @brief - Dummy function to return log status should be replaced by function which - really detect the log status and check that the file is a log of this - handler. -*/ -enum log_status fl_get_log_status(char *log) -{ - MY_STAT stat_buff; - if (mysql_file_stat(INSTRUMENT_ME, log, &stat_buff, MYF(0))) - return HA_LOG_STATUS_INUSE; - return HA_LOG_STATUS_NOSUCHLOG; -} - - -struct fl_buff -{ - LEX_STRING *names; - enum log_status *statuses; - uint32 entries; - uint32 current; -}; - - -int fl_log_iterator_next(struct handler_iterator *iterator, - void *iterator_object) -{ - struct fl_buff *buff= (struct fl_buff *)iterator->buffer; - struct handler_log_file_data *data= - (struct handler_log_file_data *) iterator_object; - if (buff->current >= buff->entries) - return 1; - data->filename= buff->names[buff->current]; - data->status= buff->statuses[buff->current]; - buff->current++; - return 0; -} - - -void fl_log_iterator_destroy(struct handler_iterator *iterator) -{ - my_free(iterator->buffer); -} - - -/** @brief - returns buffer, to be assigned in handler_iterator struct -*/ -enum handler_create_iterator_result -fl_log_iterator_buffer_init(struct handler_iterator *iterator) -{ - MY_DIR *dirp; - struct fl_buff *buff; - char *name_ptr; - uchar *ptr; - FILEINFO *file; - uint32 i; - - /* to be able to make my_free without crash in case of error */ - iterator->buffer= 0; - - if (!(dirp = my_dir(fl_dir, MYF(MY_THREAD_SPECIFIC)))) - { - return HA_ITERATOR_ERROR; - } - if ((ptr= (uchar*)my_malloc(ALIGN_SIZE(sizeof(fl_buff)) + - ((ALIGN_SIZE(sizeof(LEX_STRING)) + - sizeof(enum log_status) + - + FN_REFLEN + 1) * - (uint) dirp->number_off_files), - MYF(MY_THREAD_SPECIFIC))) == 0) - { - return HA_ITERATOR_ERROR; - } - buff= (struct fl_buff *)ptr; - buff->entries= buff->current= 0; - ptr= ptr + (ALIGN_SIZE(sizeof(fl_buff))); - buff->names= (LEX_STRING*) (ptr); - ptr= ptr + ((ALIGN_SIZE(sizeof(LEX_STRING)) * - (uint) dirp->number_off_files)); - buff->statuses= (enum log_status *)(ptr); - name_ptr= (char *)(ptr + (sizeof(enum log_status) * - (uint) dirp->number_off_files)); - for (i=0 ; i < (uint) dirp->number_off_files ; i++) - { - enum log_status st; - file= dirp->dir_entry + i; - if ((file->name[0] == '.' && - ((file->name[1] == '.' && file->name[2] == '\0') || - file->name[1] == '\0'))) - continue; - if ((st= fl_get_log_status(file->name)) == HA_LOG_STATUS_NOSUCHLOG) - continue; - name_ptr= strxnmov(buff->names[buff->entries].str= name_ptr, - FN_REFLEN, fl_dir, file->name, NullS); - buff->names[buff->entries].length= (name_ptr - - buff->names[buff->entries].str); - buff->statuses[buff->entries]= st; - buff->entries++; - } - - iterator->buffer= buff; - iterator->next= &fl_log_iterator_next; - iterator->destroy= &fl_log_iterator_destroy; - my_dirend(dirp); - return HA_ITERATOR_OK; -} - - -/* An example of a iterator creator */ -enum handler_create_iterator_result -fl_create_iterator(enum handler_iterator_type type, - struct handler_iterator *iterator) -{ - switch(type) { - case HA_TRANSACTLOG_ITERATOR: - return fl_log_iterator_buffer_init(iterator); - default: - return HA_ITERATOR_UNSUPPORTED; - } -} -#endif /*TRANS_LOG_MGM_EXAMPLE_CODE*/ - - bool HA_CREATE_INFO::check_conflicting_charset_declarations(CHARSET_INFO *cs) { if ((used_fields & HA_CREATE_USED_DEFAULT_CHARSET) && diff --git a/sql/handler.h b/sql/handler.h index ff2757837a8..a103f6e46b5 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1062,31 +1062,6 @@ typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len, enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX }; extern MYSQL_PLUGIN_IMPORT st_plugin_int *hton2plugin[MAX_HA]; -/* Transaction log maintains type definitions */ -enum log_status -{ - HA_LOG_STATUS_FREE= 0, /* log is free and can be deleted */ - HA_LOG_STATUS_INUSE= 1, /* log can't be deleted because it is in use */ - HA_LOG_STATUS_NOSUCHLOG= 2 /* no such log (can't be returned by - the log iterator status) */ -}; -/* - Function for signaling that the log file changed its state from - LOG_STATUS_INUSE to LOG_STATUS_FREE - - Now it do nothing, will be implemented as part of new transaction - log management for engines. - TODO: implement the function. -*/ -void signal_log_not_needed(struct handlerton, char *log_file); -/* - Data of transaction log iterator. -*/ -struct handler_log_file_data { - LEX_STRING filename; - enum log_status status; -}; - /* Definitions for engine-specific table/field/index options in the CREATE TABLE. @@ -1201,46 +1176,6 @@ typedef struct st_ha_create_table_option { struct st_mysql_sys_var *var; } ha_create_table_option; -enum handler_iterator_type -{ - /* request of transaction log iterator */ - HA_TRANSACTLOG_ITERATOR= 1 -}; -enum handler_create_iterator_result -{ - HA_ITERATOR_OK, /* iterator created */ - HA_ITERATOR_UNSUPPORTED, /* such type of iterator is not supported */ - HA_ITERATOR_ERROR /* error during iterator creation */ -}; - -/* - Iterator structure. Can be used by handler/handlerton for different purposes. - - Iterator should be created in the way to point "before" the first object - it iterate, so next() call move it to the first object or return !=0 if - there is nothing to iterate through. -*/ -struct handler_iterator { - /* - Moves iterator to next record and return 0 or return !=0 - if there is no records. - iterator_object will be filled by this function if next() returns 0. - Content of the iterator_object depend on iterator type. - */ - int (*next)(struct handler_iterator *, void *iterator_object); - /* - Free resources allocated by iterator, after this call iterator - is not usable. - */ - void (*destroy)(struct handler_iterator *); - /* - Pointer to buffer for the iterator to use. - Should be allocated by function which created the iterator and - destroyed by freed by above "destroy" call - */ - void *buffer; -}; - class handler; class group_by_handler; class derived_handler; @@ -1504,22 +1439,6 @@ struct handlerton const char *query, uint query_length, const char *db, const char *table_name); - /* - Get log status. - If log_status is null then the handler do not support transaction - log information (i.e. log iterator can't be created). - (see example of implementation in handler.cc, TRANS_LOG_MGM_EXAMPLE_CODE) - - */ - enum log_status (*get_log_status)(handlerton *hton, char *log); - - /* - Iterators creator. - Presence of the pointer should be checked before using - */ - enum handler_create_iterator_result - (*create_iterator)(handlerton *hton, enum handler_iterator_type type, - struct handler_iterator *fill_this_in); void (*abort_transaction)(handlerton *hton, THD *bf_thd, THD *victim_thd, my_bool signal); int (*set_checkpoint)(handlerton *hton, const XID* xid); @@ -3822,15 +3741,13 @@ public: inline int ha_read_first_row(uchar *buf, uint primary_key); /** - The following 3 function is only needed for tables that may be + The following 2 function is only needed for tables that may be internal temporary tables during joins. */ virtual int remember_rnd_pos() { return HA_ERR_WRONG_COMMAND; } virtual int restart_rnd_next(uchar *buf) { return HA_ERR_WRONG_COMMAND; } - virtual int rnd_same(uchar *buf, uint inx) - { return HA_ERR_WRONG_COMMAND; } virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key) @@ -4575,7 +4492,6 @@ public: TABLE_SHARE* get_table_share() { return table_share; } protected: /* Service methods for use by storage engines. */ - void **ha_data(THD *) const; THD *ha_thd(void) const; /** diff --git a/sql/item_create.cc b/sql/item_create.cc index d92aba03a4a..a5b882e2b91 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2008, 2021, MariaDB Corporation. + Copyright (c) 2008, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,7 +49,7 @@ class Create_func_arg0 : public Create_func { public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list); /** @@ -74,7 +74,8 @@ protected: class Create_func_arg1 : public Create_func { public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); /** Builder method, with one argument. @@ -99,7 +100,8 @@ protected: class Create_func_arg2 : public Create_func { public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); /** Builder method, with two arguments. @@ -124,7 +126,8 @@ protected: class Create_func_arg3 : public Create_func { public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); /** Builder method, with three arguments. @@ -150,7 +153,9 @@ protected: class Create_sp_func : public Create_qfunc { public: - virtual Item *create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name, + virtual Item *create_with_db(THD *thd, + const LEX_CSTRING *db, + const LEX_CSTRING *name, bool use_explicit_name, List<Item> *item_list); static Create_sp_func s_singleton; @@ -173,7 +178,8 @@ protected: class Create_func_no_geom : public Create_func { public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); /** Singleton. */ static Create_func_no_geom s_singleton; @@ -319,7 +325,8 @@ protected: class Create_func_atan : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_atan s_singleton; @@ -553,7 +560,8 @@ protected: class Create_func_concat : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_concat s_singleton; @@ -566,7 +574,8 @@ protected: class Create_func_concat_operator_oracle : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_concat_operator_oracle s_singleton; @@ -592,7 +601,8 @@ protected: class Create_func_decode_oracle : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_decode_oracle s_singleton; @@ -605,7 +615,8 @@ protected: class Create_func_concat_ws : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_concat_ws s_singleton; @@ -830,7 +841,8 @@ protected: class Create_func_des_decrypt : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_des_decrypt s_singleton; @@ -843,7 +855,8 @@ protected: class Create_func_des_encrypt : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_des_encrypt s_singleton; @@ -911,7 +924,8 @@ class Create_func_distance : public Create_func_arg2 class Create_func_distance_sphere: public Create_native_func { public: - Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_distance_sphere s_singleton; protected: @@ -925,7 +939,8 @@ class Create_func_distance_sphere: public Create_native_func class Create_func_elt : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_elt s_singleton; @@ -951,7 +966,8 @@ protected: class Create_func_encrypt : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_encrypt s_singleton; @@ -1047,7 +1063,8 @@ protected: class Create_func_export_set : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_export_set s_singleton; @@ -1075,7 +1092,8 @@ protected: class Create_func_field : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_field s_singleton; @@ -1114,7 +1132,8 @@ protected: class Create_func_format : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_format s_singleton; @@ -1166,7 +1185,8 @@ protected: class Create_func_from_unixtime : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_from_unixtime s_singleton; @@ -1180,7 +1200,8 @@ protected: class Create_func_geometry_from_text : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_geometry_from_text s_singleton; @@ -1195,7 +1216,8 @@ protected: class Create_func_geometry_from_wkb : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_geometry_from_wkb s_singleton; @@ -1210,7 +1232,8 @@ protected: class Create_func_geometry_from_json : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_geometry_from_json s_singleton; @@ -1223,7 +1246,8 @@ protected: class Create_func_as_geojson : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_as_geojson s_singleton; @@ -1310,7 +1334,8 @@ protected: class Create_func_greatest : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_greatest s_singleton; @@ -1736,7 +1761,8 @@ protected: class Create_func_json_detailed: public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_detailed s_singleton; @@ -1801,7 +1827,8 @@ protected: class Create_func_json_keys: public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_keys s_singleton; @@ -1814,7 +1841,8 @@ protected: class Create_func_json_contains: public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_contains s_singleton; @@ -1827,7 +1855,8 @@ protected: class Create_func_json_contains_path : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_contains_path s_singleton; @@ -1840,7 +1869,8 @@ protected: class Create_func_json_extract : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_extract s_singleton; @@ -1853,7 +1883,8 @@ protected: class Create_func_json_search : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_search s_singleton; @@ -1866,7 +1897,8 @@ protected: class Create_func_json_array : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_array s_singleton; @@ -1879,7 +1911,8 @@ protected: class Create_func_json_array_append : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_array_append s_singleton; @@ -1892,7 +1925,8 @@ protected: class Create_func_json_array_insert : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_array_insert s_singleton; @@ -1905,7 +1939,8 @@ protected: class Create_func_json_insert : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_insert s_singleton; @@ -1918,7 +1953,8 @@ protected: class Create_func_json_set : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_set s_singleton; @@ -1931,7 +1967,8 @@ protected: class Create_func_json_replace : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_replace s_singleton; @@ -1944,7 +1981,8 @@ protected: class Create_func_json_remove : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_remove s_singleton; @@ -1957,7 +1995,8 @@ protected: class Create_func_json_object : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_object s_singleton; @@ -1970,7 +2009,8 @@ protected: class Create_func_json_length : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_length s_singleton; @@ -1983,7 +2023,8 @@ protected: class Create_func_json_merge : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_merge s_singleton; @@ -1996,7 +2037,8 @@ protected: class Create_func_json_merge_patch : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_json_merge_patch s_singleton; @@ -2048,7 +2090,8 @@ protected: class Create_func_last_insert_id : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_last_insert_id s_singleton; @@ -2074,7 +2117,8 @@ protected: class Create_func_least : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_least s_singleton; @@ -2166,7 +2210,8 @@ protected: class Create_func_locate : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_locate s_singleton; @@ -2179,7 +2224,8 @@ protected: class Create_func_log : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_log s_singleton; @@ -2218,7 +2264,7 @@ protected: class Create_func_lpad : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { return thd->variables.sql_mode & MODE_ORACLE ? @@ -2230,15 +2276,18 @@ public: protected: Create_func_lpad() {} virtual ~Create_func_lpad() {} - Item *create_native_std(THD *thd, LEX_CSTRING *name, List<Item> *items); - Item *create_native_oracle(THD *thd, LEX_CSTRING *name, List<Item> *items); + Item *create_native_std(THD *thd, const LEX_CSTRING *name, + List<Item> *items); + Item *create_native_oracle(THD *thd, const LEX_CSTRING *name, + List<Item> *items); }; class Create_func_lpad_oracle : public Create_func_lpad { public: - Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list) + Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { return create_native_oracle(thd, name, item_list); } @@ -2301,7 +2350,8 @@ protected: class Create_func_make_set : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_make_set s_singleton; @@ -2314,7 +2364,8 @@ protected: class Create_func_master_pos_wait : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_master_pos_wait s_singleton; @@ -2327,7 +2378,8 @@ protected: class Create_func_master_gtid_wait : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_master_gtid_wait s_singleton; @@ -2623,7 +2675,8 @@ protected: class Create_func_rand : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_rand s_singleton; @@ -2675,7 +2728,8 @@ protected: class Create_func_round : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_round s_singleton; @@ -2688,7 +2742,7 @@ protected: class Create_func_rpad : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { return thd->variables.sql_mode & MODE_ORACLE ? @@ -2700,15 +2754,18 @@ public: protected: Create_func_rpad() {} virtual ~Create_func_rpad() {} - Item *create_native_std(THD *thd, LEX_CSTRING *name, List<Item> *items); - Item *create_native_oracle(THD *thd, LEX_CSTRING *name, List<Item> *items); + Item *create_native_std(THD *thd, const LEX_CSTRING *name, + List<Item> *items); + Item *create_native_oracle(THD *thd, const LEX_CSTRING *name, + List<Item> *items); }; class Create_func_rpad_oracle : public Create_func_rpad { public: - Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list) + Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { return create_native_oracle(thd, name, item_list); } @@ -2931,7 +2988,7 @@ protected: class Create_func_substr_oracle : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list); static Create_func_substr_oracle s_singleton; @@ -3115,7 +3172,8 @@ protected: class Create_func_unix_timestamp : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_unix_timestamp s_singleton; @@ -3247,7 +3305,8 @@ protected: class Create_func_wsrep_sync_wait_upto : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) + override; static Create_func_wsrep_sync_wait_upto s_singleton; @@ -3316,7 +3375,8 @@ protected: class Create_func_year_week : public Create_native_func { public: - virtual Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list); static Create_func_year_week s_singleton; @@ -3360,7 +3420,7 @@ Create_func_no_geom Create_func_no_geom::s_singleton; Item* Create_func_no_geom::create_func(THD * /* unused */, - LEX_CSTRING /* unused */, + const LEX_CSTRING /* unused */, List<Item> * /* unused */) { /* FIXME: error message can't be translated. */ @@ -3372,7 +3432,8 @@ Create_func_no_geom::create_func(THD * /* unused */, Item* -Create_qfunc::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) +Create_qfunc::create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { LEX_CSTRING db; @@ -3405,7 +3466,8 @@ Create_qfunc::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) Create_udf_func Create_udf_func::s_singleton; Item* -Create_udf_func::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) +Create_udf_func::create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { udf_func *udf= find_udf(name->str, name->length); DBUG_ASSERT(udf); @@ -3515,7 +3577,9 @@ Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list) Create_sp_func Create_sp_func::s_singleton; Item* -Create_sp_func::create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name, +Create_sp_func::create_with_db(THD *thd, + const LEX_CSTRING *db, + const LEX_CSTRING *name, bool use_explicit_name, List<Item> *item_list) { int arg_count= 0; @@ -3562,7 +3626,8 @@ Create_sp_func::create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name, Item* -Create_native_func::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) +Create_native_func::create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { if (unlikely(has_named_parameters(item_list))) { @@ -3575,7 +3640,8 @@ Create_native_func::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_li Item* -Create_func_arg0::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) +Create_func_arg0::create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { int arg_count= 0; @@ -3593,7 +3659,8 @@ Create_func_arg0::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list Item* -Create_func_arg1::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) +Create_func_arg1::create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { int arg_count= 0; @@ -3619,7 +3686,8 @@ Create_func_arg1::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list Item* -Create_func_arg2::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) +Create_func_arg2::create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { int arg_count= 0; @@ -3647,7 +3715,8 @@ Create_func_arg2::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list Item* -Create_func_arg3::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) +Create_func_arg3::create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { int arg_count= 0; @@ -3766,7 +3835,7 @@ Create_func_asin::create_1_arg(THD *thd, Item *arg1) Create_func_atan Create_func_atan::s_singleton; Item* -Create_func_atan::create_native(THD *thd, LEX_CSTRING *name, +Create_func_atan::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item* func= NULL; @@ -3957,7 +4026,7 @@ Create_func_dyncol_json::create_1_arg(THD *thd, Item *arg1) Create_func_concat Create_func_concat::s_singleton; Item* -Create_func_concat::create_native(THD *thd, LEX_CSTRING *name, +Create_func_concat::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -3980,7 +4049,7 @@ Create_func_concat_operator_oracle Create_func_concat_operator_oracle::s_singleton; Item* -Create_func_concat_operator_oracle::create_native(THD *thd, LEX_CSTRING *name, +Create_func_concat_operator_oracle::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -4008,7 +4077,7 @@ Create_func_decode_histogram::create_2_arg(THD *thd, Item *arg1, Item *arg2) Create_func_decode_oracle Create_func_decode_oracle::s_singleton; Item* -Create_func_decode_oracle::create_native(THD *thd, LEX_CSTRING *name, +Create_func_decode_oracle::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { uint arg_count= item_list ? item_list->elements : 0; @@ -4023,7 +4092,7 @@ Create_func_decode_oracle::create_native(THD *thd, LEX_CSTRING *name, Create_func_concat_ws Create_func_concat_ws::s_singleton; Item* -Create_func_concat_ws::create_native(THD *thd, LEX_CSTRING *name, +Create_func_concat_ws::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -4210,7 +4279,7 @@ Create_func_degrees::create_1_arg(THD *thd, Item *arg1) Create_func_des_decrypt Create_func_des_decrypt::s_singleton; Item* -Create_func_des_decrypt::create_native(THD *thd, LEX_CSTRING *name, +Create_func_des_decrypt::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -4247,7 +4316,7 @@ Create_func_des_decrypt::create_native(THD *thd, LEX_CSTRING *name, Create_func_des_encrypt Create_func_des_encrypt::s_singleton; Item* -Create_func_des_encrypt::create_native(THD *thd, LEX_CSTRING *name, +Create_func_des_encrypt::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -4326,7 +4395,7 @@ Create_func_distance::create_2_arg(THD *thd, Item *arg1, Item *arg2) Create_func_elt Create_func_elt::s_singleton; Item* -Create_func_elt::create_native(THD *thd, LEX_CSTRING *name, +Create_func_elt::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -4356,7 +4425,7 @@ Create_func_encode::create_2_arg(THD *thd, Item *arg1, Item *arg2) Create_func_encrypt Create_func_encrypt::s_singleton; Item* -Create_func_encrypt::create_native(THD *thd, LEX_CSTRING *name, +Create_func_encrypt::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -4457,7 +4526,7 @@ Create_func_exp::create_1_arg(THD *thd, Item *arg1) Create_func_export_set Create_func_export_set::s_singleton; Item* -Create_func_export_set::create_native(THD *thd, LEX_CSTRING *name, +Create_func_export_set::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -4522,7 +4591,7 @@ Create_func_exteriorring::create_1_arg(THD *thd, Item *arg1) Create_func_field Create_func_field::s_singleton; Item* -Create_func_field::create_native(THD *thd, LEX_CSTRING *name, +Create_func_field::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -4561,7 +4630,7 @@ Create_func_floor::create_1_arg(THD *thd, Item *arg1) Create_func_format Create_func_format::s_singleton; Item* -Create_func_format::create_native(THD *thd, LEX_CSTRING *name, +Create_func_format::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -4626,7 +4695,7 @@ Create_func_from_days::create_1_arg(THD *thd, Item *arg1) Create_func_from_unixtime Create_func_from_unixtime::s_singleton; Item* -Create_func_from_unixtime::create_native(THD *thd, LEX_CSTRING *name, +Create_func_from_unixtime::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -4665,7 +4734,7 @@ Create_func_from_unixtime::create_native(THD *thd, LEX_CSTRING *name, Create_func_geometry_from_text Create_func_geometry_from_text::s_singleton; Item* -Create_func_geometry_from_text::create_native(THD *thd, LEX_CSTRING *name, +Create_func_geometry_from_text::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -4705,7 +4774,7 @@ Create_func_geometry_from_text::create_native(THD *thd, LEX_CSTRING *name, Create_func_geometry_from_wkb Create_func_geometry_from_wkb::s_singleton; Item* -Create_func_geometry_from_wkb::create_native(THD *thd, LEX_CSTRING *name, +Create_func_geometry_from_wkb::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -4745,8 +4814,8 @@ Create_func_geometry_from_wkb::create_native(THD *thd, LEX_CSTRING *name, Create_func_geometry_from_json Create_func_geometry_from_json::s_singleton; Item* -Create_func_geometry_from_json::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_geometry_from_json::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -4792,8 +4861,8 @@ Create_func_geometry_from_json::create_native(THD *thd, LEX_CSTRING *name, Create_func_as_geojson Create_func_as_geojson::s_singleton; Item* -Create_func_as_geojson::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_as_geojson::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -4894,7 +4963,7 @@ Create_func_glength::create_1_arg(THD *thd, Item *arg1) Create_func_distance_sphere Create_func_distance_sphere::s_singleton; Item* -Create_func_distance_sphere::create_native(THD *thd, LEX_CSTRING *name, +Create_func_distance_sphere::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -4915,7 +4984,7 @@ Create_func_distance_sphere::create_native(THD *thd, LEX_CSTRING *name, Create_func_greatest Create_func_greatest::s_singleton; Item* -Create_func_greatest::create_native(THD *thd, LEX_CSTRING *name, +Create_func_greatest::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -5208,8 +5277,8 @@ Create_func_json_exists::create_2_arg(THD *thd, Item *arg1, Item *arg2) Create_func_json_detailed Create_func_json_detailed::s_singleton; Item* -Create_func_json_detailed::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_json_detailed::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -5335,7 +5404,7 @@ Create_func_last_day::create_1_arg(THD *thd, Item *arg1) Create_func_json_array Create_func_json_array::s_singleton; Item* -Create_func_json_array::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_array::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func; @@ -5357,8 +5426,8 @@ Create_func_json_array::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_array_append Create_func_json_array_append::s_singleton; Item* -Create_func_json_array_append::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_json_array_append::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -5383,8 +5452,8 @@ Create_func_json_array_append::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_array_insert Create_func_json_array_insert::s_singleton; Item* -Create_func_json_array_insert::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_json_array_insert::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -5409,8 +5478,8 @@ Create_func_json_array_insert::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_insert Create_func_json_insert::s_singleton; Item* -Create_func_json_insert::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_json_insert::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -5436,7 +5505,7 @@ Create_func_json_insert::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_set Create_func_json_set::s_singleton; Item* -Create_func_json_set::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_set::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5463,7 +5532,7 @@ Create_func_json_set::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_replace Create_func_json_replace::s_singleton; Item* -Create_func_json_replace::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_replace::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5490,7 +5559,7 @@ Create_func_json_replace::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_remove Create_func_json_remove::s_singleton; Item* -Create_func_json_remove::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_remove::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5516,7 +5585,7 @@ Create_func_json_remove::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_object Create_func_json_object::s_singleton; Item* -Create_func_json_object::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_object::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func; @@ -5549,7 +5618,7 @@ Create_func_json_object::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_length Create_func_json_length::s_singleton; Item* -Create_func_json_length::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_length::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func; @@ -5574,7 +5643,7 @@ Create_func_json_length::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_merge Create_func_json_merge::s_singleton; Item* -Create_func_json_merge::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_merge::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func; @@ -5599,8 +5668,8 @@ Create_func_json_merge::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_merge_patch Create_func_json_merge_patch::s_singleton; Item* -Create_func_json_merge_patch::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_json_merge_patch::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func; int arg_count; @@ -5623,7 +5692,7 @@ Create_func_json_merge_patch::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_contains Create_func_json_contains::s_singleton; Item* -Create_func_json_contains::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_contains::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5649,7 +5718,7 @@ Create_func_json_contains::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_keys Create_func_json_keys::s_singleton; Item* -Create_func_json_keys::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_keys::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5675,8 +5744,8 @@ Create_func_json_keys::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_contains_path Create_func_json_contains_path::s_singleton; Item* -Create_func_json_contains_path::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_json_contains_path::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -5701,8 +5770,8 @@ Create_func_json_contains_path::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_extract Create_func_json_extract::s_singleton; Item* -Create_func_json_extract::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_json_extract::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -5727,7 +5796,7 @@ Create_func_json_extract::create_native(THD *thd, LEX_CSTRING *name, Create_func_json_search Create_func_json_search::s_singleton; Item* -Create_func_json_search::create_native(THD *thd, LEX_CSTRING *name, +Create_func_json_search::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5753,7 +5822,7 @@ Create_func_json_search::create_native(THD *thd, LEX_CSTRING *name, Create_func_last_insert_id Create_func_last_insert_id::s_singleton; Item* -Create_func_last_insert_id::create_native(THD *thd, LEX_CSTRING *name, +Create_func_last_insert_id::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5799,7 +5868,7 @@ Create_func_lcase::create_1_arg(THD *thd, Item *arg1) Create_func_least Create_func_least::s_singleton; Item* -Create_func_least::create_native(THD *thd, LEX_CSTRING *name, +Create_func_least::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -5881,7 +5950,7 @@ Create_func_load_file::create_1_arg(THD *thd, Item *arg1) Create_func_locate Create_func_locate::s_singleton; Item* -Create_func_locate::create_native(THD *thd, LEX_CSTRING *name, +Create_func_locate::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5922,7 +5991,7 @@ Create_func_locate::create_native(THD *thd, LEX_CSTRING *name, Create_func_log Create_func_log::s_singleton; Item* -Create_func_log::create_native(THD *thd, LEX_CSTRING *name, +Create_func_log::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -5979,7 +6048,7 @@ Create_func_lpad Create_func_lpad::s_singleton; Create_func_lpad_oracle Create_func_lpad_oracle::s_singleton; Item* -Create_func_lpad::create_native_std(THD *thd, LEX_CSTRING *name, +Create_func_lpad::create_native_std(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -6011,7 +6080,7 @@ Create_func_lpad::create_native_std(THD *thd, LEX_CSTRING *name, Item* -Create_func_lpad::create_native_oracle(THD *thd, LEX_CSTRING *name, +Create_func_lpad::create_native_oracle(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= item_list ? item_list->elements : 0; @@ -6077,7 +6146,7 @@ Create_func_maketime::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) Create_func_make_set Create_func_make_set::s_singleton; Item* -Create_func_make_set::create_native(THD *thd, LEX_CSTRING *name, +Create_func_make_set::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= 0; @@ -6098,7 +6167,7 @@ Create_func_make_set::create_native(THD *thd, LEX_CSTRING *name, Create_func_master_pos_wait Create_func_master_pos_wait::s_singleton; Item* -Create_func_master_pos_wait::create_native(THD *thd, LEX_CSTRING *name, +Create_func_master_pos_wait::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { @@ -6149,7 +6218,7 @@ Create_func_master_pos_wait::create_native(THD *thd, LEX_CSTRING *name, Create_func_master_gtid_wait Create_func_master_gtid_wait::s_singleton; Item* -Create_func_master_gtid_wait::create_native(THD *thd, LEX_CSTRING *name, +Create_func_master_gtid_wait::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -6414,7 +6483,7 @@ Create_func_radians::create_1_arg(THD *thd, Item *arg1) Create_func_rand Create_func_rand::s_singleton; Item* -Create_func_rand::create_native(THD *thd, LEX_CSTRING *name, +Create_func_rand::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -6494,7 +6563,7 @@ Create_func_reverse::create_1_arg(THD *thd, Item *arg1) Create_func_round Create_func_round::s_singleton; Item* -Create_func_round::create_native(THD *thd, LEX_CSTRING *name, +Create_func_round::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -6534,7 +6603,7 @@ Create_func_rpad Create_func_rpad::s_singleton; Create_func_rpad_oracle Create_func_rpad_oracle::s_singleton; Item* -Create_func_rpad::create_native_std(THD *thd, LEX_CSTRING *name, +Create_func_rpad::create_native_std(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -6566,7 +6635,7 @@ Create_func_rpad::create_native_std(THD *thd, LEX_CSTRING *name, Item* -Create_func_rpad::create_native_oracle(THD *thd, LEX_CSTRING *name, +Create_func_rpad::create_native_oracle(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { int arg_count= item_list ? item_list->elements : 0; @@ -6747,8 +6816,8 @@ Create_func_substr_index::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *a Create_func_substr_oracle Create_func_substr_oracle::s_singleton; Item* -Create_func_substr_oracle::create_native(THD *thd, LEX_CSTRING *name, - List<Item> *item_list) +Create_func_substr_oracle::create_native(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= item_list ? item_list->elements : 0; @@ -6901,7 +6970,7 @@ Create_func_unhex::create_1_arg(THD *thd, Item *arg1) Create_func_unix_timestamp Create_func_unix_timestamp::s_singleton; Item* -Create_func_unix_timestamp::create_native(THD *thd, LEX_CSTRING *name, +Create_func_unix_timestamp::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; @@ -7040,8 +7109,8 @@ Create_func_wsrep_sync_wait_upto::s_singleton; Item* Create_func_wsrep_sync_wait_upto::create_native(THD *thd, - LEX_CSTRING *name, - List<Item> *item_list) + const LEX_CSTRING *name, + List<Item> *item_list) { Item *func= NULL; int arg_count= 0; @@ -7113,7 +7182,7 @@ Create_func_y::create_1_arg(THD *thd, Item *arg1) Create_func_year_week Create_func_year_week::s_singleton; Item* -Create_func_year_week::create_native(THD *thd, LEX_CSTRING *name, +Create_func_year_week::create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) { Item *func= NULL; diff --git a/sql/item_create.h b/sql/item_create.h index bb129a14d40..5f1103bb60f 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -58,7 +58,8 @@ public: @param item_list The list of arguments to the function, can be NULL @return An item representing the parsed function call, or NULL */ - virtual Item *create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list) = 0; + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, + List<Item> *item_list) = 0; protected: /** Constructor */ @@ -79,7 +80,7 @@ protected: class Create_native_func : public Create_func { public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list); /** @@ -89,7 +90,7 @@ public: @param item_list The function parameters, none of which are named @return An item representing the function call */ - virtual Item *create_native(THD *thd, LEX_CSTRING *name, + virtual Item *create_native(THD *thd, const LEX_CSTRING *name, List<Item> *item_list) = 0; protected: @@ -117,7 +118,7 @@ public: @param item_list The list of arguments to the function, can be NULL @return An item representing the parsed function call */ - virtual Item *create_func(THD *thd, LEX_CSTRING *name, + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list); /** @@ -129,7 +130,9 @@ public: @param item_list The list of arguments to the function, can be NULL @return An item representing the parsed function call */ - virtual Item *create_with_db(THD *thd, LEX_CSTRING *db, LEX_CSTRING *name, + virtual Item *create_with_db(THD *thd, + const LEX_CSTRING *db, + const LEX_CSTRING *name, bool use_explicit_name, List<Item> *item_list) = 0; @@ -167,7 +170,7 @@ extern Create_qfunc * find_qualified_function_builder(THD *thd); class Create_udf_func : public Create_func { public: - virtual Item *create_func(THD *thd, LEX_CSTRING *name, + virtual Item *create_func(THD *thd, const LEX_CSTRING *name, List<Item> *item_list); /** diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index c2a87ee7270..c769e6f0972 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -8506,18 +8506,18 @@ bool LEX::call_statement_start(THD *thd, const LEX_CSTRING &db, if (check_db_name((LEX_STRING*) const_cast<LEX_CSTRING*>(&db))) { my_error(ER_WRONG_DB_NAME, MYF(0), db.str); - return NULL; + return true; } if (check_routine_name(&pkg) || check_routine_name(&proc)) - return NULL; + return true; // Concat `pkg` and `name` to `pkg.name` LEX_CSTRING pkg_dot_proc; if (q_pkg_proc.make_qname(thd->mem_root, &pkg_dot_proc) || check_ident_length(&pkg_dot_proc) || !(spname= new (thd->mem_root) sp_name(&db, &pkg_dot_proc, true))) - return NULL; + return true; sp_handler_package_function.add_used_routine(thd->lex, thd, spname); sp_handler_package_body.add_used_routine(thd->lex, thd, &q_db_pkg); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6775c414402..8561f421ab3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -27263,8 +27263,11 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) if (unit->is_unit_op() || unit->fake_select_lex) { + ulonglong save_options= 0; + if (unit->union_needs_tmp_table() && unit->fake_select_lex) { + save_options= unit->fake_select_lex->options; unit->fake_select_lex->select_number= FAKE_SELECT_LEX_ID; // just for initialization unit->fake_select_lex->type= unit_operation_text[unit->common_op()]; unit->fake_select_lex->options|= SELECT_DESCRIBE; @@ -27275,6 +27278,9 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) if (!is_pushed_union) res= unit->exec(); } + + if (unit->union_needs_tmp_table() && unit->fake_select_lex) + unit->fake_select_lex->options= save_options; } else { diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 8c17a86d4ce..00a06a6e404 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3375,16 +3375,6 @@ static my_bool processlist_callback(THD *tmp, processlist_callback_arg *arg) arg->table->field[11]->store((double) tmp->progress.counter / (double) max_counter*100.0); } - else - { - /* - This is a DECIMAL column without DEFAULT. - restore_record() fills its Field::ptr to zero bytes, - according to pack_length(). But an array of zero bytes - is not a valid decimal. Set it explicitly to 0. - */ - arg->table->field[11]->store((longlong) 0, true); - } mysql_mutex_unlock(&tmp->LOCK_thd_data); } @@ -8859,6 +8849,7 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables) if (bitmap_is_set(table->read_set, i)) { field->move_field(cur); + field->reset(); *to_recinfo++= *from_recinfo; cur+= from_recinfo->length; } @@ -8880,6 +8871,7 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables) to_recinfo->type= FIELD_NORMAL; to_recinfo++; } + store_record(table, s->default_values); p->recinfo= to_recinfo; // TODO switch from Aria to Memory if all blobs were optimized away? diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 7d8b02a0f12..3784a0f5765 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3034,7 +3034,7 @@ sequence_def: if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE)) { thd->parse_error(ER_SYNTAX_ERROR, "RESTART"); - YYABORT; + MYSQL_YYABORT; } if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_restart)) @@ -3046,7 +3046,7 @@ sequence_def: if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE)) { thd->parse_error(ER_SYNTAX_ERROR, "RESTART"); - YYABORT; + MYSQL_YYABORT; } if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_restart)) diff --git a/sql/table.cc b/sql/table.cc index 9b2b4db2b73..c25fdc35dc0 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2387,7 +2387,12 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (flags & VERS_SYSTEM_FIELD) { - switch (handler->real_field_type()) + auto field_type= handler->real_field_type(); + + if (DBUG_EVALUATE_IF("error_vers_wrong_type", 1, 0)) + field_type= MYSQL_TYPE_BLOB; + + switch (field_type) { case MYSQL_TYPE_TIMESTAMP2: break; @@ -2399,9 +2404,13 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, } /* Fallthrough */ default: - my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), fieldnames.type_names[i], - versioned == VERS_TIMESTAMP ? "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED", - table_name.str); + my_error(ER_VERS_FIELD_WRONG_TYPE, + (field_type == MYSQL_TYPE_LONGLONG ? + MYF(0) : MYF(ME_WARNING)), + fieldnames.type_names[i], + (versioned == VERS_TIMESTAMP ? + "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED"), + table_name.str); goto err; } } @@ -8634,9 +8643,6 @@ void TABLE::evaluate_update_default_function() void TABLE::vers_update_fields() { - bitmap_set_bit(write_set, vers_start_field()->field_index); - bitmap_set_bit(write_set, vers_end_field()->field_index); - if (!vers_write) { file->column_bitmaps_signal(); @@ -8645,17 +8651,21 @@ void TABLE::vers_update_fields() if (versioned(VERS_TIMESTAMP)) { + bitmap_set_bit(write_set, vers_start_field()->field_index); if (vers_start_field()->store_timestamp(in_use->query_start(), in_use->query_start_sec_part())) { DBUG_ASSERT(0); } vers_start_field()->set_has_explicit_value(); + bitmap_set_bit(read_set, vers_start_field()->field_index); } + bitmap_set_bit(write_set, vers_end_field()->field_index); vers_end_field()->set_max(); vers_end_field()->set_has_explicit_value(); bitmap_set_bit(read_set, vers_end_field()->field_index); + file->column_bitmaps_signal(); if (vfield) update_virtual_fields(file, VCOL_UPDATE_FOR_READ); diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index 19b56980714..aa29c726d16 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1745,7 +1745,7 @@ ha_rows ha_federatedx::records_in_range(uint inx, key_range *start_key, federatedx_txn *ha_federatedx::get_txn(THD *thd, bool no_create) { - federatedx_txn **txnp= (federatedx_txn **) ha_data(thd); + federatedx_txn **txnp= (federatedx_txn **) thd_ha_data(thd, ht); if (!*txnp && !no_create) *txnp= new federatedx_txn(); return *txnp; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 1ad45509582..bdf1c1aab87 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1247,6 +1247,7 @@ fil_space_create( if ((purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_IMPORT) && !recv_recovery_is_on() + && srv_operation != SRV_OPERATION_BACKUP && id > fil_system.max_assigned_id) { if (!fil_system.space_id_reuse_warned) { fil_system.space_id_reuse_warned = true; |