Merge branch '10.5' into 10.6

This commit is contained in:
Sergei Golubchik 2025-03-31 11:40:23 +02:00
commit 51cc77f212
16 changed files with 131 additions and 80 deletions

View File

@ -855,8 +855,7 @@ static int upgrade_already_done(int silent)
s= strchr(version, '.');
s= strchr(s + 1, '.');
if (strncmp(upgrade_from_version, version,
(size_t)(s - version + 1)))
if (strncmp(upgrade_from_version, version, (size_t)(s - version + 1)))
{
if (calc_server_version(upgrade_from_version) <= MYSQL_VERSION_ID)
{
@ -870,9 +869,14 @@ static int upgrade_already_done(int silent)
}
if (!silent)
{
verbose("This installation of MariaDB is already upgraded to %s.\n"
"There is no need to run mysql_upgrade again for %s.",
upgrade_from_version, version);
if (strcmp(upgrade_from_version, version))
verbose("This installation of MariaDB is already upgraded to %s.\n"
"There is no need to run mysql_upgrade again for %s, because "
"they're both %.*s.",
upgrade_from_version, version, (int)(s - version), version);
else
verbose("This installation of MariaDB is already upgraded to %s.\n"
"There is no need to run mysql_upgrade again.", version);
if (!opt_check_upgrade)
verbose("You can use --force if you still want to run mysql_upgrade");
}

View File

@ -2124,7 +2124,7 @@ static char *quote_for_equal(const char *name, char *buff)
*to++='\\';
}
if (*name == '\'')
*to++= '\\';
*to++= '\'';
*to++= *name++;
}
to[0]= '\'';
@ -3638,7 +3638,7 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs,
fprintf(sql_file,
"DELIMITER ;;\n"
"/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n"
"/*!50003 SET SESSION SQL_MODE='%s' */;;\n"
"/*!50003 CREATE */ ",
(*show_trigger_row)[6]);
@ -4604,17 +4604,19 @@ static int dump_all_users_roles_and_grants()
return 1;
while ((row= mysql_fetch_row(tableres)))
{
char buf[200];
if (opt_replace_into)
/* Protection against removing the current import user */
/* MySQL-8.0 export capability */
fprintf(md_result_file,
"DELIMITER |\n"
"/*M!100101 IF current_user()=\"%s\" THEN\n"
"/*M!100101 IF current_user()=%s THEN\n"
" SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001,"
" MESSAGE_TEXT=\"Don't remove current user %s'\";\n"
"END IF */|\n"
"DELIMITER ;\n"
"/*!50701 DROP USER IF EXISTS %s */;\n", row[0], row[0], row[0]);
"/*!50701 DROP USER IF EXISTS %s */;\n",
quote_for_equal(row[0],buf), row[0], row[0]);
if (dump_create_user(row[0]))
result= 1;
/* if roles exist, defer dumping grants until after roles created */
@ -6732,6 +6734,7 @@ static my_bool get_view_structure(char *table, char* db)
char *result_table, *opt_quoted_table;
char table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3];
char temp_buff[NAME_LEN*2 + 3], temp_buff2[NAME_LEN*2 + 3];
char query[QUERY_LENGTH];
FILE *sql_file= md_result_file;
DBUG_ENTER("get_view_structure");
@ -6792,7 +6795,9 @@ static my_bool get_view_structure(char *table, char* db)
"SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, "
" CHARACTER_SET_CLIENT, COLLATION_CONNECTION "
"FROM information_schema.views "
"WHERE table_name=\"%s\" AND table_schema=\"%s\"", table, db);
"WHERE table_name=%s AND table_schema=%s",
quote_for_equal(table, temp_buff2),
quote_for_equal(db, temp_buff));
if (mysql_query(mysql, query))
{

View File

@ -129,6 +129,25 @@ IF(MSVC)
MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ")
ENDIF()
# CMake version 3.15 and later uses CMAKE_MSVC_RUNTIME_LIBRARY
# variable for our MSVC_CRT_TYPE.
# Set CMAKE_MSVC_RUNTIME_LIBRARY and pass to external projects
# it is important to keep the same CRT type when linking
#
# Translation rules MSVC_CRT_TYPE -> CMAKE_MSVC_RUNTIME_LIBRARY
# /MT -> MultiThreaded
# /MTd -> MultiThreadedDebug
# /MD -> MultiThreadedDLL
# /MDd -> MultiThreadedDebugDLL
SET(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
IF(MSVC_CRT_TYPE MATCHES "d$")
STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY Debug)
ENDIF()
IF(MSVC_CRT_TYPE MATCHES "D")
STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY DLL)
ENDIF()
IF(MSVC_CRT_TYPE MATCHES "/MD")
# Dynamic runtime (DLLs), need to install CRT libraries.
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT)

