Merge branch '5.5' into 10.0

This commit is contained in:
Sergei Golubchik 2015-12-13 00:10:40 +01:00
commit 1623995158
80 changed files with 1022 additions and 258 deletions

View File

@ -1,3 +1,3 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=0
MYSQL_VERSION_PATCH=22
MYSQL_VERSION_PATCH=23

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -404,7 +404,7 @@ exit:
static void usage(void)
{
PRINT_VERSION;
puts("Copyright (c) 2011, Oracle and/or its affiliates. "
puts("Copyright (c) 2011, 2015, Oracle and/or its affiliates. "
"All rights reserved.\n");
puts("Enable or disable plugins.");
printf("\nUsage: %s [options] <plugin> ENABLE|DISABLE\n\nOptions:\n",
@ -755,6 +755,11 @@ static int check_options(int argc, char **argv, char *operation)
/* read the plugin config file and check for match against argument */
else
{
if (strlen(argv[i]) + 4 + 1 > FN_REFLEN)
{
fprintf(stderr, "ERROR: argument is too long.\n");
return 1;
}
strcpy(plugin_name, argv[i]);
strcpy(config_file, argv[i]);
strcat(config_file, ".ini");
@ -846,6 +851,7 @@ static int process_options(int argc, char *argv[], char *operation)
if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2)
{
char buff[FN_REFLEN];
memset(buff, 0, sizeof(buff));
strncpy(buff, opt_basedir, sizeof(buff) - 1);
#ifdef __WIN__

View File

@ -55,6 +55,8 @@ static DYNAMIC_STRING conn_args;
static char *opt_password= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static char *cnf_file_path= 0, defaults_file[FN_REFLEN + 32];
static my_bool tty_password= 0;
static char opt_tmpdir[FN_REFLEN] = "";
@ -111,6 +113,7 @@ static struct my_option my_long_options[]=
&opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#define PASSWORD_OPT 12
{"password", 'p',
"Password to use when connecting to server. If password is not given,"
" it's solicited on the tty.", &opt_password,&opt_password,
@ -147,6 +150,7 @@ static struct my_option my_long_options[]=
{"upgrade-system-tables", 's', "Only upgrade the system tables in the mysql database. Tables in other databases are not checked or touched.",
&opt_systables_only, &opt_systables_only, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#define USER_OPT (array_elements(my_long_options) - 6)
{"user", 'u', "User for login if not current user.", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process; Using it twice will print connection argument; Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase.",
@ -184,6 +188,8 @@ static void free_used_memory(void)
dynstr_free(&ds_args);
dynstr_free(&conn_args);
if (cnf_file_path)
my_delete(cnf_file_path, MYF(MY_WME));
}
@ -235,31 +241,32 @@ static void verbose(const char *fmt, ...)
this way we pass the same arguments on to mysql and mysql_check
*/
static void add_one_option(DYNAMIC_STRING* ds,
const struct my_option *opt,
const char* argument)
static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
const struct my_option *opt,
const char* arg)
{
const char* eq= NullS;
const char* arg= NullS;
if (opt->arg_type != NO_ARG)
dynstr_append(ds, "--");
dynstr_append(ds, opt->name);
if (arg)
{
eq= "=";
switch (opt->var_type & GET_TYPE_MASK) {
case GET_STR:
arg= argument;
break;
case GET_BOOL:
arg= (*(my_bool *)opt->value) ? "1" : "0";
break;
default:
die("internal error at %s: %d",__FILE__, __LINE__);
}
dynstr_append(ds, "=");
dynstr_append_os_quoted(ds, arg, NullS);
}
dynstr_append_os_quoted(ds, "--", opt->name, eq, arg, NullS);
dynstr_append(ds, " ");
}
static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
const struct my_option *opt,
const char* arg)
{
dynstr_append(ds, opt->name);
if (arg)
{
dynstr_append(ds, "=");
dynstr_append_os_quoted(ds, arg, NullS);
}
dynstr_append(ds, "\n");
}
static my_bool
get_one_option(int optid, const struct my_option *opt,
@ -290,16 +297,17 @@ get_one_option(int optid, const struct my_option *opt,
case 'p':
if (argument == disabled_my_option)
argument= (char*) ""; /* Don't require password */
tty_password= 1;
add_option= FALSE;
if (argument)
{
/* Add password to ds_args before overwriting the arg with x's */
add_one_option(&ds_args, opt, argument);
add_one_option_cnf_file(&ds_args, opt, argument);
while (*argument)
*argument++= 'x'; /* Destroy argument */
tty_password= 0;
}
else
tty_password= 1;
break;
case 't':
@ -346,18 +354,18 @@ get_one_option(int optid, const struct my_option *opt,
case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
case OPT_PLUGIN_DIR: /* --plugin-dir */
case OPT_DEFAULT_AUTH: /* --default-auth */
add_one_option(&conn_args, opt, argument);
add_one_option_cmd_line(&conn_args, opt, argument);
break;
}
if (add_option)
{
/*
This is an option that is accpted by mysql_upgrade just so
This is an option that is accepted by mysql_upgrade just so
it can be passed on to "mysql" and "mysqlcheck"
Save it in the ds_args string
*/
add_one_option(&ds_args, opt, argument);
add_one_option_cnf_file(&ds_args, opt, argument);
}
return 0;
}
@ -420,11 +428,8 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
while ((arg= va_arg(args, char *)))
{
/* Options should be os quoted */
if (strncmp(arg, "--", 2) == 0)
dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
else
dynstr_append(&ds_cmdline, arg);
/* Options should already be os quoted */
dynstr_append(&ds_cmdline, arg);
dynstr_append(&ds_cmdline, " ");
}
@ -566,8 +571,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
ret= run_tool(mysql_path,
ds_res,
"--no-defaults",
ds_args.str,
defaults_file,
"--database=mysql",
"--batch", /* Turns off pager etc. */
force ? "--force": "--skip-force",
@ -759,8 +763,7 @@ static int run_mysqlcheck_upgrade(my_bool mysql_db_only)
print_conn_args("mysqlcheck");
retch= run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str,
defaults_file,
"--check-upgrade",
"--auto-repair",
!opt_silent || opt_verbose >= 1 ? "--verbose" : "",
@ -820,8 +823,7 @@ static int run_mysqlcheck_views(void)
print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str,
defaults_file,
"--all-databases", "--repair",
upgrade_views,
"--skip-process-tables",
@ -845,8 +847,7 @@ static int run_mysqlcheck_fixnames(void)
print_conn_args("mysqlcheck");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str,
defaults_file,
"--all-databases",
"--fix-db-names",
"--fix-table-names",
@ -1070,12 +1071,21 @@ int main(int argc, char **argv)
{
opt_password= get_tty_password(NullS);
/* add password to defaults file */
dynstr_append_os_quoted(&ds_args, "--password=", opt_password, NullS);
dynstr_append(&ds_args, " ");
add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password);
DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0);
}
/* add user to defaults file */
dynstr_append_os_quoted(&ds_args, "--user=", opt_user, NullS);
dynstr_append(&ds_args, " ");
add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user);
DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0);
cnf_file_path= strmov(defaults_file, "--defaults-file=");
{
int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
"mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));
my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE));
my_close(fd, MYF(0));
}
/* Find mysql */
find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab.
Copyright (c) 2010, 2015, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1144,16 +1144,14 @@ static int fetch_db_collation(const char *db_name,
int db_cl_size)
{
my_bool err_status= FALSE;
char query[QUERY_LENGTH];
MYSQL_RES *db_cl_res;
MYSQL_ROW db_cl_row;
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(db_name, quoted_database_buf, 1);
my_snprintf(query, sizeof (query), "use %s", qdatabase);
if (mysql_query_with_error_report(mysql, NULL, query))
return 1;
if (mysql_select_db(mysql, db_name))
{
DB_error(mysql, "when selecting the database");
return 1; /* If --force */
}
if (mysql_query_with_error_report(mysql, &db_cl_res,
"select @@collation_database"))
@ -2450,7 +2448,7 @@ static uint dump_routines_for_db(char *db)
/* Get database collation. */
if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name)))
if (fetch_db_collation(db, db_cl_name, sizeof (db_cl_name)))
DBUG_RETURN(1);
if (switch_character_set_results(mysql, "binary"))
@ -2524,7 +2522,7 @@ static uint dump_routines_for_db(char *db)
if (mysql_num_fields(routine_res) >= 6)
{
if (switch_db_collation(sql_file, db_name_buff, ";",
if (switch_db_collation(sql_file, db, ";",
db_cl_name, row[5], &db_cl_altered))
{
mysql_free_result(routine_res);
@ -2574,8 +2572,7 @@ static uint dump_routines_for_db(char *db)
if (db_cl_altered)
{
if (restore_db_collation(sql_file, db_name_buff, ";",
db_cl_name))
if (restore_db_collation(sql_file, db, ";", db_cl_name))
{
mysql_free_result(routine_res);
mysql_free_result(routine_list_res);

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -382,7 +382,7 @@ list_dbs(MYSQL *mysql,const char *wild)
uint length, counter = 0;
ulong rowcount = 0L;
char tables[NAME_LEN+1], rows[NAME_LEN+1];
char query[255];
char query[NAME_LEN + 100];
MYSQL_FIELD *field;
MYSQL_RES *result;
MYSQL_ROW row= NULL, rrow;
@ -449,7 +449,8 @@ list_dbs(MYSQL *mysql,const char *wild)
MYSQL_ROW trow;
while ((trow = mysql_fetch_row(tresult)))
{
sprintf(query,"SELECT COUNT(*) FROM `%s`",trow[0]);
my_snprintf(query, sizeof(query),
"SELECT COUNT(*) FROM `%s`", trow[0]);
if (!(mysql_query(mysql,query)))
{
MYSQL_RES *rresult;
@ -505,7 +506,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
{
const char *header;
uint head_length, counter = 0;
char query[255], rows[NAME_LEN], fields[16];
char query[NAME_LEN + 100], rows[NAME_LEN], fields[16];
MYSQL_FIELD *field;
MYSQL_RES *result;
MYSQL_ROW row, rrow;
@ -590,7 +591,8 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
if (opt_verbose > 1)
{
/* Print the count of rows for each table */
sprintf(query,"SELECT COUNT(*) FROM `%s`",row[0]);
my_snprintf(query, sizeof(query), "SELECT COUNT(*) FROM `%s`",
row[0]);
if (!(mysql_query(mysql,query)))
{
if ((rresult = mysql_store_result(mysql)))
@ -650,13 +652,15 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
static int
list_table_status(MYSQL *mysql,const char *db,const char *wild)
{
char query[1024],*end;
char query[NAME_LEN + 100];
int len;
MYSQL_RES *result;
MYSQL_ROW row;
end=strxmov(query,"show table status from `",db,"`",NullS);
if (wild && wild[0])
strxmov(end," like '",wild,"'",NullS);
len= sizeof(query);
len-= my_snprintf(query, len, "show table status from `%s`", db);
if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " like '", wild, "'", NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{
fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n",
@ -688,7 +692,8 @@ static int
list_fields(MYSQL *mysql,const char *db,const char *table,
const char *wild)
{
char query[1024],*end;
char query[NAME_LEN + 100];
int len;
MYSQL_RES *result;
MYSQL_ROW row;
ulong UNINIT_VAR(rows);
@ -702,7 +707,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
if (opt_count)
{
sprintf(query,"select count(*) from `%s`", table);
my_snprintf(query, sizeof(query), "select count(*) from `%s`", table);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{
fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n",
@ -714,9 +719,11 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
mysql_free_result(result);
}
end=strmov(strmov(strmov(query,"show /*!32332 FULL */ columns from `"),table),"`");
if (wild && wild[0])
strxmov(end," like '",wild,"'",NullS);
len= sizeof(query);
len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`",
table);
if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " like '", wild, "'", NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{
fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n",
@ -737,7 +744,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
print_res_top(result);
if (opt_show_keys)
{
end=strmov(strmov(strmov(query,"show keys from `"),table),"`");
my_snprintf(query, sizeof(query), "show keys from `%s`", table);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{
fprintf(stderr,"%s: Cannot list keys in db: %s, table: %s: %s\n",

View File

@ -32,7 +32,7 @@ SET(CPACK_RPM_PACKAGE_NAME "MariaDB")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
SET(CPACK_RPM_PACKAGE_LICENSE "GPL")
SET(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
SET(CPACK_PACKAGE_RELOCATABLE FALSE)
SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases")

View File

@ -2,7 +2,7 @@
# flush-logs'd only once.
# Else the binary logs would automatically increase by n times every day.
# - The error log is obsolete, messages go to syslog now.
/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log {
/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mariadb-slow.log {
daily
rotate 7
missingok

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -118,7 +118,7 @@ print_arrays_for(char *set)
{
FILE *f;
sprintf(buf, "%s.conf", set);
snprintf(buf, sizeof(buf), "%s.conf", set);
if ((f = fopen(buf, "r")) == NULL) {
fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set);

View File

@ -2656,5 +2656,11 @@ t1 CREATE TABLE `t1` (
`c` char(32) AS (convert(cast(n as char), char)) PERSISTENT
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @@session.collation_server=filename;
create table t1(a enum('',''));
Warnings:
Note 1291 Column 'a' has duplicated value '' in ENUM
drop table t1;
set @@session.collation_server=default;
create table t1;
ERROR 42000: A table must have at least 1 column

View File

@ -11,3 +11,6 @@ create table com1 (a int);
drop table com1;
create table `clock$` (a int);
drop table `clock$`;
select convert(convert(',' using filename) using binary);
convert(convert(',' using filename) using binary)
@002c

View File

@ -6055,6 +6055,33 @@ SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1, t2;
#
# MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
#
SET NAMES utf8;
CREATE TABLE t1 (id2 int, ts timestamp);
INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24');
CREATE TABLE t2 AS SELECT
COALESCE(ts, 0) AS c0,
GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1,
GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2,
GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3,
GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c0` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c2` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c3` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
`c4` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t2;
c0 c1 c2 c3 c4
2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34
2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24
DROP TABLE t2, t1;
#
# End of 5.5 tests
#
#

View File

@ -114,8 +114,7 @@ create table t_event3 (a int, b float);
drop event if exists event3;
Warnings:
Note 1305 Event event3 does not exist
create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20251010", interval 5 day)
comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
select count(*) from t_event3;
count(*)
0

View File

@ -551,7 +551,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
DROP TABLE t1;
CREATE TABLE t1(a TEXT);
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
ERROR HY000: Incorrect arguments to AGAINST
ERROR HY000: Incorrect arguments to MATCH
DROP TABLE t1;
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');

View File

@ -102,7 +102,7 @@ ERROR: Missing --plugin_dir option.
# Show the help.
#
mysql_plugin Ver V.V.VV Distrib XX.XX.XX
Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
Enable or disable plugins.

View File

@ -45,7 +45,7 @@ Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before
Force should run it regardless of whether it has been run before
Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
@ -393,6 +393,13 @@ test
Phase 6/6: Running 'FLUSH PRIVILEGES'
OK
#
# Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
#
Run mysql_upgrade with unauthorized access
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
#
# MDEV-4332 Increase username length from 16 characters
# MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names
#

View File

@ -5317,3 +5317,29 @@ Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
#
# MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
#
CREATE DATABASE `a\"'``b`;
USE `a\"'``b`;
CREATE PROCEDURE p1() BEGIN END;
ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
ALTER DATABASE `a\"'``b` CHARACTER SET utf8 COLLATE utf8_general_ci ;
DROP DATABASE `a\"'``b`;

View File

@ -2100,6 +2100,19 @@ count(*)
40960
drop table t1;
set names default;
create table t2 (a int, b int, c int, d int, key x(a, b));
insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
(6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
insert into t2 select * from t2;
insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status OK
select a, b from t2 where (a, b) in ((0, 0), (1, 1));
a b
0 0
1 1
drop table t2;
#
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
#

View File

@ -2102,6 +2102,19 @@ count(*)
40960
drop table t1;
set names default;
create table t2 (a int, b int, c int, d int, key x(a, b));
insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
(6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
insert into t2 select * from t2;
insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status OK
select a, b from t2 where (a, b) in ((0, 0), (1, 1));
a b
0 0
1 1
drop table t2;
#
# BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
#

View File

@ -0,0 +1,80 @@
create table test_table (
column_number_1 enum('1','2') not null,
column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') not null,
column_number_3 varchar(10) not null,
column_number_4 varchar(10) not null,
column_number_5 enum(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52'
) not null,
column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100','101','102','103','104','105','106','107','108','109','110','111','112','113','114','115','116','117','118','119','120','121','122','123','124','125','126','127','128','129','130','131') not null,
column_number_7 enum('1','2','3','4','5','6','7') not null,
column_number_8 enum('8') not null,
column_number_9 enum('9') not null,
column_number_10 varchar(10) not null,
column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') not null
) default charset=utf8mb4;
show columns from test_table;
Field Type Null Key Default Extra
column_number_1 enum('1','2') NO NULL
column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') NO NULL
column_number_3 varchar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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52') NO NULL
column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100','101','102','103','104','105','106','107','108','109','110','111','112','113','114','115','116','117','118','119','120','121','122','123','124','125','126','127','128','129','130','131') NO NULL
column_number_7 enum('1','2','3','4','5','6','7') NO NULL
column_number_8 enum('8') NO NULL
column_number_9 enum('9') NO NULL
column_number_10 varchar(10) NO NULL
column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') NO NULL
drop table test_table;

View File

@ -0,0 +1,6 @@
create function sequence returns integer soname "UDF_EXAMPLE_LIB";
create table t1 (n int key not null auto_increment, msg int as (sequence()) virtual);
select * from t1;
n msg
drop table t1;
drop function sequence;

View File

@ -0,0 +1,27 @@
CREATE DATABASE federated;
CREATE DATABASE federated;
connection slave;
create table t1 (foo int, bar int);
connection master;
create server 's1' foreign data wrapper 'mysql' options
(HOST 'localhost',
DATABASE 'test',
USER 'root',
PASSWORD '',
SOCKET 'SLAVE_MYSOCK');
create table t1 (foo integer, bar integer) engine=federated
connection='s1';
select * from t1;
foo bar
connection slave;
connection master;
drop table t1;
drop server s1;
connection slave;
drop table t1;
connection master;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
connection slave;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;

View File

@ -0,0 +1,38 @@
#
# MDEV-8313 Got an error writing communication packets
#
source include/federated.inc;
enable_connect_log;
connection slave;
create table t1 (foo int, bar int);
connection master;
--replace_result $SLAVE_MYSOCK SLAVE_MYSOCK
eval create server 's1' foreign data wrapper 'mysql' options
(HOST 'localhost',
DATABASE 'test',
USER 'root',
PASSWORD '',
SOCKET '$SLAVE_MYSOCK');
eval create table t1 (foo integer, bar integer) engine=federated
connection='s1';
select * from t1;
connection slave;
source include/restart_mysqld.inc;
connection master;
drop table t1;
drop server s1;
connection slave;
drop table t1;
source include/federated_cleanup.inc;

View File

@ -0,0 +1,9 @@
#
# Bug #19929435 DROP DATABASE HANGS WITH MALFORMED TABLE
#
set session default_storage_engine=innodb;
create database `b`;
use `b`;
create table `#mysql50#q.q` select 1;
ERROR 42000: Incorrect table name '#mysql50#q.q'
drop database `b`;

View File

@ -567,7 +567,7 @@ Variable_name Value
auto_increment_increment 65535
auto_increment_offset 65535
INSERT INTO t1 VALUES (NULL),(NULL);
ERROR 22003: Out of range value for column 'c1' at row 1
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1;
c1
1
@ -641,6 +641,18 @@ PRIMARY KEY (m)) ENGINE = InnoDB;
INSERT INTO t2 (n,o) VALUES
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
SELECT * FROM t2;
m n o
1 1 TRUE
2 1 FALSE
3 2 TRUE
4 2 FALSE
5 3 TRUE
6 3 FALSE
7 4 TRUE
8 4 FALSE
9 5 TRUE
10 5 FALSE
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@ -648,7 +660,7 @@ t2 CREATE TABLE `t2` (
`n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
Table Create Table

View File

@ -0,0 +1,40 @@
CREATE TABLE t1 (D INT) ENGINE=innodb;
INSERT INTO t1 VALUES (10);
ALTER TABLE t1 MODIFY COLUMN d INT;
ALTER TABLE t1 ADD INDEX my_d (d);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` int(11) DEFAULT NULL,
KEY `my_d` (`d`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
EXPLAIN SELECT d FROM t1 WHERE d = 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref my_d my_d 5 const 128 Using index
EXPLAIN SELECT D FROM t1 WHERE D = 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref my_d my_d 5 const 128 Using index
ALTER TABLE t1 DROP INDEX my_d;
ALTER TABLE t1 MODIFY COLUMN D INT;
ALTER TABLE t1 ADD INDEX my_d (D);
EXPLAIN SELECT d FROM t1 WHERE d = 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref my_d my_d 5 const 128 Using index
EXPLAIN SELECT D FROM t1 WHERE D = 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref my_d my_d 5 const 128 Using index
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`D` int(11) DEFAULT NULL,
KEY `my_d` (`D`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;

View File

@ -0,0 +1,2 @@
CREATE TABLE t1 ENGINE=InnoDB AS SELECT * FROM mysql.help_topic;
DROP TABLE t1;

View File

@ -0,0 +1,12 @@
--source include/have_innodb.inc
--echo #
--echo # Bug #19929435 DROP DATABASE HANGS WITH MALFORMED TABLE
--echo #
set session default_storage_engine=innodb;
create database `b`;
use `b`;
--error ER_WRONG_TABLE_NAME
create table `#mysql50#q.q` select 1;
drop database `b`;

View File

@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
SHOW VARIABLES LIKE "%auto_inc%";
--error 167
--error 1467
INSERT INTO t1 VALUES (NULL),(NULL);
SELECT * FROM t1;
DROP TABLE t1;
@ -401,6 +401,7 @@ CREATE TABLE t2 (
INSERT INTO t2 (n,o) VALUES
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
SELECT * FROM t2;
SHOW CREATE TABLE t2;
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;

View File

@ -0,0 +1,31 @@
--source include/have_innodb.inc
#
# Fix MySQL Bug#20755615: InnoDB compares column names case sensitively,
# while according to Storage Engine API column names should be compared
# case insensitively. This can cause FRM and InnoDB data dictionary to
# go out of sync:
#
CREATE TABLE t1 (D INT) ENGINE=innodb;
INSERT INTO t1 VALUES (10);
ALTER TABLE t1 MODIFY COLUMN d INT;
ALTER TABLE t1 ADD INDEX my_d (d);
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9);
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
EXPLAIN SELECT d FROM t1 WHERE d = 5;
EXPLAIN SELECT D FROM t1 WHERE D = 5;
ALTER TABLE t1 DROP INDEX my_d;
ALTER TABLE t1 MODIFY COLUMN D INT;
ALTER TABLE t1 ADD INDEX my_d (D);
EXPLAIN SELECT d FROM t1 WHERE d = 5;
EXPLAIN SELECT D FROM t1 WHERE D = 5;
SHOW CREATE TABLE t1;
DROP TABLE t1;

View File

@ -0,0 +1,29 @@
--loose-innodb_trx
--loose-innodb_locks
--loose-innodb_lock_waits
--loose-innodb_cmp
--loose-innodb_cmp_reset
--loose-innodb_cmp_per_index
--loose-innodb_cmp_per_index_reset
--loose-innodb_cmpmem
--loose-innodb_cmpmem_reset
--loose-innodb_buffer_page
--loose-innodb_buffer_page_lru
--loose-innodb_buffer_stats
--loose-innodb_sys_tables
--loose-innodb_sys_tablestats
--loose-innodb_sys_indexes
--loose-innodb_sys_columns
--loose-innodb_sys_fields
--loose-innodb_sys_foreign
--loose-innodb_sys_foreign_cols
--loose-innodb_changed_pages
--loose-innodb_rseg
--loose-innodb_undo_logs
--loose-innodb_sys_stats
--loose-innodb_table_stats
--loose-innodb_index_stats
--loose-innodb_admin_command
--loose-innodb_buffer_pool_pages
--loose-innodb_buffer_pool_pages_index
--loose-innodb_buffer_pool_pages_blob

View File

@ -0,0 +1,64 @@
-- source include/have_innodb.inc
-- source include/not_embedded.inc
#
# MDEV-7762 InnoDB: Failing assertion: block->page.buf_fix_count > 0 in buf0buf.ic line 730
#
# Make sure that all supported information_schema tables are readable
# (actual result sets are not important).
#
CREATE TABLE t1 ENGINE=InnoDB AS SELECT * FROM mysql.help_topic;
--disable_query_log
--disable_result_log
BEGIN;
SELECT * FROM t1 FOR UPDATE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_RESET;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_STATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_RSEG;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_UNDO_LOGS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_STATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLE_STATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_INDEX_STATS;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_ADMIN_COMMAND;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES_INDEX;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES_BLOB;
--error 0,1109
SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES;
COMMIT;
--enable_query_log
--enable_result_log
DROP TABLE t1;

View File

@ -498,7 +498,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
DROP TABLE t1;
CREATE TABLE t1(a TEXT) ENGINE = InnoDB;
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
ERROR HY000: Incorrect arguments to AGAINST
ERROR HY000: Incorrect arguments to MATCH
DROP TABLE t1;
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)) ENGINE = InnoDB;
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');

View File

@ -322,3 +322,11 @@ drop table t1;
create table t1 (a int, b int as (b is null) virtual);
ERROR HY000: A computed column cannot be based on a computed column
# end of 5.3 tests
create table t1 (v1 varchar(255) as (c1) persistent, c1 varchar(50)) collate=latin1_general_ci;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`v1` varchar(255) AS (c1) PERSISTENT,
`c1` varchar(50) COLLATE latin1_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
drop table t1;

View File

@ -283,3 +283,10 @@ drop table t1;
create table t1 (a int, b int as (b is null) virtual);
--echo # end of 5.3 tests
#
# MDEV-7655 SHOW CREATE TABLE returns invalid DDL when using virtual columns along with a table collation
#
create table t1 (v1 varchar(255) as (c1) persistent, c1 varchar(50)) collate=latin1_general_ci;
show create table t1;
drop table t1;

View File

@ -2054,6 +2054,14 @@ show create table t1;
drop table t1;
#
# MDEV-7050: MySQL#74603 - Assertion `comma_length > 0' failed in mysql_prepare_create_table
#
set @@session.collation_server=filename;
create table t1(a enum('',''));
drop table t1;
set @@session.collation_server=default;
#
# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
#

View File

@ -19,3 +19,6 @@ drop table com1;
create table `clock$` (a int);
drop table `clock$`;
select convert(convert(',' using filename) using binary);

View File

@ -1650,6 +1650,22 @@ INSERT INTO t2 VALUES ('aaa');
SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
DROP TABLE t1, t2;
--echo #
--echo # MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
--echo #
SET NAMES utf8;
CREATE TABLE t1 (id2 int, ts timestamp);
INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24');
CREATE TABLE t2 AS SELECT
COALESCE(ts, 0) AS c0,
GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1,
GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2,
GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3,
GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4
FROM t1;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2, t1;
--echo #
--echo # End of 5.5 tests

View File

@ -125,8 +125,7 @@ drop event existant;
create table t_event3 (a int, b float);
drop event if exists event3;
create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20251010", interval 5 day)
comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
let $wait_condition=SELECT count(*)=0 from t_event3;
--source include/wait_condition.inc
select count(*) from t_event3;

View File

@ -20,7 +20,7 @@ file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
# It should have created a file in the MySQL Servers datadir
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Force should run it regardless of wether it's been run before
--echo Force should run it regardless of whether it has been run before
--exec $MYSQL_UPGRADE --force 2>&1
# It should have created a file in the MySQL Servers datadir
@ -130,6 +130,14 @@ let $MYSQLD_DATADIR= `select @@datadir`;
# so the following command should never fail.
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo #
--echo # Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
--echo #
--echo Run mysql_upgrade with unauthorized access
--error 1
--exec $MYSQL_UPGRADE --skip-verbose --user=root --password=wrong_password 2>&1
--echo #
--echo # MDEV-4332 Increase username length from 16 characters
--echo # MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names

View File

@ -2497,3 +2497,18 @@ DROP DATABASE db_20772273;
--exec $MYSQL_DUMP --user=foo 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out
--exec $MYSQL_DUMP --help > $MYSQLTEST_VARDIR/tmp/bug6056.out
--echo #
--echo # MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
--echo #
CREATE DATABASE `a\"'``b`;
USE `a\"'``b`;
CREATE PROCEDURE p1() BEGIN END;
ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
--let shell_ready_db_name="a\\\\\\"'`b"
if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`)
{
--let shell_ready_db_name=a\\\\\\"\\'\\`b
}
--exec $MYSQL_DUMP --routines --compact $shell_ready_db_name
DROP DATABASE `a\"'``b`;

View File

@ -1678,6 +1678,18 @@ select count(*) from t1 ignore index (ix_fd) where fd <'😁';
drop table t1;
set names default;
#
# Bug#17755540 VALGRIND ERROR WHEN SETTING UP ROW COMPARATORS
#
create table t2 (a int, b int, c int, d int, key x(a, b));
insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
(6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
insert into t2 select * from t2;
insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
analyze table t2;
select a, b from t2 where (a, b) in ((0, 0), (1, 1));
drop table t2;
--echo #
--echo # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
--echo #

View File

@ -0,0 +1,73 @@
#
# MDEV-9226 SHOW COLUMNS returns wrong column order for tables with large ENUMs
#
create table test_table (
column_number_1 enum('1','2') not null,
column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') not null,
column_number_3 varchar(10) not null,
column_number_4 varchar(10) not null,
column_number_5 enum(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10',
'aaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51',
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52'
) not null,
column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100','101','102','103','104','105','106','107','108','109','110','111','112','113','114','115','116','117','118','119','120','121','122','123','124','125','126','127','128','129','130','131') not null,
column_number_7 enum('1','2','3','4','5','6','7') not null,
column_number_8 enum('8') not null,
column_number_9 enum('9') not null,
column_number_10 varchar(10) not null,
column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') not null
) default charset=utf8mb4;
# SHOW command must list columns in the table order
# (SELECT isn't required to do it, though)
show columns from test_table;
drop table test_table;

View File

@ -0,0 +1,14 @@
--source include/not_embedded.inc
--source include/have_udf.inc
#
# MDEV-8644 Using a UDF in a virtual column causes a crash when stopping the server
#
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval create function sequence returns integer soname "$UDF_EXAMPLE_SO";
create table t1 (n int key not null auto_increment, msg int as (sequence()) virtual);
select * from t1;
source include/restart_mysqld.inc;
drop table t1;
drop function sequence;

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2002, 2013, Oracle and/or its affiliates
Copyright (c) 2009, 2013, Monty Program Ab
Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights
reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -46,7 +47,6 @@ pthread_handler_t mysql_heartbeat(void *p)
DBUG_ENTER("mysql_heartbeat");
struct mysql_heartbeat_context *con= (struct mysql_heartbeat_context *)p;
char buffer[HEART_STRING_BUFFER];
unsigned int x= 0;
time_t result;
struct tm tm_tmp;
@ -65,7 +65,6 @@ pthread_handler_t mysql_heartbeat(void *p)
tm_tmp.tm_min,
tm_tmp.tm_sec);
my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
x++;
}
DBUG_RETURN(0);
@ -174,6 +173,13 @@ static int daemon_example_plugin_deinit(void *p __attribute__ ((unused)))
tm_tmp.tm_min,
tm_tmp.tm_sec);
my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
/*
Need to wait for the hearbeat thread to terminate before closing
the file it writes to and freeing the memory it uses.
*/
pthread_join(con->heartbeat_thread, NULL);
my_close(con->heartbeat_file, MYF(0));
my_free(con);

View File

@ -262,7 +262,7 @@ static int init(void *p)
startup_interval= debug_startup_interval;
first_interval= debug_first_interval;
interval= debug_interval;
user_info= "mysql-test";
user_info= const_cast<char*>("mysql-test");
}
#endif

View File

@ -59,9 +59,9 @@ class Url {
extern Url **urls;
extern uint url_count;
extern time_t startup_interval;
extern time_t first_interval;
extern time_t interval;
extern ulong startup_interval;
extern ulong first_interval;
extern ulong interval;
/* these are used to communicate with the background thread */
extern mysql_mutex_t sleep_mutex;

View File

@ -25,9 +25,9 @@ static my_thread_id thd_thread_id; ///< its thread_id
static size_t needed_size= 20480;
time_t startup_interval= 60*5; ///< in seconds (5 minutes)
time_t first_interval= 60*60*24; ///< in seconds (one day)
time_t interval= 60*60*24*7; ///< in seconds (one week)
ulong startup_interval= 60*5; ///< in seconds (5 minutes)
ulong first_interval= 60*60*24; ///< in seconds (one day)
ulong interval= 60*60*24*7; ///< in seconds (one week)
/**
reads the rows from a table and puts them, concatenated, in a String
@ -254,6 +254,7 @@ ret:
{
if (tables.table)
free_tmp_table(thd, tables.table);
thd->cleanup_after_query();
/*
clean up, free the thd.
reset all thread local status variables to minimize

View File

@ -486,6 +486,7 @@ sub get_mysqladmin_options
# Return a list of option files which can be opened. Similar, but not
# identical, to behavior of my_search_option_files()
# TODO implement and use my_print_defaults --list-groups instead
sub list_defaults_files
{
my %opt;
@ -497,9 +498,7 @@ sub list_defaults_files
return ($opt{file}) if exists $opt{file};
my %seen; # Don't list the same file more than once
return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
('@sysconfdir@/my.cnf',
return ('@sysconfdir@/my.cnf',
'@sysconfdir@/mysql/my.cnf',
'@prefix@/my.cnf',
($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
@ -539,11 +538,12 @@ sub find_groups
}
}
my %seen;
my @defaults_files = list_defaults_files();
#warn "@{[sort keys %gids]} -> @defaults_files\n";
foreach my $file (@defaults_files)
while (@defaults_files)
{
next unless open CONF, "< $file";
my $file = shift @defaults_files;
next unless defined $file and not $seen{$file}++ and open CONF, '<', $file;
while (<CONF>)
{
@ -556,6 +556,14 @@ sub find_groups
push @groups, "$1$2";
}
}
elsif (/^\s*!include\s+(\S.*?)\s*$/)
{
push @defaults_files, $1;
}
elsif (/^\s*!includedir\s+(\S.*?)\s*$/)
{
push @defaults_files, <$1/*.cnf>;
}
}
close CONF;

View File

@ -1756,8 +1756,11 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
{
SSL *ssl;
X509 *server_cert;
char *cp1, *cp2;
char *buf;
X509_NAME *x509sn;
int cn_pos;
X509_NAME_ENTRY *cn_entry;
ASN1_STRING *cn_asn1;
const char *cn_str;
DBUG_ENTER("ssl_verify_server_cert");
DBUG_PRINT("enter", ("server_hostname: %s", server_hostname));
@ -1791,34 +1794,32 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
are what we expect.
*/
buf= X509_NAME_oneline(X509_get_subject_name(server_cert), 0, 0);
x509sn= X509_get_subject_name(server_cert);
if ((cn_pos= X509_NAME_get_index_by_NID(x509sn, NID_commonName, -1)) < 0)
goto err;
if (!(cn_entry= X509_NAME_get_entry(x509sn, cn_pos)))
goto err;
if (!(cn_asn1 = X509_NAME_ENTRY_get_data(cn_entry)))
goto err;
cn_str = (char *)ASN1_STRING_data(cn_asn1);
/* Make sure there is no embedded \0 in the CN */
if ((size_t)ASN1_STRING_length(cn_asn1) != strlen(cn_str))
goto err;
if (strcmp(cn_str, server_hostname))
goto err;
X509_free (server_cert);
DBUG_RETURN(0);
if (!buf)
{
*errptr= "Out of memory";
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("hostname in cert: %s", buf));
cp1= strstr(buf, "/CN=");
if (cp1)
{
cp1+= 4; /* Skip the "/CN=" that we found */
/* Search for next / which might be the delimiter for email */
cp2= strchr(cp1, '/');
if (cp2)
*cp2= '\0';
DBUG_PRINT("info", ("Server hostname in cert: %s", cp1));
if (!strcmp(cp1, server_hostname))
{
free(buf);
/* Success */
DBUG_RETURN(0);
}
}
err:
X509_free(server_cert);
*errptr= "SSL certificate validation failure";
free(buf);
DBUG_RETURN(1);
}

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#ifndef ITEM_CMPFUNC_INCLUDED
#define ITEM_CMPFUNC_INCLUDED
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2011, Monty Program Ab.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
@ -717,7 +717,7 @@ void Item_func::count_real_length()
bool Item_func::count_string_result_length(enum_field_types field_type,
Item **items, uint nitems)
{
if (agg_arg_charsets(collation, items, nitems, MY_COLL_ALLOW_CONV, 1))
if (agg_arg_charsets_for_string_result(collation, items, nitems, 1))
return true;
if (is_temporal_type(field_type))
count_datetime_length(items, nitems);
@ -6216,9 +6216,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
table= 0;
for (uint i=1 ; i < arg_count ; i++)
{
item=args[i];
if (item->type() == Item::REF_ITEM)
args[i]= item= *((Item_ref *)item)->ref;
item= args[i]= args[i]->real_item();
/*
When running in PS mode, some Item_field's can already be replaced
to Item_func_conv_charset during PREPARE time. This is possible
@ -6231,7 +6229,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
if (!thd->stmt_arena->is_stmt_execute() &&
item->type() != Item::FIELD_ITEM)
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST");
my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH");
return TRUE;
}
/*

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2020,14 +2020,9 @@ void clean_up(bool print_message)
item_func_sleep_free();
lex_free(); /* Free some memory */
item_create_cleanup();
if (!opt_noacl)
{
#ifdef HAVE_DLOPEN
udf_free();
#endif
}
tdc_start_shutdown();
plugin_shutdown();
udf_free();
ha_end();
if (tc_log)
tc_log->close();
@ -5487,12 +5482,7 @@ int mysqld_main(int argc, char **argv)
if (!opt_noacl)
(void) grant_init();
if (!opt_noacl)
{
#ifdef HAVE_DLOPEN
udf_init();
#endif
}
udf_init();
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
opt_skip_slave_start= 1;

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2006, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -532,6 +533,7 @@ extern mysql_mutex_t
LOCK_slave_init;
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
#ifdef HAVE_OPENSSL
extern char* des_key_file;
extern mysql_mutex_t LOCK_des_key_file;
#endif
extern mysql_mutex_t LOCK_server_started;

View File

@ -10059,6 +10059,8 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
DBUG_RETURN(FALSE);
}
mysql_mutex_lock(&acl_cache->lock);
/* check for matching WITH PROXY rights */
for (uint i=0; i < acl_proxy_users.elements; i++)
{
@ -10071,10 +10073,12 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
proxy->get_with_grant())
{
DBUG_PRINT("info", ("found"));
mysql_mutex_unlock(&acl_cache->lock);
DBUG_RETURN(FALSE);
}
}
mysql_mutex_unlock(&acl_cache->lock);
my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0),
thd->security_ctx->user,
thd->security_ctx->host_or_ip);

View File

@ -2002,7 +2002,7 @@ public:
*/
MDL_request grl_protection;
Delayed_insert()
Delayed_insert(SELECT_LEX *current_select)
:locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0),
status(0), handler_thread_initialized(FALSE), group_count(0)
{
@ -2012,7 +2012,7 @@ public:
strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
thd.current_tablenr=0;
thd.set_command(COM_DELAYED_INSERT);
thd.lex->current_select= 0; // for my_message_sql
thd.lex->current_select= current_select;
thd.lex->sql_command= SQLCOM_INSERT; // For innodb::store_lock()
/*
Prevent changes to global.lock_wait_timeout from affecting
@ -2189,7 +2189,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
*/
if (! (di= find_handler(thd, table_list)))
{
if (!(di= new Delayed_insert()))
if (!(di= new Delayed_insert(thd->lex->current_select)))
goto end_create;
thread_safe_increment32(&thread_count, &thread_count_lock);
@ -2832,6 +2832,16 @@ pthread_handler_t handle_delayed_insert(void *arg)
if (di->open_and_lock_table())
goto err;
/*
INSERT DELAYED generally expects thd->lex->current_select to be NULL,
since this is not an attribute of the current thread. This can lead to
problems if the thread that spawned the current one disconnects.
current_select will then point to freed memory. But current_select is
required to resolve the partition function. So, after fulfilling that
requirement, we set the current_select to 0.
*/
thd->lex->current_select= NULL;
/* Tell client that the thread is initialized */
mysql_cond_signal(&di->cond_client);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2013, Monty Program Ab
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -3821,8 +3821,8 @@ Prepared_statement::swap_prepared_statement(Prepared_statement *copy)
swap_variables(LEX_STRING, name, copy->name);
/* Ditto */
swap_variables(char *, db, copy->db);
swap_variables(size_t, db_length, copy->db_length);
DBUG_ASSERT(db_length == copy->db_length);
DBUG_ASSERT(param_count == copy->param_count);
DBUG_ASSERT(thd == copy->thd);
last_error[0]= '\0';

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -27,7 +27,7 @@
#include "sql_repl.h" // reset_master, reset_slave
#include "rpl_mi.h" // Master_info::data_lock
#include "debug_sync.h"
#include "rpl_mi.h"
#include "des_key_file.h"
static void disable_checkpoints(THD *thd);
@ -334,7 +334,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
}
}
#endif
#ifdef OPENSSL
#ifdef HAVE_OPENSSL
if (options & REFRESH_DES_KEY_FILE)
{
if (des_key_file && load_des_key_file(des_key_file))

View File

@ -15801,8 +15801,8 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
uint temp_pool_slot=MY_BIT_NONE;
uint fieldnr= 0;
ulong reclength, string_total_length;
bool using_unique_constraint= 0;
bool use_packed_rows= 0;
bool using_unique_constraint= false;
bool use_packed_rows= false;
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
char *tmpname,path[FN_REFLEN];
uchar *pos, *group_buff, *bitmaps;
@ -15875,10 +15875,10 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*/
(*tmp->item)->marker=4; // Store null in key
if ((*tmp->item)->too_big_for_varchar())
using_unique_constraint=1;
using_unique_constraint= true;
}
if (param->group_length >= MAX_BLOB_WIDTH)
using_unique_constraint=1;
using_unique_constraint= true;
if (group)
distinct=0; // Can't use distinct
}
@ -16131,12 +16131,14 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*blob_field++= fieldnr;
blob_count++;
}
if (new_field->real_type() == MYSQL_TYPE_STRING ||
new_field->real_type() == MYSQL_TYPE_VARCHAR)
{
string_count++;
string_total_length+= new_field->pack_length();
}
if (item->marker == 4 && item->maybe_null)
{
group_null_items++;
@ -16189,7 +16191,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (group &&
(param->group_parts > table->file->max_key_parts() ||
param->group_length > table->file->max_key_length()))
using_unique_constraint=1;
using_unique_constraint= true;
}
else
{
@ -17102,7 +17104,10 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
start_recinfo,
share->uniques, &uniquedef,
&create_info,
HA_CREATE_TMP_TABLE | HA_CREATE_INTERNAL_TABLE)))
HA_CREATE_TMP_TABLE | HA_CREATE_INTERNAL_TABLE |
((share->db_create_options & HA_OPTION_PACK_RECORD) ?
HA_PACK_RECORD : 0)
)))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
table->db_stat=0;

View File

@ -1718,7 +1718,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
For string types dump collation name only if
collation is not primary for the given charset
*/
if (!(field->charset()->state & MY_CS_PRIMARY))
if (!(field->charset()->state & MY_CS_PRIMARY) && !field->vcol_info)
{
packet->append(STRING_WITH_LEN(" COLLATE "));
packet->append(field->charset()->name);
@ -7738,11 +7738,12 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
tmp_table_param->field_count= field_count;
tmp_table_param->schema_table= 1;
SELECT_LEX *select_lex= thd->lex->current_select;
bool keep_row_order= sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND;
if (!(table= create_tmp_table(thd, tmp_table_param,
field_list, (ORDER*) 0, 0, 0,
(select_lex->options | thd->variables.option_bits |
TMP_TABLE_ALL_COLUMNS),
HA_POS_ERROR, table_list->alias)))
TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR,
table_list->alias, false, keep_row_order)))
DBUG_RETURN(0);
my_bitmap_map* bitmaps=
(my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));

