From f541d3f18eec035242303928aa65558a391d165d Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Mon, 16 Sep 2019 10:40:06 -0700 Subject: [PATCH 01/11] MDEV-20596 Configure fails with newer CMake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix build error with newer cmake Fixes the following build error: CMake Error at cmake/os/Linux.cmake:29 (STRING): STRING sub-command REPLACE requires at least four arguments. Call Stack (most recent call first): CMakeLists.txt:101 (INCLUDE) CMake Error at cmake/os/Linux.cmake:29 (STRING): STRING sub-command REPLACE requires at least four arguments. Call Stack (most recent call first): CMakeLists.txt:101 (INCLUDE) The error happens when CMAKE_SHARED_LINKER_{LANG}_FLAGS is not set. Force the variable to be set to "" as input to prevent this. Signed-off-by: Ryan Coe Signed-off-by: Vicenศ›iu Ciorbaru --- cmake/os/Linux.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake index e37fb284d70..461394c35ce 100644 --- a/cmake/os/Linux.cmake +++ b/cmake/os/Linux.cmake @@ -26,9 +26,9 @@ SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE=1) # Fix CMake (< 2.8) flags. -rdynamic exports too many symbols. FOREACH(LANG C CXX) - STRING(REPLACE "-rdynamic" "" + STRING(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS - ${CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS} + "${CMAKE_SHARED_LIBRARY_LINK_${LANG}_FLAGS}" ) ENDFOREACH() From 38fa0141eed89613b45906a638be19123ee7e706 Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Thu, 12 Sep 2019 12:09:02 +0200 Subject: [PATCH 02/11] Fix spelling mistakes in MyISAM code comments --- storage/myisam/NEWS | 4 ++-- storage/myisam/ft_boolean_search.c | 2 +- storage/myisam/ha_myisam.cc | 4 ++-- storage/myisam/mi_check.c | 10 +++++----- storage/myisam/mi_create.c | 2 +- storage/myisam/mi_delete.c | 2 +- storage/myisam/mi_dynrec.c | 4 ++-- storage/myisam/mi_extra.c | 4 ++-- storage/myisam/mi_key.c | 2 +- storage/myisam/mi_locking.c | 2 +- storage/myisam/mi_packrec.c | 2 +- storage/myisam/mi_rfirst.c | 2 +- storage/myisam/mi_search.c | 2 +- storage/myisam/mi_test_all.sh | 4 ++-- storage/myisam/myisamchk.c | 2 +- storage/myisam/myisamdef.h | 2 +- storage/myisam/myisamlog.c | 2 +- storage/myisam/myisampack.c | 4 ++-- storage/myisam/sort.c | 2 +- 19 files changed, 29 insertions(+), 29 deletions(-) diff --git a/storage/myisam/NEWS b/storage/myisam/NEWS index bb1f141610b..302adacf942 100644 --- a/storage/myisam/NEWS +++ b/storage/myisam/NEWS @@ -26,7 +26,7 @@ New features compared to NISAM: - Index on BLOB and VARCHAR. - One can now have NULL in an index. This takes 0-1 bytes / key. - MYISAM will allow one to specify one AUTO_INCREMENT column; MYISAM will - automaticly update this on INSERT/UPDATE. The AUTO_INCREMENT value can be + automatically update this on INSERT/UPDATE. The AUTO_INCREMENT value can be reset with myisamchk. - Max key length will be 500 by default; In cases of longer keys than 250, a bigger key block size than the default of 1024 byes is used for this key. @@ -39,7 +39,7 @@ New features compared to NISAM: - 'myisamchk -a' stores statistic for key parts (and not only for whole keys as in NISAM). - Dynamic size rows will now be much less fragmented when mixing deletes with - update and insert. This is done by automaticly combine adjacent deleted + update and insert. This is done by automatically combining adjacent deleted blocks and by extending blocks if the next block is deleted. - For dynamic size rows, the delete link contains a pointer to itself (to make repairs easier). diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index b9ab23b93be..140b6c1d583 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -335,7 +335,7 @@ static int _ftb_no_dupes_cmp(void* not_used __attribute__((unused)), When performing prefix search (a word with truncation operator), we must preserve original prefix to ensure that characters which may be expanded/contracted do not break the prefix. This is done by storing - newly found key immediatly after the original word in ftbw->word + newly found key immediately after the original word in ftbw->word buffer. ftbw->word= LENGTH WORD [ LENGTH1 WORD1 ] WEIGHT REFERENCE diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 7aab938f383..57f69044ba3 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -730,8 +730,8 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) growing files. Using an open_flag instead of calling mi_extra(... HA_EXTRA_MMAP ...) after mi_open() has the advantage that the mapping is not repeated for every open, but just done on the initial - open, when the MyISAM share is created. Everytime the server - requires to open a new instance of a table it calls this method. We + open, when the MyISAM share is created. Every time the server + requires opening a new instance of a table it calls this method. We will always supply HA_OPEN_MMAP for a permanent table. However, the MyISAM storage engine will ignore this flag if this is a secondary open of a table that is in use by other threads already (if the diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 35ec615d99b..f36fffbdd1d 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -288,7 +288,7 @@ static int check_k_link(HA_CHECK *param, register MI_INFO *info, uint nr) /* Read the key block with MI_MIN_KEY_BLOCK_LENGTH to find next link. If the key cache block size is smaller than block_size, we can so - avoid unecessary eviction of cache block. + avoid unnecessary eviction of cache block. */ if (!(buff=key_cache_read(info->s->key_cache, info->s->kfile, next_link, DFLT_INIT_HITS, @@ -1900,7 +1900,7 @@ int flush_blocks(HA_CHECK *param, KEY_CACHE *key_cache, File file, } /* flush_blocks */ - /* Sort index for more efficent reads */ + /* Sort index for more efficient reads */ int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name) { @@ -3043,13 +3043,13 @@ err: /* Destroy the write cache. The master thread did already detach from the share by remove_io_thread() or it was not yet started (if the - error happend before creating the thread). + error happened before creating the thread). */ (void) end_io_cache(&info->rec_cache); /* Destroy the new data cache in case of non-quick repair. All slave threads did either detach from the share by remove_io_thread() - already or they were not yet started (if the error happend before + already or they were not yet started (if the error happened before creating the threads). */ if (!rep_quick && my_b_inited(&new_data_cache)) @@ -4585,7 +4585,7 @@ void update_auto_increment_key(HA_CHECK *param, MI_INFO *info, keypart_k=c_k for arbitrary constants c_1 ... c_k) = {assuming that values have uniform distribution and index contains all - tuples from the domain (or that {c_1, ..., c_k} tuple is choosen from + tuples from the domain (or that {c_1, ..., c_k} tuple is chosen from index tuples} = #tuples-in-the-index / #distinct-tuples-in-the-index. diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 9a3a7788587..906f95f6e62 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -607,7 +607,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, klinkname_ptr= klinkname; /* Don't create the table if the link or file exists to ensure that one - doesn't accidently destroy another table. + doesn't accidentally destroy another table. */ create_flag=0; } diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c index 4930ba78eb1..d36c9fba0b2 100644 --- a/storage/myisam/mi_delete.c +++ b/storage/myisam/mi_delete.c @@ -327,7 +327,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, { DBUG_PRINT("error",("Didn't find key")); mi_print_error(info->s, HA_ERR_CRASHED); - my_errno=HA_ERR_CRASHED; /* This should newer happend */ + my_errno=HA_ERR_CRASHED; /* This should never happen */ goto err; } save_flag=0; diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index cfe5a17c9f0..1fd2830dc0e 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -885,8 +885,8 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record, /* Check if next block is a deleted block Above we have MI_MIN_BLOCK_LENGTH to avoid the problem where - the next block is so small it can't be splited which could - casue problems + the next block is so small it can't be split which could + cause problems */ MI_BLOCK_INFO del_block; diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index cc3d7183458..f68c1339488 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -211,7 +211,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) info->read_record= share->read_record; info->opt_flag&= ~(KEY_READ_USED | REMEMBER_OLD_POS); break; - case HA_EXTRA_NO_USER_CHANGE: /* Database is somehow locked agains changes */ + case HA_EXTRA_NO_USER_CHANGE: /* Database is somehow locked against changes */ info->lock_type= F_EXTRA_LCK; /* Simulate as locked */ break; case HA_EXTRA_WAIT_LOCK: @@ -349,7 +349,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) if (share->base.blobs) mi_alloc_rec_buff(info, -1, &info->rec_buff); break; - case HA_EXTRA_NORMAL: /* Theese isn't in use */ + case HA_EXTRA_NORMAL: /* These aren't in use */ info->quick_mode=0; break; case HA_EXTRA_QUICK: diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c index b5ca83600e6..c81bc674685 100644 --- a/storage/myisam/mi_key.c +++ b/storage/myisam/mi_key.c @@ -605,7 +605,7 @@ ulonglong retrieve_auto_increment(MI_INFO *info,const uchar *record) } /* - The following code works becasue if s_value < 0 then value is 0 + The following code works because if s_value < 0 then value is 0 and if s_value == 0 then value will contain either s_value or the correct value. */ diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index 33260ee9fd5..71fbdabae2d 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -448,7 +448,7 @@ my_bool mi_check_status(void *param) @param org_table @param new_table that should point on org_lock. new_table is 0 - in case this is the first occurence of the table in the lock + in case this is the first occurrence of the table in the lock structure. */ diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index 362c4867e0d..5319e7390a3 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -810,7 +810,7 @@ static void (*get_unpack_function(MI_COLUMNDEF *rec)) return &uf_varchar2; case FIELD_LAST: default: - return 0; /* This should never happend */ + return 0; /* This should never happen */ } } diff --git a/storage/myisam/mi_rfirst.c b/storage/myisam/mi_rfirst.c index 7bfe87867ee..26f6921bdf9 100644 --- a/storage/myisam/mi_rfirst.c +++ b/storage/myisam/mi_rfirst.c @@ -16,7 +16,7 @@ #include "myisamdef.h" - /* Read first row through a specfic key */ + /* Read first row through a specific key */ int mi_rfirst(MI_INFO *info, uchar *buf, int inx) { diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 85ea136a4c6..1bd5f4983bc 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -433,7 +433,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, /* If prefix_len > cmplen then we are in the end-space comparison - phase. Do not try to acces the key any more ==> left= 0. + phase. Do not try to access the key any more ==> left= 0. */ left= ((len <= cmplen) ? suffix_len : ((prefix_len < cmplen) ? cmplen - prefix_len : 0)); diff --git a/storage/myisam/mi_test_all.sh b/storage/myisam/mi_test_all.sh index af0a3d4e769..fdd81becff5 100755 --- a/storage/myisam/mi_test_all.sh +++ b/storage/myisam/mi_test_all.sh @@ -19,8 +19,8 @@ # MA 02110-1335 USA # -# Execute some simple basic test on MyISAM libary to check if things -# works at all. +# Execute some simple basic tests on the MyISAM library to check if +# things work at all. valgrind="valgrind --alignment=8 --leak-check=yes" silent="-s" diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index bb035e6b157..a9f67fad84a 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -373,7 +373,7 @@ static void usage(void) puts("Check options (check is the default action for myisamchk):\n\ -c, --check Check table for errors.\n\ - -e, --extend-check Check the table VERY throughly. Only use this in\n\ + -e, --extend-check Check the table VERY thoroughly. Only use this in\n\ extreme cases as myisamchk should normally be able to\n\ find out if the table is ok even without this switch.\n\ -F, --fast Check only tables that haven't been closed properly.\n\ diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index a019d7f2351..67e9b99ecfe 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -192,7 +192,7 @@ typedef struct st_mi_isam_share ulong last_process; /* For table-change-check */ ulong last_version; /* Version on start */ ulong options; /* Options used */ - ulong min_pack_length; /* Theese are used by packed data */ + ulong min_pack_length; /* These are used by packed data */ ulong max_pack_length; ulong state_diff_length; uint rec_reflength; /* rec_reflength in use now */ diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 3880826d981..eeb754d2cc9 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -415,7 +415,7 @@ static int examine_log(char * file_name, char **table_names) left_root_right); file_info.id=open_param.max_id+1; /* - * In the line below +10 is added to accomodate '<' and '>' chars + * In the line below +10 is added to accommodate '<' and '>' chars * plus '\0' at the end, so that there is place for 7 digits. * It is improbable that same table can have that many entries in * the table cache. diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index f8d76d8770b..a331bf890f7 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -108,7 +108,7 @@ typedef struct st_isam_mrg { MI_INFO **file,**current,**end; uint free_file; uint count; - uint min_pack_length; /* Theese is used by packed data */ + uint min_pack_length; /* These are used by packed data */ uint max_pack_length; uint ref_length; uint max_blob_length; @@ -1237,7 +1237,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, huff_counts->counts[0]=0; goto found_pack; } - /* Remeber the number of significant spaces. */ + /* Remember the number of significant spaces. */ old_space_count=huff_counts->counts[' ']; /* Add all leading and trailing spaces. */ huff_counts->counts[' ']+= (huff_counts->tot_end_space + diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index c07b1347ed4..fe35c1ba2ce 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -815,7 +815,7 @@ cleanup: buffpek Where to read from sort_length max length to read RESULT - > 0 Ammount of bytes read + > 0 Number of bytes read -1 Error */ From 13274032af7480c6b99e9df3502dfb852116080e Mon Sep 17 00:00:00 2001 From: chriscalender Date: Sun, 24 Mar 2019 23:25:20 -0400 Subject: [PATCH 03/11] MDEV-4968 Old advices in mysql-log-rotate script * Change the comments in mysql-log-rotate.sh to refer to mysqld, not mysqld_safe as that's what most distros are using. * Change err-log to log-error as err-log is no longer valid. * Convert tab to space for consistency. --- support-files/mysql-log-rotate.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/support-files/mysql-log-rotate.sh b/support-files/mysql-log-rotate.sh index 0ee78b0f7ca..605334d2d75 100644 --- a/support-files/mysql-log-rotate.sh +++ b/support-files/mysql-log-rotate.sh @@ -1,9 +1,9 @@ # This logname can be set in /etc/my.cnf -# by setting the variable "err-log" -# in the [safe_mysqld] section as follows: +# by setting the variable "log-error" +# in the [mysqld] section as follows: # -# [safe_mysqld] -# err-log=@localstatedir@/mysqld.log +# [mysqld] +# log-error=@localstatedir@/mysqld.log # # If the root user has a password you have to create a # /root/.my.cnf configuration file with the following @@ -21,7 +21,7 @@ @localstatedir@/mysqld.log { # create 600 mysql mysql notifempty - daily + daily rotate 3 missingok compress From fd3ad41eed70e201dc6fef4d302d9e748e478358 Mon Sep 17 00:00:00 2001 From: rantal Date: Mon, 16 Sep 2019 22:36:19 +0300 Subject: [PATCH 04/11] Update mysqld_safe.sh - introduce defaults-group-suffix handling "--defaults-group-suffix" must be be given as the first argument on the command-line of mysqld --- scripts/mysqld_safe.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 46b37689093..08a6a2b83f0 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -21,6 +21,7 @@ mysqld_ld_library_path= flush_caches=0 numa_interleave=0 unsafe_my_cnf=0 +defaults_group_suffix= # Initial logging status: error log is not open, and not using syslog logging=init @@ -265,6 +266,8 @@ parse_arguments() { --flush-caches) flush_caches=1 ;; --numa-interleave) numa_interleave=1 ;; + --defaults-group-suffix=*) defaults_group_suffix="$arg" ;; + --help) usage ;; *) @@ -845,7 +848,7 @@ then exit 1 fi -for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \ +for i in "$ledir/$MYSQLD" "$defaults_group_suffix" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \ "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION" do cmd="$cmd "`shell_quote_string "$i"` From e157f817713f22f26b584155faa38b121deff222 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 23 Sep 2019 10:41:13 +0300 Subject: [PATCH 05/11] Remove Field::is_stat_field completely --- sql/field.cc | 1 - sql/field.h | 3 --- 2 files changed, 4 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index 99cda09f2bb..1e1de972e86 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1767,7 +1767,6 @@ Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, comment.str= (char*) ""; comment.length=0; field_index= 0; - is_stat_field= FALSE; cond_selectivity= 1.0; next_equal_field= NULL; } diff --git a/sql/field.h b/sql/field.h index 35f531ac4ab..187ad7674d6 100644 --- a/sql/field.h +++ b/sql/field.h @@ -729,9 +729,6 @@ public: */ bool is_created_from_null_item; - /* TRUE in Field objects created for column min/max values */ - bool is_stat_field; - /* Selectivity of the range condition over this field. When calculating this selectivity a range predicate From ab9f378b0bed85f67cdaf5868af19f814e6bdfe1 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Mon, 23 Sep 2019 13:47:52 +0530 Subject: [PATCH 06/11] Backporting 273d8eb12c40a6dcd05a8148bdfba3f1fd96e764 Proper fix for disabling warnings in read_statistics_for_table() --- mysql-test/include/ctype_utf8_ilseq.inc | 1 + mysql-test/r/compare.result | 20 +++++++ mysql-test/r/ctype_uca.result | 46 ++------------- mysql-test/r/ctype_uca_innodb.result | 31 +--------- mysql-test/r/ctype_utf8.result | 77 +++---------------------- mysql-test/r/processlist.result | 4 -- mysql-test/r/range.result | 10 ---- mysql-test/r/range_mrr_icp.result | 10 ---- mysql-test/t/compare.test | 14 +++++ sql/field.cc | 37 ++++++------ sql/field.h | 6 +- sql/sql_statistics.cc | 15 +++-- 12 files changed, 85 insertions(+), 186 deletions(-) diff --git a/mysql-test/include/ctype_utf8_ilseq.inc b/mysql-test/include/ctype_utf8_ilseq.inc index 1bb009f2a8b..3586946659e 100644 --- a/mysql-test/include/ctype_utf8_ilseq.inc +++ b/mysql-test/include/ctype_utf8_ilseq.inc @@ -14,6 +14,7 @@ SHOW CREATE TABLE t1; INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin๐Œ†'; +EXPLAIN SELECT ch FROM t1 WHERE ch='admin๐Œ†'; SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin๐Œ†'; SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin๐Œ†'; DELETE FROM t1; diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result index ea8111cc3ce..b06847f09ed 100644 --- a/mysql-test/r/compare.result +++ b/mysql-test/r/compare.result @@ -100,3 +100,23 @@ CREATE TABLE t1(a INT ZEROFILL); SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2; 1 DROP TABLE t1; +CREATE TABLE t1 (a char(2), index (a)); +insert into t1 values ("aa"),("bb"); +select * from t1 where a="aa"; +a +aa +select * from t1 where a="aaa"; +a +select * from t1 where a="aa "; +a +aa +select * from t1 where a>="aaa"; +a +bb +explain select * from t1 where a="aaa"; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 3 const 1 Using where; Using index +explain select * from t1 where a="aa "; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 3 const 1 Using where; Using index +drop table t1; diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index d3a51c975a2..69611b2a7ed 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -6748,14 +6748,13 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN SELECT ch FROM t1 WHERE ch='admin๐Œ†'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin๐Œ†'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -6771,22 +6770,14 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a @@ -6829,8 +6820,6 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a @@ -6850,14 +6839,10 @@ ab az aะ€ aึ€ -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†b' ORDER BY ch; ch a @@ -6877,8 +6862,6 @@ ab az aะ€ aึ€ -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; ch z @@ -6889,24 +6872,16 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; ch z -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†b' ORDER BY ch; ch z -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 ALTER TABLE t1 DROP KEY ch; # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); @@ -6992,14 +6967,13 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN SELECT ch FROM t1 WHERE ch='admin๐Œ†'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin๐Œ†'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -7015,22 +6989,14 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a diff --git a/mysql-test/r/ctype_uca_innodb.result b/mysql-test/r/ctype_uca_innodb.result index bd6f3b8a21f..7c64f17190e 100644 --- a/mysql-test/r/ctype_uca_innodb.result +++ b/mysql-test/r/ctype_uca_innodb.result @@ -23,14 +23,13 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN SELECT ch FROM t1 WHERE ch='admin๐Œ†'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin๐Œ†'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -46,22 +45,14 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a @@ -104,8 +95,6 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a @@ -125,14 +114,10 @@ ab az aะ€ aึ€ -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†b' ORDER BY ch; ch a @@ -152,8 +137,6 @@ ab az aะ€ aึ€ -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; ch z @@ -164,24 +147,16 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; ch z -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†b' ORDER BY ch; ch z -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 ALTER TABLE t1 DROP KEY ch; # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index fe873a54edb..2f5b0eecc92 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5467,14 +5467,13 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN SELECT ch FROM t1 WHERE ch='admin๐Œ†'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin๐Œ†'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -5490,22 +5489,14 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a @@ -5548,8 +5539,6 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a @@ -5569,14 +5558,10 @@ ab az aะ€ aึ€ -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†b' ORDER BY ch; ch a @@ -5596,8 +5581,6 @@ ab az aะ€ aึ€ -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; ch z @@ -5608,24 +5591,16 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; ch z -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†b' ORDER BY ch; ch z -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 ALTER TABLE t1 DROP KEY ch; # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); @@ -5711,14 +5686,13 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN SELECT ch FROM t1 WHERE ch='admin๐Œ†'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin๐Œ†'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -5734,22 +5708,14 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a @@ -5792,8 +5758,6 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a @@ -5813,14 +5777,10 @@ ab az aะ€ aึ€ -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a๐Œ†b' ORDER BY ch; ch a @@ -5840,8 +5800,6 @@ ab az aะ€ aึ€ -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; ch z @@ -5852,24 +5810,16 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†' ORDER BY ch; ch z -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a๐Œ†b' ORDER BY ch; ch z -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 ALTER TABLE t1 DROP KEY ch; # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); @@ -5955,14 +5905,13 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN SELECT ch FROM t1 WHERE ch='admin๐Œ†'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin๐Œ†'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin๐Œ†'; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -5978,22 +5927,14 @@ EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a๐Œ†b' ORDER BY ch; ch -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a๐Œ†' ORDER BY ch; ch a diff --git a/mysql-test/r/processlist.result b/mysql-test/r/processlist.result index ab518d961ef..4be643c1790 100644 --- a/mysql-test/r/processlist.result +++ b/mysql-test/r/processlist.result @@ -36,10 +36,6 @@ SELECT INFO, INFO_BINARY, 'xxx๐Ÿ˜Žyyy' AS utf8mb4_string FROM INFORMATION_SCHEMA INFO SELECT INFO, INFO_BINARY, 'xxx????yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%' INFO_BINARY SELECT INFO, INFO_BINARY, 'xxx๐Ÿ˜Žyyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%' utf8mb4_string xxx๐Ÿ˜Žyyy -Warnings: -Level Warning -Code 1366 -Message Incorrect string value: '\xF0\x9F\x98\x8Eyy...' for column `information_schema`.`(temporary)`.`INFO` at row 1 # # End of 10.1 tests # diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 406e5c774cf..b55b462c8ef 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2077,23 +2077,15 @@ explain SELECT * FROM t1 WHERE fd='๐Ÿ˜'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 SELECT * FROM t1 WHERE fd='๐Ÿ˜'; id fd -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 # The following must not use range access: explain select count(*) from t1 where fd <'๐Ÿ˜'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 select count(*) from t1 where fd <'๐Ÿ˜'; count(*) 40960 -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 select count(*) from t1 ignore index (ix_fd) where fd <'๐Ÿ˜'; count(*) 40960 @@ -2314,8 +2306,6 @@ INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'); EXPLAIN SELECT * FROM t1 WHERE a<=>'๐Ÿ˜Ž'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; # # MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index e31901fdb26..2584fc5a8bf 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2079,23 +2079,15 @@ explain SELECT * FROM t1 WHERE fd='๐Ÿ˜'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 SELECT * FROM t1 WHERE fd='๐Ÿ˜'; id fd -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 # The following must not use range access: explain select count(*) from t1 where fd <'๐Ÿ˜'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 select count(*) from t1 where fd <'๐Ÿ˜'; count(*) 40960 -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 select count(*) from t1 ignore index (ix_fd) where fd <'๐Ÿ˜'; count(*) 40960 @@ -2316,8 +2308,6 @@ INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'); EXPLAIN SELECT * FROM t1 WHERE a<=>'๐Ÿ˜Ž'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; # # MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test index d2b2a7e5523..38bda6754d8 100644 --- a/mysql-test/t/compare.test +++ b/mysql-test/t/compare.test @@ -94,3 +94,17 @@ DROP TABLE t1; CREATE TABLE t1(a INT ZEROFILL); SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2; DROP TABLE t1; + +# +# Check what happens when comparing to long string +# + +CREATE TABLE t1 (a char(2), index (a)); +insert into t1 values ("aa"),("bb"); +select * from t1 where a="aa"; +select * from t1 where a="aaa"; +select * from t1 where a="aa "; +select * from t1 where a>="aaa"; +explain select * from t1 where a="aaa"; +explain select * from t1 where a="aa "; +drop table t1; diff --git a/sql/field.cc b/sql/field.cc index fd4cd8d5c54..a23004ebd96 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -79,7 +79,7 @@ const char field_separator=','; ptr < table->record[0] + table->s->reclength)))) #define ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED \ - DBUG_ASSERT(is_stat_field || !table || \ + DBUG_ASSERT(!table || \ (!table->write_set || \ bitmap_is_set(table->write_set, field_index) || \ (!(ptr >= table->record[0] && \ @@ -1822,8 +1822,7 @@ Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, flags=null_ptr ? 0: NOT_NULL_FLAG; comment.str= (char*) ""; comment.length=0; - field_index= 0; - is_stat_field= FALSE; + field_index= 0; cond_selectivity= 1.0; next_equal_field= NULL; } @@ -2436,8 +2435,7 @@ Field *Field::clone(MEM_ROOT *root, TABLE *new_table) } -Field *Field::clone(MEM_ROOT *root, TABLE *new_table, my_ptrdiff_t diff, - bool stat_flag) +Field *Field::clone(MEM_ROOT *root, TABLE *new_table, my_ptrdiff_t diff) { Field *tmp; if ((tmp= (Field*) memdup_root(root,(char*) this,size_of()))) @@ -2446,7 +2444,6 @@ Field *Field::clone(MEM_ROOT *root, TABLE *new_table, my_ptrdiff_t diff, tmp->init(new_table); tmp->move_field_offset(diff); } - tmp->is_stat_field= stat_flag; return tmp; } @@ -2829,7 +2826,7 @@ int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs) /* Write digits of the frac_% parts ; - Depending on get_thd()->count_cutted_fields, we may also want + Depending on get_thd()->count_cuted_fields, we may also want to know if some non-zero tail of these parts will be truncated (for example, 0.002->0.00 will generate a warning, while 0.000->0.00 will not) @@ -7069,7 +7066,7 @@ Field_longstr::check_string_copy_error(const String_copier *copier, if (!(pos= copier->most_important_error_pos())) return FALSE; - if (!is_stat_field) + if (get_thd()->count_cuted_fields) { convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6); set_warning_truncated_wrong_value("string", tmp); @@ -7102,8 +7099,9 @@ int Field_longstr::report_if_important_data(const char *pstr, const char *end, bool count_spaces) { - THD *thd= get_thd(); - if ((pstr < end) && thd->count_cuted_fields) + THD *thd; + if ((pstr < end) && + (thd=get_thd())->count_cuted_fields) { if (test_if_important_data(field_charset, pstr, end)) { @@ -7114,7 +7112,8 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end, return 2; } else if (count_spaces) - { /* If we lost only spaces then produce a NOTE, not a WARNING */ + { + /* If we lost only spaces then produce a NOTE, not a WARNING */ set_note(WARN_DATA_TRUNCATED, 1); return 2; } @@ -11054,13 +11053,17 @@ void Field::set_warning_truncated_wrong_value(const char *type_arg, const char *value) { THD *thd= get_thd(); - const char *db_name= table->s->db.str; - const char *table_name= table->s->table_name.str; + const char *db_name; + const char *table_name; + /* + table has in the past been 0 in case of wrong calls when processing + statistics tables. Let's protect against that. + */ + DBUG_ASSERT(table); - if (!db_name) - db_name= ""; - if (!table_name) - table_name= ""; + db_name= (table && table->s->db.str) ? table->s->db.str : ""; + table_name= (table && table->s->table_name.str) ? + table->s->table_name.str : ""; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, diff --git a/sql/field.h b/sql/field.h index 3f027868c3c..fa27b0d10a6 100644 --- a/sql/field.h +++ b/sql/field.h @@ -781,9 +781,6 @@ public: */ bool is_created_from_null_item; - /* TRUE in Field objects created for column min/max values */ - bool is_stat_field; - /* Selectivity of the range condition over this field. When calculating this selectivity a range predicate @@ -1218,8 +1215,7 @@ public: uchar *new_ptr, uint32 length, uchar *new_null_ptr, uint new_null_bit); Field *clone(MEM_ROOT *mem_root, TABLE *new_table); - Field *clone(MEM_ROOT *mem_root, TABLE *new_table, my_ptrdiff_t diff, - bool stat_flag= FALSE); + Field *clone(MEM_ROOT *mem_root, TABLE *new_table, my_ptrdiff_t diff); inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg) { ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 578d3fac641..7bf8fd676d4 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -1044,6 +1044,9 @@ public: { char buff[MAX_FIELD_WIDTH]; String val(buff, sizeof(buff), &my_charset_bin); + my_bitmap_map *old_map; + + old_map= dbug_tmp_use_all_columns(stat_table, stat_table->read_set); for (uint i= COLUMN_STAT_MIN_VALUE; i <= COLUMN_STAT_HISTOGRAM; i++) { @@ -1102,6 +1105,7 @@ public: } } } + dbug_tmp_restore_column_map(stat_table->read_set, old_map); } @@ -1153,14 +1157,12 @@ public: case COLUMN_STAT_MIN_VALUE: table_field->read_stats->min_value->set_notnull(); stat_field->val_str(&val); - DBUG_ASSERT(table_field->read_stats->min_value->is_stat_field); table_field->read_stats->min_value->store(val.ptr(), val.length(), &my_charset_bin); break; case COLUMN_STAT_MAX_VALUE: table_field->read_stats->max_value->set_notnull(); stat_field->val_str(&val); - DBUG_ASSERT(table_field->read_stats->min_value->is_stat_field); table_field->read_stats->max_value->store(val.ptr(), val.length(), &my_charset_bin); break; @@ -1980,7 +1982,7 @@ void create_min_max_statistical_fields_for_table(TABLE *table) my_ptrdiff_t diff= record-table->record[0]; if (!bitmap_is_set(table->read_set, table_field->field_index)) continue; - if (!(fld= table_field->clone(&table->mem_root, table, diff, TRUE))) + if (!(fld= table_field->clone(&table->mem_root, table, diff))) continue; if (i == 0) table_field->collected_stats->min_value= fld; @@ -2047,7 +2049,7 @@ void create_min_max_statistical_fields_for_table_share(THD *thd, Field *fld; Field *table_field= *field_ptr; my_ptrdiff_t diff= record - table_share->default_values; - if (!(fld= table_field->clone(&stats_cb->mem_root, NULL, diff, TRUE))) + if (!(fld= table_field->clone(&stats_cb->mem_root, NULL, diff))) continue; if (i == 0) table_field->read_stats->min_value= fld; @@ -2995,9 +2997,13 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables) KEY *key_info, *key_info_end; TABLE_SHARE *table_share= table->s; Table_statistics *read_stats= table_share->stats_cb.table_stats; + enum_check_fields old_check_level= thd->count_cuted_fields; DBUG_ENTER("read_statistics_for_table"); + /* Don't write warnings for internal field conversions */ + thd->count_cuted_fields= CHECK_FIELD_IGNORE; + /* Read statistics from the statistical table table_stats */ stat_table= stat_tables[TABLE_STAT].table; Table_stat table_stat(stat_table, table); @@ -3078,6 +3084,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables) } table->stats_is_read= TRUE; + thd->count_cuted_fields= old_check_level; DBUG_RETURN(0); } From 67b0faa29e59387b74ae8547c96cf0f31fc3d9d1 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 24 Sep 2019 10:46:18 +0400 Subject: [PATCH 07/11] MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal Also fixes: MDEV-20560 Assertion `precision > 0' failed in decimal_bin_size upon SELECT with MOD short unsigned decimal Changing the way how Item_func_mod calculates its max_length. It now uses decimal_precision(), decimal_scale() and unsigned_flag of its arguments, like all other Item_num_op descendants do. --- mysql-test/r/ctype_binary.result | 2 +- mysql-test/r/ctype_cp1251.result | 2 +- mysql-test/r/ctype_latin1.result | 2 +- mysql-test/r/ctype_ucs.result | 2 +- mysql-test/r/ctype_utf8.result | 2 +- mysql-test/r/func_math.result | 58 +++++++++++++++++++++++++ mysql-test/r/func_time.result | 2 +- mysql-test/r/type_newdecimal.result | 67 +++++++++++++++++++++++++++++ mysql-test/t/func_math.test | 38 ++++++++++++++++ mysql-test/t/type_newdecimal.test | 45 +++++++++++++++++++ sql/item_func.cc | 9 +++- 11 files changed, 222 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index 3fc440b8354..fd709176ea9 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -102,7 +102,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(1) DEFAULT NULL + `c1` varbinary(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 9d5dea2f286..426a06165a7 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -494,7 +494,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index db9d03a8656..4273f71bac9 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -676,7 +676,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) DEFAULT NULL + `c1` varchar(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 1c9e31d3a06..a49050e6e94 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -1492,7 +1492,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index fee27ef177f..6829b19f59d 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -2313,7 +2313,7 @@ create table t1 as select concat(1 % 2) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(-1)); diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 66bbb25b309..6edaa2e4d96 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -771,5 +771,63 @@ STDDEV_SAMP(ROUND('0', 309)) 0 DROP TABLE t1; # +# MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal +# +# Testing that dyadic arithmetic operations are symmetric +# for (+1) and (-1) and produce the same length in CONCAT(), +# because (+1) and (-1) have the same data type: signed int. +CREATE TABLE t1 AS SELECT +CONCAT(+1%2.0), +CONCAT(-1%2.0), +CONCAT(+1/2.0), +CONCAT(-1/2.0), +CONCAT(+1*2.0), +CONCAT(-1*2.0), +CONCAT(+1+2.0), +CONCAT(-1+2.0), +CONCAT(+1-2.0), +CONCAT(-1-2.0); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CONCAT(+1%2.0)` varchar(4) DEFAULT NULL, + `CONCAT(-1%2.0)` varchar(4) DEFAULT NULL, + `CONCAT(+1/2.0)` varchar(8) DEFAULT NULL, + `CONCAT(-1/2.0)` varchar(8) DEFAULT NULL, + `CONCAT(+1*2.0)` varchar(5) NOT NULL DEFAULT '', + `CONCAT(-1*2.0)` varchar(5) NOT NULL DEFAULT '', + `CONCAT(+1+2.0)` varchar(5) NOT NULL DEFAULT '', + `CONCAT(-1+2.0)` varchar(5) NOT NULL DEFAULT '', + `CONCAT(+1-2.0)` varchar(5) NOT NULL DEFAULT '', + `CONCAT(-1-2.0)` varchar(5) NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +CONCAT(+1%2), +CONCAT(-1%2), +CONCAT(+1/2), +CONCAT(-1/2), +CONCAT(+1*2), +CONCAT(-1*2), +CONCAT(+1+2), +CONCAT(-1+2), +CONCAT(+1-2), +CONCAT(-1-2); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CONCAT(+1%2)` varchar(2) DEFAULT NULL, + `CONCAT(-1%2)` varchar(2) DEFAULT NULL, + `CONCAT(+1/2)` varchar(7) DEFAULT NULL, + `CONCAT(-1/2)` varchar(7) DEFAULT NULL, + `CONCAT(+1*2)` varchar(3) NOT NULL DEFAULT '', + `CONCAT(-1*2)` varchar(3) NOT NULL DEFAULT '', + `CONCAT(+1+2)` varchar(3) NOT NULL DEFAULT '', + `CONCAT(-1+2)` varchar(3) NOT NULL DEFAULT '', + `CONCAT(+1-2)` varchar(3) NOT NULL DEFAULT '', + `CONCAT(-1-2)` varchar(3) NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 9d478b10d8a..90091ac55c5 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2100,7 +2100,7 @@ CREATE TABLE t2 AS SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `f2` varchar(26) DEFAULT NULL + `f2` varchar(28) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; f2 diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 81d1637947c..96053e5a12c 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -2039,3 +2039,70 @@ t1 CREATE TABLE `t1` ( `1.0 * 2.000` decimal(6,4) NOT NULL DEFAULT '0.0000' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +# +# MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal +# +CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); +CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); +CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; +# +# MDEV-20560 Assertion `precision > 0' failed in decimal_bin_size upon SELECT with MOD short unsigned decimal +# +CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1.0),(2.0); +SELECT DISTINCT 1 MOD a FROM t1; +1 MOD a +0 +1 +CREATE TABLE t2 AS SELECT DISTINCT 1 MOD a AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1.0),(2.0); +SELECT DISTINCT 1 MOD a FROM t1; +1 MOD a +0 +1 +CREATE TABLE t2 AS SELECT DISTINCT CAST(1 AS UNSIGNED) MOD a AS f FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f` decimal(1,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +# +# End of 5.5 tests +# diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index d31b33b5df9..1b5fa519c09 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -576,6 +576,44 @@ INSERT INTO t1 VALUES (1),(2); SELECT STDDEV_SAMP(ROUND('0', 309)) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal +--echo # + +--echo # Testing that dyadic arithmetic operations are symmetric +--echo # for (+1) and (-1) and produce the same length in CONCAT(), +--echo # because (+1) and (-1) have the same data type: signed int. + +CREATE TABLE t1 AS SELECT + CONCAT(+1%2.0), + CONCAT(-1%2.0), + CONCAT(+1/2.0), + CONCAT(-1/2.0), + CONCAT(+1*2.0), + CONCAT(-1*2.0), + CONCAT(+1+2.0), + CONCAT(-1+2.0), + CONCAT(+1-2.0), + CONCAT(-1-2.0); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT + CONCAT(+1%2), + CONCAT(-1%2), + CONCAT(+1/2), + CONCAT(-1/2), + CONCAT(+1*2), + CONCAT(-1*2), + CONCAT(+1+2), + CONCAT(-1+2), + CONCAT(+1-2), + CONCAT(-1-2); +SHOW CREATE TABLE t1; +DROP TABLE t1; + + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index adc8eb77198..52d014c6b5f 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1625,3 +1625,48 @@ SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal +--echo # + +CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); +CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL); +CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (d DECIMAL(1,0) UNSIGNED); +CREATE TABLE t2 AS SELECT CAST(0 AS UNSIGNED) MOD d AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-20560 Assertion `precision > 0' failed in decimal_bin_size upon SELECT with MOD short unsigned decimal +--echo # + +CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1.0),(2.0); +SELECT DISTINCT 1 MOD a FROM t1; +CREATE TABLE t2 AS SELECT DISTINCT 1 MOD a AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a DECIMAL(1,0) UNSIGNED); +INSERT INTO t1 VALUES (1.0),(2.0); +SELECT DISTINCT 1 MOD a FROM t1; +CREATE TABLE t2 AS SELECT DISTINCT CAST(1 AS UNSIGNED) MOD a AS f FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/sql/item_func.cc b/sql/item_func.cc index dad4b89b3bc..f079e5c83db 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2056,8 +2056,11 @@ my_decimal *Item_func_mod::decimal_op(my_decimal *decimal_value) void Item_func_mod::result_precision() { + unsigned_flag= args[0]->unsigned_flag; decimals= max(args[0]->decimal_scale(), args[1]->decimal_scale()); - max_length= max(args[0]->max_length, args[1]->max_length); + uint prec= max(args[0]->decimal_precision(), args[1]->decimal_precision()); + fix_char_length(my_decimal_precision_to_length_no_truncation(prec, decimals, + unsigned_flag)); } @@ -2065,6 +2068,10 @@ void Item_func_mod::fix_length_and_dec() { Item_num_op::fix_length_and_dec(); maybe_null= 1; + /* + result_precision() sets unsigned_flag for INT_RESULT and DECIMAL_RESULT. + Here we need to set it in case of REAL_RESULT. + */ unsigned_flag= args[0]->unsigned_flag; } From ef701bfd075331843f512415541e54ba784d9b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 24 Sep 2019 13:29:23 +0300 Subject: [PATCH 08/11] Remove the unused function btr_page_get() btr_block_get(): Remove #ifdef around the definition --- storage/innobase/include/btr0btr.h | 31 +---------------------------- storage/innobase/include/btr0btr.ic | 30 ---------------------------- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index f17b6158f36..e00b2545708 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -236,7 +236,6 @@ btr_block_get_func( dict_index_t* index, mtr_t* mtr); -# ifdef UNIV_DEBUG /** Gets a buffer page and declares its latching order level. @param page_id tablespace/page identifier @param page_size page size @@ -244,37 +243,9 @@ btr_block_get_func( @param index index tree, may be NULL if not the insert buffer tree @param mtr mini-transaction handle @return the block descriptor */ -# define btr_block_get(page_id, page_size, mode, index, mtr) \ +# define btr_block_get(page_id, page_size, mode, index, mtr) \ btr_block_get_func(page_id, page_size, mode, \ __FILE__, __LINE__, (dict_index_t*)index, mtr) -# else /* UNIV_DEBUG */ -/** Gets a buffer page and declares its latching order level. -@param page_id tablespace/page identifier -@param page_size page size -@param mode latch mode -@param index index tree, may be NULL if not the insert buffer tree -@param mtr mini-transaction handle -@return the block descriptor */ -# define btr_block_get(page_id, page_size, mode, index, mtr) \ - btr_block_get_func(page_id, page_size, mode, __FILE__, __LINE__, (dict_index_t*)index, mtr) -# endif /* UNIV_DEBUG */ -/** Gets a buffer page and declares its latching order level. -@param page_id tablespace/page identifier -@param page_size page size -@param mode latch mode -@param index index tree, may be NULL if not the insert buffer tree -@param mtr mini-transaction handle -@return the uncompressed page frame */ -UNIV_INLINE -page_t* -btr_page_get( -/*=========*/ - const page_id_t page_id, - const page_size_t& page_size, - ulint mode, - dict_index_t* index, - mtr_t* mtr) - MY_ATTRIBUTE((warn_unused_result)); /**************************************************************//** Gets the index id field of a page. @return index id */ diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index 42d829e12d5..a2f2ec885d9 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -101,36 +101,6 @@ btr_page_set_index_id( } } -/** Gets a buffer page and declares its latching order level. -@param space tablespace identifier -@param zip_size compressed page size in bytes or 0 for uncompressed pages -@param page_no page number -@param mode latch mode -@param idx index tree, may be NULL if not the insert buffer tree -@param mtr mini-transaction handle -@return the uncompressed page frame */ -UNIV_INLINE -page_t* -btr_page_get( -/*=========*/ - const page_id_t page_id, - const page_size_t& page_size, - ulint mode, - dict_index_t* index, - mtr_t* mtr) -{ - buf_block_t* block=NULL; - buf_frame_t* frame=NULL; - - block = btr_block_get(page_id, page_size, mode, index, mtr); - - if (block) { - frame = buf_block_get_frame(block); - } - - return ((page_t*)frame); -} - /**************************************************************//** Gets the index id field of a page. @return index id */ From fa9e012a3412ad93159b69e4c7eb7a2eb5bde37f Mon Sep 17 00:00:00 2001 From: Rasmus Johansson Date: Tue, 24 Sep 2019 14:37:01 +0300 Subject: [PATCH 09/11] MDEV-20655 maturity stable for user_variables --- plugin/user_variables/user_variables.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/user_variables/user_variables.cc b/plugin/user_variables/user_variables.cc index 0dfd1b4db94..4e288963988 100644 --- a/plugin/user_variables/user_variables.cc +++ b/plugin/user_variables/user_variables.cc @@ -134,6 +134,6 @@ maria_declare_plugin(user_variables) NULL, NULL, "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; From 102bc7beb080e936ba70c0524a8759799f42458e Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 24 Sep 2019 19:24:32 +0400 Subject: [PATCH 10/11] Fixing tests according to MDEV-20655 maturity stable for user_variables --- plugin/user_variables/mysql-test/user_variables/basic.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/user_variables/mysql-test/user_variables/basic.result b/plugin/user_variables/mysql-test/user_variables/basic.result index 5650fa0dcce..a4d01957830 100644 --- a/plugin/user_variables/mysql-test/user_variables/basic.result +++ b/plugin/user_variables/mysql-test/user_variables/basic.result @@ -7,7 +7,7 @@ PLUGIN_AUTHOR Sergey Vojtovich PLUGIN_DESCRIPTION User-defined variables PLUGIN_LICENSE GPL LOAD_OPTION ON -PLUGIN_MATURITY Gamma +PLUGIN_MATURITY Stable SHOW CREATE TABLE INFORMATION_SCHEMA.USER_VARIABLES; Table Create Table user_variables CREATE TEMPORARY TABLE `user_variables` ( From 0e50ee6f28ca709c3ab8d143360faca182e74db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Tue, 24 Sep 2019 20:43:32 +0300 Subject: [PATCH 11/11] Remove --basedir arg from systemd startup scripts The arg was introduced as part of 75bcf1f9ad4a4bb5fa9cb8818abe6ace52e53d85 to fix a SELinux problem caused by mysqld_safe accessing files it should not be via the my_which function. The root cause for this was fixed in 10.3, via 355ee6877beccf27bcd07d845c985fc1a2845aca which eliminated the my_which function from mysqld_safe entirely. Thus, in 10.3, this --basedir flag is not necessary. --- support-files/mariadb.service.in | 4 +--- support-files/mariadb@.service.in | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index e7976a8f3e2..1b1c9a5d592 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -86,9 +86,7 @@ ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ # Use the [Service] section and Environment="MYSQLD_OPTS=...". # This isn't a replacement for my.cnf. # _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster -# Note: we set --basedir to prevent probes that might trigger SELinux alarms, -# per bug https://bugzilla.redhat.com/show_bug.cgi?id=547485 -ExecStart=@sbindir@/mysqld $MYSQLD_OPTS --basedir=@prefix@ $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION +ExecStart=@sbindir@/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION # Unset _WSREP_START_POSITION environment variable. ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION" diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 7a79a143778..185157a510d 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -103,12 +103,9 @@ ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ # This isn't a replacement for my.cnf. # _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster -# Note: we set --basedir to prevent probes that might trigger SELinux alarms, -# per bug https://bugzilla.redhat.com/show_bug.cgi?id=547485 -# # Note: Place $MYSQLD_OPTS at the very end for its options to take precedence. -ExecStart=@sbindir@/mysqld --defaults-file=@sysconf2dir@/my%I.cnf --basedir=@prefix@ \ +ExecStart=@sbindir@/mysqld --defaults-file=@sysconf2dir@/my%I.cnf \ $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS # Alternate: (remove ConditionPathExists above) # use [mysqld.INSTANCENAME] as sections in my.cnf