From 6610532170dbbf1b313561d9165976be9901bb12 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sat, 7 Mar 2020 14:46:40 +0200 Subject: [PATCH 01/10] Update install layout to account for multi-arch setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleanup install_layout to account for multi-arch setup and remove redundant defines in debian rules. Signed-off-by: Vicențiu Ciorbaru --- CMakeLists.txt | 2 +- cmake/install_layout.cmake | 10 +++------- debian/rules | 3 --- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dcc2a75587..9bb12f89751 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5) # explicitly set the policy to OLD # (cannot use NEW, not everyone is on cmake-2.8.12 yet) diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index c326a0fd340..e9413390172 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -174,7 +174,7 @@ SET(INSTALL_SCRIPTDIR_DEB "bin") SET(INSTALL_SYSCONFDIR_DEB "/etc") SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d") # -SET(INSTALL_LIBDIR_DEB "lib") +SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}") SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin") # SET(INSTALL_INCLUDEDIR_DEB "include/mysql") @@ -186,7 +186,7 @@ SET(INSTALL_INFODIR_DEB "share/info") # SET(INSTALL_SHAREDIR_DEB "share") SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql") -SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test") +SET(INSTALL_MYSQLTESTDIR_DEB "share/mysql/mysql-test") SET(INSTALL_SQLBENCHDIR_DEB ".") SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql") # @@ -196,11 +196,7 @@ SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock") SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system") SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d") -IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(INSTALL_PAMDIR_DEB "/lib/x86_64-linux-gnu/security") -ELSE() - SET(INSTALL_PAMDIR_DEB "/lib/i386-linux-gnu/security") -ENDIF() +SET(INSTALL_PAMDIR_DEB "/lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}/security") # # SVR4 layout diff --git a/debian/rules b/debian/rules index 3b1952ad2b9..647c73e43e0 100755 --- a/debian/rules +++ b/debian/rules @@ -86,9 +86,6 @@ endif $${MYSQL_COMPILER_LAUNCHER:+-DCMAKE_C_COMPILER_LAUNCHER=${MYSQL_COMPILER_LAUNCHER}} \ -DCMAKE_SYSTEM_PROCESSOR=$(DEB_BUILD_ARCH) \ -DBUILD_CONFIG=mysql_release \ - -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ - -DINSTALL_PLUGINDIR=lib/mysql/plugin \ - -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test \ -DDEB=$(DISTRIBUTION) ..' touch $@ From d7f74150e5ab3c25c6ae9638bf21787c86c0f656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sat, 7 Mar 2020 19:21:40 +0200 Subject: [PATCH 02/10] Check for CPU_COUNT macro within my_getncpus * Small refactor of my_getncpus function to compile for very old glibc < 2.6. * Cleanup code to eliminate duplication. --- mysys/my_getncpus.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/mysys/my_getncpus.c b/mysys/my_getncpus.c index 0ee03631da8..6890de4f827 100644 --- a/mysys/my_getncpus.c +++ b/mysys/my_getncpus.c @@ -30,50 +30,52 @@ static int ncpus=0; int my_getncpus(void) { -#if (defined(__linux__) || defined(__FreeBSD__)) && defined(HAVE_PTHREAD_GETAFFINITY_NP) - cpu_set_t set; - if (!ncpus) { + /* + First attempt to get the total number of available cores. sysconf is + the fallback, but it can return a larger number. It will return the + total number of cores, not the ones available to the process - as + configured via core affinity. + */ +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(HAVE_PTHREAD_GETAFFINITY_NP) + cpu_set_t set; if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0) { +#ifdef CPU_COUNT + /* CPU_COUNT was introduced with glibc 2.6. */ ncpus= CPU_COUNT(&set); - } - else - { -#ifdef _SC_NPROCESSORS_ONLN - ncpus= sysconf(_SC_NPROCESSORS_ONLN); #else - ncpus= 2; + /* Implementation for platforms with glibc < 2.6 */ + size_t i; + + for (i= 0; i < CPU_SETSIZE; i++) + if (CPU_ISSET(i, &set)) + ncpus++; #endif + return ncpus; } - } +#endif /* (__linux__ || __FreeBSD__) && HAVE_PTHREAD_GETAFFINITY_NP */ -#else /* __linux__ || FreeBSD && HAVE_PTHREAD_GETAFFINITY_NP */ - - if (!ncpus) - { #ifdef _SC_NPROCESSORS_ONLN ncpus= sysconf(_SC_NPROCESSORS_ONLN); #elif defined(__WIN__) SYSTEM_INFO sysinfo; /* - * We are not calling GetNativeSystemInfo here because (1) we - * don't believe that they return different values for number - * of processors and (2) if WOW64 limits processors for Win32 - * then we don't want to try to override that. + We are not calling GetNativeSystemInfo here because (1) we + don't believe that they return different values for number + of processors and (2) if WOW64 limits processors for Win32 + then we don't want to try to override that. */ GetSystemInfo(&sysinfo); ncpus= sysinfo.dwNumberOfProcessors; #else - /* unknown so play safe: assume SMP and forbid uniprocessor build */ + /* Unknown so play safe: assume SMP and forbid uniprocessor build */ ncpus= 2; #endif } -#endif /* __linux__ || FreeBSD && HAVE_PTHREAD_GETAFFINITY_NP */ - return ncpus; } From fd2dc9c3fdfb73fa450db9fecd72044bb0554040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sun, 8 Mar 2020 16:19:43 +0200 Subject: [PATCH 03/10] Correctly link mysqlclient.pc to mariadb.pc under multi-arch support --- debian/control | 1 + debian/libmariadb-dev-compat.links | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 18fea70f073..64034c831c9 100644 --- a/debian/control +++ b/debian/control @@ -7,6 +7,7 @@ Build-Depends: bison, cmake (>= 2.7), debhelper (>= 9), dh-apparmor, + dh-exec, dh-systemd, gdb, libaio-dev [linux-any], diff --git a/debian/libmariadb-dev-compat.links b/debian/libmariadb-dev-compat.links index 11e0dbce225..e02260c0129 100644 --- a/debian/libmariadb-dev-compat.links +++ b/debian/libmariadb-dev-compat.links @@ -1,3 +1,4 @@ +#!/usr/bin/dh-exec usr/bin/mariadb_config usr/bin/mysql_config usr/include/mariadb usr/include/mysql -usr/share/pkgconfig/mariadb.pc usr/share/pkgconfig/mysqlclient.pc +usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/mariadb.pc usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/mysqlclient.pc From 2bf4e574ad732d934016fe93e7297c017385ff68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 9 Mar 2020 09:00:14 +0200 Subject: [PATCH 04/10] MDEV-21758 : Events switched randomly to SLAVESIDE_DISABLED Change events only on Galera environment where idea is that event is enabled only on one node of the cluster and nodes are identified by server_id. --- mysql-test/r/events_restart.result | 27 ++++++++++++++++++++++++++ mysql-test/t/events_restart.test | 31 ++++++++++++++++++++++++++++++ sql/events.cc | 8 ++++---- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/events_restart.result b/mysql-test/r/events_restart.result index e22cfa011f2..ab90f7ff2f7 100644 --- a/mysql-test/r/events_restart.result +++ b/mysql-test/r/events_restart.result @@ -110,3 +110,30 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E test e1 root@localhost SYSTEM RECURRING # 1 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP EVENT e1; # end test for bug#11748899 +# +# Test for MDEV-21758 Events switched randomly to SLAVESIDE_DISABLED +# +create event ev on schedule every 1 minute do set @a= 1; +select name, originator, status from mysql.event; +name originator status +ev 1 ENABLED +# +# Restarting server with server_id=100 +# +select @@global.server_id; +@@global.server_id +100 +select name, originator, status from mysql.event; +name originator status +ev 1 ENABLED +set global server_id= 1; +# +# Restarting server with the original server_id=1 +# +select @@global.server_id; +@@global.server_id +1 +select name, originator, status from mysql.event; +name originator status +ev 1 ENABLED +drop event ev; diff --git a/mysql-test/t/events_restart.test b/mysql-test/t/events_restart.test index ca674170e96..f56bd32b71d 100644 --- a/mysql-test/t/events_restart.test +++ b/mysql-test/t/events_restart.test @@ -141,3 +141,34 @@ SHOW EVENTS; DROP EVENT e1; --echo # end test for bug#11748899 + +--echo # +--echo # Test for MDEV-21758 Events switched randomly to SLAVESIDE_DISABLED +--echo # + +create event ev on schedule every 1 minute do set @a= 1; +select name, originator, status from mysql.event; + +--let $server_id= `SELECT @@global.server_id` + +--echo # +--echo # Restarting server with server_id=100 +--echo # +--let $restart_parameters= --server-id=100 +--source include/restart_mysqld.inc + +select @@global.server_id; +select name, originator, status from mysql.event; +--eval set global server_id= $server_id + +--echo # +--echo # Restarting server with the original server_id=$server_id +--echo # +--let $restart_parameters= +--source include/restart_mysqld.inc + +select @@global.server_id; +select name, originator, status from mysql.event; + +# Cleanup +drop event ev; diff --git a/sql/events.cc b/sql/events.cc index c189354d5eb..c5dc51ab83d 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -1201,9 +1201,9 @@ Events::load_events_from_db(THD *thd) #ifdef WITH_WSREP /** - IF SST is done from a galera node that is also acting as MASTER - newly synced node in galera eco-system will also copy-over the event state - enabling duplicate event in galera eco-system. + If SST is done from a galera node that is also acting as MASTER + newly synced node in galera eco-system will also copy-over the + event state enabling duplicate event in galera eco-system. DISABLE such events if the current node is not event orginator. (Also, make sure you skip disabling it if is already disabled to avoid creation of redundant action) @@ -1213,7 +1213,7 @@ Events::load_events_from_db(THD *thd) Infact, based on galera use-case it seems like it recommends to have each node with different server-id. */ - if (et->originator != thd->variables.server_id) + if (WSREP(thd) && et->originator != thd->variables.server_id) { if (et->status == Event_parse_data::SLAVESIDE_DISABLED) continue; From 7a52b6fd25e69e3f74731c6ef38531c612d6ca60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 9 Mar 2020 12:04:02 +0200 Subject: [PATCH 05/10] Minor cleanup of main.partition_innodb Stop masking the Data_free values, because innodb_file_per_table=1 is the default. Also, do mask Update_time after updating tables, even though for some reason it does appear to matter. --- mysql-test/r/partition_innodb.result | 12 ++++++------ mysql-test/t/partition_innodb.test | 28 ++++++---------------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 8c0950e3643..6770b64552f 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -386,33 +386,33 @@ DROP TABLE t1; create table t1 (a int) engine=innodb partition by hash(a) ; show table status like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 NULL # NULL NULL latin1_swedish_ci NULL partitioned drop table t1; create table t1 (a int) engine = innodb partition by key (a); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 NULL Create_time NULL NULL latin1_swedish_ci NULL partitioned insert into t1 values (0), (1), (2), (3); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Dynamic 4 4096 16384 0 0 0 NULL Create_time Update_time NULL latin1_swedish_ci NULL partitioned drop table t1; create table t1 (a int auto_increment primary key) engine = innodb partition by key (a); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # 1 # NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 1 Create_time NULL NULL latin1_swedish_ci NULL partitioned insert into t1 values (NULL), (NULL), (NULL), (NULL); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # 5 # NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Dynamic 4 4096 16384 0 0 0 5 Create_time Update_time NULL latin1_swedish_ci NULL partitioned insert into t1 values (NULL), (NULL), (NULL), (NULL); show table status; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Dynamic 8 2048 16384 0 0 # 9 # NULL NULL latin1_swedish_ci NULL partitioned +t1 InnoDB 10 Dynamic 8 2048 16384 0 0 0 9 Create_time Update_time NULL latin1_swedish_ci NULL partitioned drop table t1; create table t1 (a int) partition by key (a) diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index b682162f7ea..518ef187d54 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -1,7 +1,3 @@ -if (`select plugin_auth_version < "5.6.25" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in InnoDB as of 5.6.24 or earlier -} --source include/not_embedded.inc --source include/have_partition.inc --source include/have_innodb.inc @@ -405,9 +401,7 @@ DROP TABLE t1; # Bug #14673: Wrong InnoDB default row format # create table t1 (a int) engine=innodb partition by hash(a) ; -# Data_free for InnoDB tablespace varies depending on which -# tests have been run before this one ---replace_column 10 # 12 # +--replace_column 12 # show table status like 't1'; drop table t1; @@ -417,33 +411,23 @@ drop table t1; create table t1 (a int) engine = innodb partition by key (a); -# Data_free for InnoDB tablespace varies depending on which -# tests have been run before this one ---replace_column 10 # 12 # +--replace_column 12 Create_time show table status; insert into t1 values (0), (1), (2), (3); -# Data_free for InnoDB tablespace varies depending on which -# tests have been run before this one ---replace_column 10 # 12 # +--replace_column 12 Create_time 13 Update_time show table status; drop table t1; create table t1 (a int auto_increment primary key) engine = innodb partition by key (a); -# Data_free for InnoDB tablespace varies depending on which -# tests have been run before this one ---replace_column 10 # 12 # +--replace_column 12 Create_time show table status; insert into t1 values (NULL), (NULL), (NULL), (NULL); -# Data_free for InnoDB tablespace varies depending on which -# tests have been run before this one ---replace_column 10 # 12 # +--replace_column 12 Create_time 13 Update_time show table status; insert into t1 values (NULL), (NULL), (NULL), (NULL); -# Data_free for InnoDB tablespace varies depending on which -# tests have been run before this one ---replace_column 10 # 12 # +--replace_column 12 Create_time 13 Update_time show table status; drop table t1; From 1c40cb6877c35cceebe59384998df58264997d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 10 Mar 2020 13:26:57 +0200 Subject: [PATCH 06/10] Do not bother to disable non-existing tests --- mysql-test/disabled.def | 2 -- 1 file changed, 2 deletions(-) diff --git a/mysql-test/disabled.def b/mysql-test/disabled.def index b6991cc1d37..ee30c4f4d3c 100644 --- a/mysql-test/disabled.def +++ b/mysql-test/disabled.def @@ -17,8 +17,6 @@ mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 chang ssl_crl_clients_valid : broken upstream ssl_crl : broken upstream ssl_crl_clrpath : broken upstream -innodb-wl5522-debug-zip : broken upstream -innodb_bug12902967 : broken upstream file_contents : MDEV-6526 these files are not installed anymore max_statement_time : cannot possibly work, depends on timing partition_open_files_limit : open_files_limit check broken by MDEV-18360 From 69e4c74e079fc78812a75b1e2c050890161826bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 10 Mar 2020 13:31:20 +0200 Subject: [PATCH 07/10] Make main.mysql_client_test non-great again Re-enable main.mysql_client_test on all builders, because at the moment we do not run any --big-test on buildbot due to resource constraints. A number of tests were declared big in commit eeee1832d792ac296e1cebeeed1f7a7ce4ce4551 in an attempt to save resources on buildbot. --- mysql-test/t/mysql_client_test.test | 2 -- 1 file changed, 2 deletions(-) diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index 8fbbbc1602e..8c2f5e2c32b 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -2,8 +2,6 @@ -- source include/not_embedded.inc # need to have the dynamic loading turned on for the client plugin tests --source include/have_plugin_auth.inc -# This test is slow on buildbot. ---source include/big_test.inc # Run test with default character set --source include/default_charset.inc From 2b8b85bd0a916f68dbe0af2af71569c81605242f Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 10 Mar 2020 15:14:53 +0300 Subject: [PATCH 08/10] fix use-after-free --- extra/mariabackup/xtrabackup.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index d5e5fc49e75..828c2e06fc2 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3132,13 +3132,13 @@ xb_load_single_table_tablespace( } } - ut_free(name); - delete file; if (err != DB_SUCCESS && xtrabackup_backup && !is_empty_file) { die("Failed to not validate first page of the file %s, error %d",name, (int)err); } + + ut_free(name); } /** Scan the database directories under the MySQL datadir, looking for From 02343c4a54b055ea3483075219bb3ce010c33671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 10 Mar 2020 15:46:29 +0200 Subject: [PATCH 09/10] MDEV-19740: Correct a type mismatch WITH_INNODB_EXTRA_DEBUG --- storage/innobase/page/page0zip.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 7a017913dfe..aec6bcc38da 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -3431,11 +3431,12 @@ page_zip_validate_low( differed. Let us ignore it. */ page_zip_fail(("page_zip_validate:" " min_rec_flag" - " (%s%lu,%lu,0x%02lx)\n", + " (%s" ULINTPF "," ULINTPF + ",0x%02x)\n", sloppy ? "ignored, " : "", page_get_space_id(page), page_get_page_no(page), - (ulong) page[offset])); + page[offset])); /* We don't check for spatial index, since the "minimum record" could be deleted when doing rtr_update_mbr_field. From 8fa1b6bb88be39001b98bab071b957da3c271a17 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Tue, 20 Feb 2018 15:35:09 +0300 Subject: [PATCH 10/10] MDEV-15724 - Possible crash in parser Parser: uninitialized Lex->create_last_non_select_table under mysql_unpack_partition() fix. Tested with main, parts suites. --- sql/sql_lex.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 6e6c79c0e6c..58c91ab21e7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -203,6 +203,7 @@ init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex) table->map= 1; //To ensure correct calculation of const item table_list->table= table; table_list->cacheable_table= false; + lex->create_last_non_select_table= table_list; return FALSE; }