View File

@ -3327,9 +3327,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->interval_list);
List_iterator<String> int_it(sql_field->interval_list);
String conv, *tmp;
char comma_buf[4]; /* 4 bytes for utf32 */
char comma_buf[5]; /* 5 bytes for 'filename' charset */
DBUG_ASSERT(sizeof(comma_buf) >= cs->mbmaxlen);
int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
(uchar*) comma_buf +
(uchar*) comma_buf +
sizeof(comma_buf));
DBUG_ASSERT(comma_length > 0);
for (uint i= 0; (tmp= int_it++); i++)

View File

@ -143,7 +143,7 @@ void udf_init()
DBUG_ENTER("ufd_init");
char db[]= "mysql"; /* A subject to casednstr, can't be constant */
if (initialized)
if (initialized || opt_noacl)
DBUG_VOID_RETURN;
#ifdef HAVE_PSI_INTERFACE
@ -268,6 +268,8 @@ void udf_free()
{
/* close all shared libraries */
DBUG_ENTER("udf_free");
if (opt_noacl)
DBUG_VOID_RETURN;
for (uint idx=0 ; idx < udf_hash.records ; idx++)
{
udf_func *udf=(udf_func*) my_hash_element(&udf_hash,idx);

View File

@ -143,5 +143,8 @@ udf_func *find_udf(const char *name, uint len=0,bool mark_used=0);
void free_udf(udf_func *udf);
int mysql_create_function(THD *thd,udf_func *udf);
int mysql_drop_function(THD *thd,const LEX_STRING *name);
#else
static inline void udf_init(void) { }
static inline void udf_free(void) { }
#endif
#endif /* SQL_UDF_INCLUDED */

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB
This program is free software; you can redistribute it and/or modify
@ -2621,21 +2621,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
outparam->record[1]= outparam->record[0]; // Safety
}
#ifdef HAVE_valgrind
/*
We need this because when we read var-length rows, we are not updating
bytes after end of varchar
*/
if (records > 1)
{
memcpy(outparam->record[0], share->default_values, share->rec_buff_length);
memcpy(outparam->record[1], share->default_values, share->null_bytes);
if (records > 2)
memcpy(outparam->record[1], share->default_values,
share->rec_buff_length);
}
#endif
if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root,
(uint) ((share->fields+1)*
sizeof(Field*)))))