View File

@ -54,11 +54,18 @@ MACRO(BUNDLE_PCRE2)
ENDIF()
ENDFOREACH()
IF(CMAKE_MSVC_RUNTIME_LIBRARY)
SET(CMAKE_MSVC_RUNTIME_LIBRARY_ARG
"-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}")
ELSE()
SET(CMAKE_MSVC_RUNTIME_LIBRARY_ARG)
ENDIF()
ExternalProject_Add(
pcre2
PREFIX "${dir}"
URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.zip"
URL_MD5 dfab8313154b3377a6959c3b6377841e
URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.zip"
URL_MD5 873da56c6469ec207ca5c5ae9688b83a
INSTALL_COMMAND ""
CMAKE_ARGS
"-DCMAKE_WARN_DEPRECATED=FALSE"
@ -72,6 +79,7 @@ MACRO(BUNDLE_PCRE2)
"-DCMAKE_C_FLAGS_RELEASE=${pcre2_flags_RELEASE}"
"-DCMAKE_C_FLAGS_MINSIZEREL=${pcre2_flags_MINSIZEREL}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
${CMAKE_MSVC_RUNTIME_LIBRARY_ARG}
${stdlibs}
${byproducts}
)

View File

@ -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
INSTALL_MYSQL_TEST("." ".")
INSTALL_MYSQL_TEST("." "")
IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Enable running mtr from build directory

View File

@ -60,7 +60,7 @@ INSERT INTO t1 VALUES ('1'),('௨');
INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}');
INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}');
INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}');
INSERT INTO t2 VALUES ('\\p{L}'),('\\p{Ll}'),('\\p{Lu}'),('\\p{L&}');
INSERT INTO t2 VALUES ('\\p{L}'), /* buggy before v10.45 ('\\p{Ll}'),('\\p{Lu}'),*/ ('\\p{L&}');
INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]');
SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY class, BINARY ch;
class ch ch RLIKE class
@ -168,32 +168,6 @@ class ch ch RLIKE class
\p{Latin} ප 0
\p{Latin} 㐗 0
\p{Latin} 갷 0
\p{Ll} 1 0
\p{Ll} A 0
\p{Ll} a 1
\p{Ll} À 0
\p{Ll} à 1
\p{Ll} Σ 0
\p{Ll} σ 1
\p{Ll} Я 0
\p{Ll} я 1
\p{Ll} ௨ 0
\p{Ll} ප 0
\p{Ll} 㐗 0
\p{Ll} 갷 0
\p{Lu} 1 0
\p{Lu} A 1
\p{Lu} a 0
\p{Lu} À 1
\p{Lu} à 0
\p{Lu} Σ 1
\p{Lu} σ 0
\p{Lu} Я 1
\p{Lu} я 0
\p{Lu} ௨ 0
\p{Lu} ප 0
\p{Lu} 㐗 0
\p{Lu} 갷 0
\p{L} 1 0
\p{L} A 1
\p{L} a 1

View File

@ -41,7 +41,7 @@ INSERT INTO t1 VALUES ('1'),('௨');
INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}');
INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}');
INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}');
INSERT INTO t2 VALUES ('\\p{L}'),('\\p{Ll}'),('\\p{Lu}'),('\\p{L&}');
INSERT INTO t2 VALUES ('\\p{L}'), /* buggy before v10.45 ('\\p{Ll}'),('\\p{Lu}'),*/ ('\\p{L&}');
INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]');
SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY class, BINARY ch;
DROP TABLE t1, t2;