View File

@ -1648,6 +1648,20 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(0);
}
class Net_error_handler : public Internal_error_handler
{
public:
Net_error_handler() {}
public:
bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate,
Sql_condition::enum_warning_level level,
const char* msg, Sql_condition ** cond_hdl)
{
return sql_errno >= ER_ABORTING_CONNECTION &&
sql_errno <= ER_NET_WRITE_INTERRUPTED;
}
};
/*
Closes a table. We call the free_share() function to free any resources
@ -1669,18 +1683,15 @@ int ha_federated::close(void)
delete_dynamic(&results);
/* Disconnect from mysql */
THD *thd= ha_thd();
Net_error_handler err_handler;
if (thd)
thd->push_internal_handler(&err_handler);
mysql_close(mysql);
mysql= NULL;
if (thd)
thd->pop_internal_handler();
/*
mysql_close() might return an error if a remote server's gone
for some reason. If that happens while removing a table from
the table cache, the error will be propagated to a client even
if the original query was not issued against the FEDERATED table.
So, don't propagate errors from mysql_close().
*/
if (table->in_use)
table->in_use->clear_error();
mysql= NULL;
DBUG_RETURN(free_share(share));
}

View File

@ -1641,6 +1641,7 @@ error:
}
static federatedx_txn zero_txn;
static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
{
bool destroy;
@ -1656,12 +1657,9 @@ static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
MEM_ROOT mem_root;
if (!txn)
{
federatedx_txn tmp_txn;
tmp_txn.close(server);
}
else
txn->close(server);
txn= &zero_txn;
txn->close(server);
DBUG_ASSERT(server->io_count == 0);
@ -1680,7 +1678,7 @@ static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
free memory associated with it.
*/
static int free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share)
static void free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share)
{
bool destroy;
DBUG_ENTER("free_share");
@ -1703,7 +1701,7 @@ static int free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share)
free_server(txn, server);
}
DBUG_RETURN(0);
DBUG_VOID_RETURN;
}
@ -1753,7 +1751,7 @@ int ha_federatedx::disconnect(handlerton *hton, MYSQL_THD thd)
int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
{
int error;
THD *thd= current_thd;
THD *thd= ha_thd();
DBUG_ENTER("ha_federatedx::open");
if (!(share= get_share(name, table)))
@ -1783,6 +1781,20 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(0);
}
class Net_error_handler : public Internal_error_handler
{
public:
Net_error_handler() {}
public:
bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate,
Sql_condition::enum_warning_level level,
const char* msg, Sql_condition ** cond_hdl)
{
return sql_errno >= ER_ABORTING_CONNECTION &&
sql_errno <= ER_NET_WRITE_INTERRUPTED;
}
};
/*
Closes a table. We call the free_share() function to free any resources
@ -1797,8 +1809,8 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
int ha_federatedx::close(void)
{
int retval= 0, error;
THD *thd= current_thd;
int retval= 0;
THD *thd= ha_thd();
DBUG_ENTER("ha_federatedx::close");
/* free the result set */
@ -1808,24 +1820,18 @@ int ha_federatedx::close(void)
/* Disconnect from mysql */
if (!thd || !(txn= get_txn(thd, true)))
{
federatedx_txn tmp_txn;
txn= &zero_txn;
tmp_txn.release(&io);
txn->release(&io);
DBUG_ASSERT(io == NULL);
DBUG_ASSERT(io == NULL);
Net_error_handler err_handler;
if (thd)
thd->push_internal_handler(&err_handler);
free_share(txn, share);
if (thd)
thd->pop_internal_handler();
if ((error= free_share(&tmp_txn, share)))
retval= error;
}
else
{
txn->release(&io);
DBUG_ASSERT(io == NULL);
if ((error= free_share(txn, share)))
retval= error;
}
DBUG_RETURN(retval);
}
@ -1848,9 +1854,8 @@ int ha_federatedx::close(void)
0 otherwise
*/
static inline uint field_in_record_is_null(TABLE *table,
Field *field,
char *record)
static inline uint field_in_record_is_null(TABLE *table, Field *field,
char *record)
{
int null_offset;
DBUG_ENTER("ha_federatedx::field_in_record_is_null");
@ -2187,7 +2192,7 @@ int ha_federatedx::end_bulk_insert()
*/
void ha_federatedx::update_auto_increment(void)
{
THD *thd= current_thd;
THD *thd= ha_thd();
DBUG_ENTER("ha_federatedx::update_auto_increment");
ha_federatedx::info(HA_STATUS_AUTO);
@ -3042,7 +3047,7 @@ error:
int ha_federatedx::info(uint flag)
{
uint error_code;
THD *thd= current_thd;
THD *thd= ha_thd();
federatedx_txn *tmp_txn;
federatedx_io *tmp_io= 0, **iop= 0;
DBUG_ENTER("ha_federatedx::info");
@ -3173,7 +3178,7 @@ int ha_federatedx::reset(void)
federatedx_io *tmp_io= 0, **iop;
// external_lock may not have been called so txn may not be set
tmp_txn= get_txn(current_thd);
tmp_txn= get_txn(ha_thd());
if (!*(iop= &io) && (error= tmp_txn->acquire(share, TRUE, (iop= &tmp_io))))
{
@ -3348,7 +3353,7 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info)
{
int retval;
THD *thd= current_thd;
THD *thd= ha_thd();
FEDERATEDX_SHARE tmp_share; // Only a temporary share, to test the url
federatedx_txn *tmp_txn;
federatedx_io *tmp_io= NULL;

View File

@ -1183,7 +1183,7 @@ dict_create_index_step(
>= UNIV_FORMAT_B);
node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS));
ut_a(err == DB_SUCCESS ? node->index != NULL : node->index == NULL);
if (err != DB_SUCCESS) {

View File

@ -2810,7 +2810,7 @@ dict_index_find_cols(
dict_field_t* field = dict_index_get_nth_field(index, i);
for (j = 0; j < table->n_cols; j++) {
if (!strcmp(dict_table_get_col_name(table, j),
if (!innobase_strcasecmp(dict_table_get_col_name(table, j),
field->name)) {
field->col = dict_table_get_nth_col(table, j);

View File

@ -2038,10 +2038,11 @@ innobase_next_autoinc(
if (next_value == 0) {
ulonglong next;
if (current > offset) {
if (current >= offset) {
next = (current - offset) / step;
} else {
next = (offset - current) / step;
next = 0;
block -= step;
}
ut_a(max_value > next);
@ -13690,15 +13691,12 @@ ha_innobase::get_auto_increment(
current = *first_value;
/* If the increment step of the auto increment column
decreases then it is not affecting the immediate
next value in the series. */
if (prebuilt->autoinc_increment > increment) {
if (prebuilt->autoinc_increment != increment) {
current = autoinc - prebuilt->autoinc_increment;
current = innobase_next_autoinc(
current, 1, increment, 1, col_max_value);
current, 1, increment, offset, col_max_value);
dict_table_autoinc_initialize(prebuilt->table, current);

View File

@ -1183,7 +1183,7 @@ dict_create_index_step(
>= UNIV_FORMAT_B);
node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS));
ut_a((node->index == 0) == (err != DB_SUCCESS));
if (err != DB_SUCCESS) {

View File

@ -2773,7 +2773,7 @@ dict_index_find_cols(
dict_field_t* field = dict_index_get_nth_field(index, i);
for (j = 0; j < table->n_cols; j++) {
if (!strcmp(dict_table_get_col_name(table, j),
if (!innobase_strcasecmp(dict_table_get_col_name(table, j),
field->name)) {
field->col = dict_table_get_nth_col(table, j);

View File

@ -2326,10 +2326,11 @@ innobase_next_autoinc(
if (next_value == 0) {
ulonglong next;
if (current > offset) {
if (current >= offset) {
next = (current - offset) / step;
} else {
next = (offset - current) / step;
next = 0;
block -= step;
}
ut_a(max_value > next);
@ -5825,6 +5826,10 @@ ha_innobase::open(
"current file system\n",
norm_name);
#endif
/* We allow use of table if it is found.
this is consistent to current behavior
to innodb_plugin */
share->ib_table = ib_table;
goto table_opened;
}
}
@ -14438,15 +14443,12 @@ ha_innobase::get_auto_increment(
current = *first_value;
/* If the increment step of the auto increment column
decreases then it is not affecting the immediate
next value in the series. */
if (prebuilt->autoinc_increment > increment) {
if (prebuilt->autoinc_increment != increment) {
current = autoinc - prebuilt->autoinc_increment;
current = innobase_next_autoinc(
current, 1, increment, 1, col_max_value);
current, 1, increment, offset, col_max_value);
dict_table_autoinc_initialize(prebuilt->table, current);

View File

@ -7113,7 +7113,7 @@ my_wc_mb_filename(CHARSET_INFO *cs __attribute__((unused)),
}
/* Non letter */
if (s + 5 > e)
if (s + 4 > e)
return MY_CS_TOOSMALL5;
*s++= hex[(wc >> 12) & 15];

View File

@ -383,6 +383,7 @@ int decimal2string(const decimal_t *from, char *to, int *to_len,
}
else
frac-=j;
frac_len= frac;
len= from->sign + intg_len + MY_TEST(frac) + frac_len;
}
*to_len=len;

View File

@ -204,7 +204,7 @@ else
fi
fi
parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
parse_server_arguments `$print_defaults $extra_args --mysqld mysql.server`
parse_server_arguments "$@"
# wait for the pid file to disappear

View File

@ -61,12 +61,42 @@ test_copy_and_compare()
}
static int
test_decimal2string()
{
decimal_t d1;
decimal_digit_t buffer[DECIMAL_BUFF_LENGTH+2];
char *str_end;
const char strnum[]= "0.1234567890123456789012345678901234567890123467";
char strbuff[50];
int len= 40;
int i;
bzero(strbuff, sizeof(strbuff));
str_end= (char *)(strnum + (sizeof(strnum) - 1));
d1.len= DECIMAL_BUFF_LENGTH + 2;
d1.buf= buffer;
string2decimal(strnum, &d1, &str_end);
decimal2string(&d1, strbuff, &len, 0, 0, 'X');
/* last digit is not checked due to possible rounding */
for (i= 0; i < 38 && strbuff[i] == strnum[i]; i++);
ok(i == 38, "Number");
for (i= 39; i < 50 && strbuff[i] == 0; i++);
ok(i == 50, "No overrun");
return 0;
}
int main()
{
plan(13);
plan(15);
diag("Testing my_decimal constructor and assignment operators");
test_copy_and_compare();
test_decimal2string();
return exit_status();
}

View File

@ -14,6 +14,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MY_ADD_TESTS(bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc
my_getopt
LINK_LIBRARIES mysys)
MY_ADD_TESTS(ma_dyncol

View File

@ -0,0 +1,71 @@
/* Copyright (C) 2015 MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <tap.h>
#include <my_getopt.h>
#include <stdarg.h>
ulonglong opt_ull;
ulong opt_ul;
int argc, res;
char **argv, *args[100];
struct my_option my_long_options[]=
{
{"ull", 0, "ull", &opt_ull, &opt_ull,
0, GET_ULL, REQUIRED_ARG, 1, 0, ~0ULL, 0, 0, 0},
{"ul", 0, "ul", &opt_ul, &opt_ul,
0, GET_ULONG, REQUIRED_ARG, 1, 0, 0xFFFFFFFF, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
void run(const char *arg, ...)
{
va_list ap;
va_start(ap, arg);
argv= args;
*argv++= (char*)"<skipped>";
while (arg)
{
*argv++= (char*)arg;
arg= va_arg(ap, char*);
}
va_end(ap);
argc= argv - args;
argv= args;
res= handle_options(&argc, &argv, my_long_options, 0);
}
int main() {
plan(3);
run("--ull=100", NULL);
ok(res==0 && argc==0 && opt_ull==100,
"res:%d, argc:%d, opt_ull:%llu", res, argc, opt_ull);
/*
negative numbers are wrapped. this is kinda questionable,
we might want to fix it eventually. but it'd be a change in behavior,
users might've got used to "-1" meaning "max possible value"
*/
run("--ull=-100", NULL);
ok(res==0 && argc==0 && opt_ull==18446744073709551516ULL,
"res:%d, argc:%d, opt_ull:%llu", res, argc, opt_ull);
run("--ul=-100", NULL);
ok(res==0 && argc==0 && opt_ul==4294967295UL,
"res:%d, argc:%d, opt_ul:%lu", res, argc, opt_ul);
return exit_status();
}