View File

@ -4,6 +4,7 @@
delimiter $
select 1;
$
exit
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is X
Server version: Y
@ -21,4 +22,5 @@ MariaDB [(none)]> select 1;
+---+
1 row in set
MariaDB [(none)]>
MariaDB [(none)]> exit
Bye

View File

@ -6,23 +6,16 @@ source include/not_windows.inc;
# this would need an instrumented ncurses library
source include/not_msan.inc;
error 0,1;
exec $MYSQL -V|grep -q readline;
if ($sys_errno == 1)
{
# strangely enough
skip does not work with libedit;
}
write_file $MYSQL_TMP_DIR/mysql_in;
delimiter $
select 1;
$
exit
EOF
let TERM=dumb;
replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//;
error 0,127;
exec socat EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
exec socat -t10 EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
if ($sys_errno == 127)
{
remove_file $MYSQL_TMP_DIR/mysql_in;

View File

@ -150,7 +150,8 @@ Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK
Run it again - should say already completed
This installation of MariaDB is already upgraded to VERSION.There is no need to run mysql_upgrade again for VERSION.
This installation of MariaDB is already upgraded to X.Y.Z-MariaDB.
There is no need to run mysql_upgrade again.
You can use --force if you still want to run mysql_upgrade
Force should run it regardless of whether it has been run before
Phase 1/8: Checking and upgrading mysql database
@ -1910,11 +1911,11 @@ FLUSH PRIVILEGES;
#
# MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed
#
This installation of MariaDB is already upgraded to MariaDB .
There is no need to run mysql_upgrade again for MariaDB .
This installation of MariaDB is already upgraded to X.Y.Z-MariaDB.
There is no need to run mysql_upgrade again.
Looking for 'mariadb' as: mariadb
This installation of MariaDB is already upgraded to MariaDB .
There is no need to run mysql_upgrade again for MariaDB .
This installation of MariaDB is already upgraded to X.Y.Z-MariaDB.
There is no need to run mysql_upgrade again.
#
# MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it
#
@ -1924,17 +1925,17 @@ Empty or non existent ...mysql_upgrade_info. Assuming mysql_upgrade has to be ru
# MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change
#
Looking for 'mariadb' as: mariadb
This installation of MariaDB is already upgraded to MariaDB .
There is no need to run mysql_upgrade again for MariaDB .
This installation of MariaDB is already upgraded to MariaDB .
There is no need to run mysql_upgrade again for MariaDB .
This installation of MariaDB is already upgraded to X.Y.0-MariaDB.
There is no need to run mysql_upgrade again for X.Y.Z-MariaDB, because they're both X.Y.
This installation of MariaDB is already upgraded to X.Y.0-MariaDB.
There is no need to run mysql_upgrade again for X.Y.Z-MariaDB, because they're both X.Y.
You can use --force if you still want to run mysql_upgrade
#
# MDEV-27279: mariadb_upgrade check-if-upgrade with major version change
#
Major version upgrade detected from MariaDB to MariaDB . Check required!
Major version upgrade detected from X.0.99 to X.Y.Z-MariaDB. Check required!
Looking for 'mysql' as: mysql
Major version upgrade detected from MariaDB to MariaDB . Check required!
Major version upgrade detected from X.0.99 to X.Y.Z-MariaDB. Check required!
drop table mysql.global_priv;
rename table mysql.global_priv_bak to mysql.global_priv;
# End of 10.2 tests

View File

@ -4,6 +4,10 @@
-- source include/have_innodb.inc
-- source include/have_partition.inc
let majorminor=`select substring_index(version(), '.', 2)`;
# for major upgrade test, see below
let major=`select substring_index(version(), '.', 1) - (version() like '%.0.%')`;
set sql_mode="";
#
@ -18,7 +22,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Run it again - should say already completed
--replace_regex /upgraded to [^\n].*/upgraded to VERSION./ /again for [^\n]*/again for VERSION./
--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB
--exec $MYSQL_UPGRADE 2>&1
# It should have created a file in the MySQL Servers datadir
@ -288,10 +292,11 @@ FLUSH PRIVILEGES;
--error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB
--error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/
--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB
--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/
--error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
@ -319,16 +324,18 @@ perl;
my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set";
$ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.$2.0$4/;
open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file";
binmode FILE;
print FILE "$ver\n";
close(FILE);
EOF
--error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/
--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $majorminor X.Y
--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/
--error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $majorminor X.Y
--exec $MYSQL_UPGRADE
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
@ -343,16 +350,18 @@ let DATADIR= $MYSQLD_DATADIR;
perl;
my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set";
my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set";
$ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.0.$3$4/;
$ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.0.99/;
open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file";
binmode FILE;
print FILE "$ver\n";
close(FILE);
EOF
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $major X
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mysql' as: mysql/
--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $major X
--replace_regex /'mariadb.* as:[^\n]*/'mysql' as: mysql/
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
drop table mysql.global_priv;

View File

@ -183,21 +183,21 @@ INSTALL PLUGIN test_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB';
/*M!100401 UNINSTALL PLUGIN IF EXIST cleartext_plugin_server */;
INSTALL PLUGIN cleartext_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB';
DELIMITER |
/*M!100101 IF current_user()="'mariadb.sys'@'localhost'" THEN
/*M!100101 IF current_user()='''mariadb.sys''@''localhost''' THEN
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'mariadb.sys'@'localhost''";
END IF */|
DELIMITER ;
/*!50701 DROP USER IF EXISTS 'mariadb.sys'@'localhost' */;
CREATE /*M!100103 OR REPLACE */ USER `mariadb.sys`@`localhost` PASSWORD EXPIRE;
DELIMITER |
/*M!100101 IF current_user()="'root'@'localhost'" THEN
/*M!100101 IF current_user()='''root''@''localhost''' THEN
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''";
END IF */|
DELIMITER ;
/*!50701 DROP USER IF EXISTS 'root'@'localhost' */;
CREATE /*M!100103 OR REPLACE */ USER `root`@`localhost`;
DELIMITER |
/*M!100101 IF current_user()="'foobar'@'%'" THEN
/*M!100101 IF current_user()='''foobar''@''%''' THEN
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'foobar'@'%''";
END IF */|
DELIMITER ;

View File

@ -6590,4 +6590,37 @@ CREATE TABLE `t1` (
/*!40101 SET character_set_client = @saved_cs_client */;
ERROR at line 9: Not allowed in the sandbox mode
drop table t1;
#
# MDEV-36268 mariadb-dump used wrong quoting character
#
create table t1 (a int);
create view `v'1"2` as select * from t1 with check option;
/*M!999999\- enable the sandbox mode */
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v'1"2` AS SELECT
1 AS `a` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v'1"2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8mb3 */;
/*!50001 SET character_set_results = utf8mb3 */;
/*!50001 SET collation_connection = utf8mb3_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v'1"2` AS select `t1`.`a` AS `a` from `t1` */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
drop view `v'1"2`;
drop table t1;
# End of 10.5 tests

View File

@ -3025,4 +3025,13 @@ EOF
--remove_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql
drop table t1;
--echo #
--echo # MDEV-36268 mariadb-dump used wrong quoting character
--echo #
create table t1 (a int);
create view `v'1"2` as select * from t1 with check option; # "'
--exec $MYSQL_DUMP --compact test
drop view `v'1"2`; # "'
drop table t1;
--echo # End of 10.5 tests

View File

@ -1,4 +1,3 @@
DROP TABLE IF EXISTS t1;
show variables like "system_time_zone";
Variable_name Value
system_time_zone CET

View File

@ -7,13 +7,8 @@ disable_query_log;
select FROM_UNIXTIME(24*3600);
enable_query_log;
# Initialization
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
# The following is because of daylight saving time
--replace_result MEST CET MET CET
--replace_result MEST CET MET CET CEST CET
show variables like "system_time_zone";
#