mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
Merge branch '13.0' into 'main'
This commit is contained in:
2
.github/workflows/windows-arm64.yml
vendored
2
.github/workflows/windows-arm64.yml
vendored
@@ -53,4 +53,4 @@ jobs:
|
||||
$cidir = "$tmp/ci"
|
||||
mkdir $cidir
|
||||
fsutil file setCaseSensitiveInfo $cidir enable
|
||||
perl bld\mysql-test\mysql-test-run.pl --force --parallel=$parallel --suite=main,innodb --vardir=$cidir/var --skip-rpl --mysqld=--lower-case-table-names=0 --mysqld=--loose-innodb-flush-log-at-trx-commit=2 --mysqld=--debug-no-sync --skip-test=innodb-virtual-columns
|
||||
perl bld\mysql-test\mysql-test-run.pl --force --parallel=$parallel --suite=main,innodb,parts --vardir=$cidir/var --skip-rpl --mysqld=--lower-case-table-names=0 --mysqld=--loose-innodb-flush-log-at-trx-commit=2 --mysqld=--debug-no-sync --skip-test=innodb-virtual-columns
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -117,6 +117,7 @@ extra/pcre2
|
||||
extra/libfmt
|
||||
plugin/auth_pam/auth_pam_tool
|
||||
plugin/auth_pam/config_auth_pam.h
|
||||
plugin/auth_pam/testing/mariadb_mtr
|
||||
plugin/aws_key_management/aws-sdk-cpp
|
||||
plugin/aws_key_management/aws_sdk_cpp
|
||||
plugin/aws_key_management/aws_sdk_cpp-prefix
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -6,8 +6,7 @@
|
||||
url = https://github.com/facebook/rocksdb.git
|
||||
[submodule "wsrep-lib"]
|
||||
path = wsrep-lib
|
||||
url = https://github.com/codership/wsrep-lib.git
|
||||
branch = master
|
||||
url = https://github.com/mariadb-corporation/wsrep-lib.git
|
||||
[submodule "extra/wolfssl/wolfssl"]
|
||||
path = extra/wolfssl/wolfssl
|
||||
url = https://github.com/wolfSSL/wolfssl.git
|
||||
|
||||
@@ -102,6 +102,8 @@ extern "C" {
|
||||
#define USE_POPEN
|
||||
}
|
||||
|
||||
#define HISTORY_FILE ".mariadb_history"
|
||||
|
||||
static CHARSET_INFO *charset_info= &my_charset_latin1;
|
||||
|
||||
#if defined(_WIN32)
|
||||
@@ -1444,19 +1446,19 @@ int main(int argc,char *argv[])
|
||||
else if ((home= getenv("HOME")))
|
||||
{
|
||||
size_t histfile_size=
|
||||
strlen(home) + strlen("/.mysql_history") + 2;
|
||||
strlen(home) + strlen("/" HISTORY_FILE) + 2;
|
||||
histfile=(char*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
histfile_size, MYF(MY_WME));
|
||||
if (histfile)
|
||||
{
|
||||
snprintf(histfile, histfile_size, "%s/.mariadb_history", home);
|
||||
snprintf(histfile, histfile_size, "%s/%s", home, HISTORY_FILE);
|
||||
if (my_access(histfile, F_OK))
|
||||
{
|
||||
/* no .mariadb_history, look for historical name and use if present */
|
||||
snprintf(histfile, histfile_size, "%s/.mysql_history", home);
|
||||
/* and go back to original if not found */
|
||||
if (my_access(histfile, F_OK))
|
||||
snprintf(histfile, histfile_size, "%s/.mariadb_history", home);
|
||||
snprintf(histfile, histfile_size, "%s/%s", home, HISTORY_FILE);
|
||||
}
|
||||
char link_name[FN_REFLEN];
|
||||
if (my_readlink(link_name, histfile, 0) == 0 &&
|
||||
|
||||
@@ -849,7 +849,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||
{
|
||||
/* We don't use mysql_kill(), since it only handles 32-bit IDs. */
|
||||
char buff[26], *out; /* "KILL " + max 20 digs + NUL */
|
||||
out= strxmov(buff, "KILL ", NullS);
|
||||
out= strmov(buff, "KILL ");
|
||||
ullstr(strtoull(pos, NULL, 0), out);
|
||||
|
||||
if (mysql_query(mysql, buff))
|
||||
@@ -1498,7 +1498,7 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
|
||||
{
|
||||
MYSQL_ROW row=mysql_fetch_row(result);
|
||||
if (row)
|
||||
strmov(pidfile, row[1]);
|
||||
strmake(pidfile, row[1], FN_REFLEN-1);
|
||||
mysql_free_result(result);
|
||||
return row == 0; /* Error if row = 0 */
|
||||
}
|
||||
|
||||
@@ -906,7 +906,6 @@ static int handle_request_for_tables(char *tables, size_t length,
|
||||
my_bool view, my_bool dont_quote)
|
||||
{
|
||||
char *query, *end, options[100], message[100];
|
||||
char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name;
|
||||
size_t query_length= 0, query_size= sizeof(char)*(length+110);
|
||||
const char *op = 0;
|
||||
const char *tab_view;
|
||||
@@ -984,21 +983,13 @@ static int handle_request_for_tables(char *tables, size_t length,
|
||||
DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size);
|
||||
|
||||
/* No backticks here as we added them before */
|
||||
query_length= snprintf(query, query_size, "%s%s%s %s", op,
|
||||
tab_view, tables, options);
|
||||
table_name= tables;
|
||||
query_length= my_snprintf(query, query_size, "%s%s%s %s", op,
|
||||
tab_view, tables, options);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *ptr, *org;
|
||||
|
||||
org= ptr= strmov(strmov(query, op), tab_view);
|
||||
ptr= fix_table_name(ptr, tables);
|
||||
strmake(table_name_buff, org, MY_MIN((int) sizeof(table_name_buff)-1,
|
||||
(int) (ptr - org)));
|
||||
table_name= table_name_buff;
|
||||
ptr= strxmov(ptr, " ", options, NullS);
|
||||
query_length= (size_t) (ptr - query);
|
||||
query_length= my_snprintf(query, query_size, "%s%s%sQ %s",
|
||||
op, tab_view, tables, options);
|
||||
}
|
||||
if (verbose >= 3)
|
||||
puts(query);
|
||||
@@ -1013,7 +1004,7 @@ static int handle_request_for_tables(char *tables, size_t length,
|
||||
print_result();
|
||||
if (opt_flush_tables)
|
||||
{
|
||||
query_length= snprintf(query, query_size, "FLUSH TABLES %s", table_name);
|
||||
query_length= my_snprintf(query, query_size, "FLUSH TABLES %sQ", tables);
|
||||
if (mysql_real_query(sock, query, (ulong)query_length))
|
||||
{
|
||||
DBerror(sock, query);
|
||||
@@ -1105,7 +1096,7 @@ static void __attribute__((noinline)) print_result()
|
||||
}
|
||||
else
|
||||
printf("%-9s: %s\n", row[2], row[3]);
|
||||
strmov(prev, row[0]);
|
||||
strmake_buf(prev, row[0]);
|
||||
}
|
||||
/* add the last table to be repaired to the list */
|
||||
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)
|
||||
|
||||
@@ -661,7 +661,7 @@ static int dump_all_udfs();
|
||||
static int dump_all_servers();
|
||||
static int dump_all_stats();
|
||||
static int dump_all_timezones();
|
||||
static char *quote_name(const char *name, char *buff, my_bool force);
|
||||
static char *quote_name_sz(const char *, char *, my_bool, size_t);
|
||||
char check_if_ignore_table(const char *table_name, char *table_type);
|
||||
static char *primary_key_fields(const char *table_name);
|
||||
static my_bool get_view_structure(char *table, char* db);
|
||||
@@ -687,6 +687,10 @@ static inline int cmp_table(const char *a, const char *b)
|
||||
|
||||
static int dump_galera_info(MYSQL *mysql_con);
|
||||
|
||||
#define quote_name(A,B,C) quote_name_sz(A,type_assert_buf(B),C,sizeof(B))
|
||||
#define quote_for_equal(A,B) quote_for_equal_sz(A,type_assert_buf(B),sizeof(B))
|
||||
#define quote_for_like(A,B) quote_for_like_sz(A,type_assert_buf(B),sizeof(B))
|
||||
|
||||
/*
|
||||
Print the supplied message if in verbose mode
|
||||
|
||||
@@ -2227,7 +2231,7 @@ static my_bool test_if_special_chars(const char *str)
|
||||
|
||||
|
||||
/*
|
||||
quote(name, buff, force, quote_c)
|
||||
quote_name_sz(name, buff, force, buff_size)
|
||||
|
||||
Quotes a string, if it requires quoting. To force quoting regardless
|
||||
of the characters within the string, the force flag can be set to true.
|
||||
@@ -2237,21 +2241,24 @@ static my_bool test_if_special_chars(const char *str)
|
||||
name Unquoted string containing that which will be quoted
|
||||
buff The buffer that contains the quoted value, also returned
|
||||
force Flag to make it ignore 'test_if_special_chars'
|
||||
buff_size Size of buff
|
||||
|
||||
Returns
|
||||
A pointer to the quoted string, or the original string if nothing has
|
||||
changed.
|
||||
|
||||
*/
|
||||
static char *quote_name(const char *name, char *buff, my_bool force)
|
||||
static char *quote_name_sz(const char *name, char *buff, my_bool force,
|
||||
size_t buff_size)
|
||||
{
|
||||
char *to= buff;
|
||||
char qtype= (opt_compatible_mode & MASK_ANSI_QUOTES) ? '\"' : '`';
|
||||
const char *end= buff + buff_size - 4;
|
||||
|
||||
if (!force && !opt_quoted && !test_if_special_chars(name))
|
||||
return (char*) name;
|
||||
*to++= qtype;
|
||||
while (*name)
|
||||
while (*name && to < end)
|
||||
{
|
||||
if (*name == qtype)
|
||||
*to++= qtype;
|
||||
@@ -2267,9 +2274,10 @@ static char *quote_name(const char *name, char *buff, my_bool force)
|
||||
Quote a table name so it can be used in "SHOW TABLES LIKE <tabname>"
|
||||
|
||||
SYNOPSIS
|
||||
quote_for_like()
|
||||
quote_for_like_sz()
|
||||
name name of the table
|
||||
buff quoted name of the table
|
||||
buff_size size of buff
|
||||
|
||||
DESCRIPTION
|
||||
Quote \, _, ' and % characters
|
||||
@@ -2285,11 +2293,12 @@ static char *quote_name(const char *name, char *buff, my_bool force)
|
||||
Example: "t\1" => "t\\\\1"
|
||||
|
||||
*/
|
||||
static char *quote_for_like(const char *name, char *buff)
|
||||
static char *quote_for_like_sz(const char *name, char *buff, size_t buff_size)
|
||||
{
|
||||
char *to= buff;
|
||||
const char *end= buff + buff_size - 6;
|
||||
*to++= '\'';
|
||||
while (*name)
|
||||
while (*name && to < end)
|
||||
{
|
||||
if (*name == '\\')
|
||||
{
|
||||
@@ -2306,17 +2315,16 @@ static char *quote_for_like(const char *name, char *buff)
|
||||
return buff;
|
||||
}
|
||||
|
||||
static char *quote_for_equal(const char *name, char *buff)
|
||||
static char *quote_for_equal_sz(const char *name, char *buff, size_t buff_size)
|
||||
{
|
||||
char *to= buff;
|
||||
const char *end= buff + buff_size - 4;
|
||||
*to++= '\'';
|
||||
while (*name)
|
||||
while (*name && to < end)
|
||||
{
|
||||
if (*name == '\\')
|
||||
{
|
||||
*to++='\\';
|
||||
}
|
||||
if (*name == '\'')
|
||||
else if (*name == '\'')
|
||||
*to++= '\'';
|
||||
*to++= *name++;
|
||||
}
|
||||
@@ -2713,7 +2721,7 @@ static uint dump_events_for_db(char *db)
|
||||
char *event_name;
|
||||
char delimiter[QUERY_LENGTH];
|
||||
FILE *sql_file= md_result_file;
|
||||
MYSQL_RES *event_res, *event_list_res;
|
||||
MYSQL_RES *event_res= NULL, *event_list_res= NULL;
|
||||
MYSQL_ROW row, event_list_row;
|
||||
|
||||
char db_cl_name[MY_CS_COLLATION_NAME_SIZE];
|
||||
@@ -2751,14 +2759,11 @@ static uint dump_events_for_db(char *db)
|
||||
/* Get database collation. */
|
||||
|
||||
if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name)))
|
||||
{
|
||||
mysql_free_result(event_list_res);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (switch_character_set_results(mysql, "binary"))
|
||||
DBUG_RETURN(1);
|
||||
goto err;
|
||||
|
||||
while ((event_list_row= mysql_fetch_row(event_list_res)) != NULL)
|
||||
{
|
||||
@@ -2768,7 +2773,7 @@ static uint dump_events_for_db(char *db)
|
||||
event_name);
|
||||
|
||||
if (mysql_query_with_error_report(mysql, &event_res, query_buff))
|
||||
DBUG_RETURN(1);
|
||||
goto err;
|
||||
|
||||
while ((row= mysql_fetch_row(event_res)) != NULL)
|
||||
{
|
||||
@@ -2795,7 +2800,7 @@ static uint dump_events_for_db(char *db)
|
||||
{
|
||||
fprintf(stderr, "%s: Warning: Can't create delimiter for event '%s'\n",
|
||||
my_progname_short, event_name);
|
||||
DBUG_RETURN(1);
|
||||
goto err;
|
||||
}
|
||||
|
||||
fprintf(sql_file, "DELIMITER %s\n", delimiter);
|
||||
@@ -2804,9 +2809,7 @@ static uint dump_events_for_db(char *db)
|
||||
{
|
||||
if (switch_db_collation(sql_file, db_name_buff, delimiter,
|
||||
db_cl_name, row[6], &db_cl_altered))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
goto err;
|
||||
|
||||
switch_cs_variables(sql_file, delimiter,
|
||||
row[4], /* character_set_client */
|
||||
@@ -2857,12 +2860,13 @@ static uint dump_events_for_db(char *db)
|
||||
{
|
||||
if (restore_db_collation(sql_file, db_name_buff, delimiter,
|
||||
db_cl_name))
|
||||
DBUG_RETURN(1);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* end of event printing */
|
||||
mysql_free_result(event_res);
|
||||
event_res= NULL;
|
||||
|
||||
} /* end of list of events */
|
||||
if (opt_xml)
|
||||
@@ -2877,13 +2881,21 @@ static uint dump_events_for_db(char *db)
|
||||
}
|
||||
|
||||
if (switch_character_set_results(mysql, default_charset))
|
||||
DBUG_RETURN(1);
|
||||
goto err;
|
||||
}
|
||||
mysql_free_result(event_list_res);
|
||||
|
||||
if (lock_tables)
|
||||
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
mysql_free_result(event_res);
|
||||
mysql_free_result(event_list_res);
|
||||
(void) switch_character_set_results(mysql, default_charset);
|
||||
if (lock_tables)
|
||||
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -3938,7 +3950,7 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs,
|
||||
|
||||
if (opt_drop_trigger)
|
||||
fprintf(sql_file, "/*!50032 DROP TRIGGER IF EXISTS %s */;\n",
|
||||
(*show_trigger_row)[0]);
|
||||
quote_name((*show_trigger_row)[0], name_buff, 0));
|
||||
|
||||
fprintf(sql_file,
|
||||
"DELIMITER ;;\n"
|
||||
@@ -3995,6 +4007,7 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
char *query_str;
|
||||
char name_buff[NAME_LEN*4+3];
|
||||
int db_cl_altered= FALSE;
|
||||
|
||||
DBUG_ENTER("dump_trigger");
|
||||
@@ -4022,7 +4035,7 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
|
||||
|
||||
if (opt_drop_trigger)
|
||||
fprintf(sql_file, "/*!50032 DROP TRIGGER IF EXISTS %s */;\n",
|
||||
row[0]);
|
||||
quote_name(row[0],name_buff,0));
|
||||
|
||||
query_str= cover_definer_clause(row[2], strlen(row[2]),
|
||||
C_STRING_WITH_LEN("50017"),
|
||||
@@ -5193,6 +5206,7 @@ static int dump_all_plugins()
|
||||
/* Name, Status, Type, Library, License */
|
||||
while ((row= mysql_fetch_row(tableres)))
|
||||
{
|
||||
char name_buff[NAME_LEN*2+3];
|
||||
if (strcmp("ACTIVE", row[1]) != 0)
|
||||
continue;
|
||||
/* Should we be skipping builtins? */
|
||||
@@ -5201,11 +5215,14 @@ static int dump_all_plugins()
|
||||
if (opt_replace_into)
|
||||
{
|
||||
fprintf(md_result_file, "/*M!100401 UNINSTALL PLUGIN IF EXIST %s */;\n",
|
||||
row[0]);
|
||||
quote_name(row[0], name_buff, 0));
|
||||
}
|
||||
fprintf(md_result_file,
|
||||
"INSTALL PLUGIN %s %s SONAME '%s';\n", row[0],
|
||||
opt_ignore ? "/*M!100401 IF NOT EXISTS */" : "", row[3]);
|
||||
fprintf(md_result_file, "INSTALL PLUGIN %s %s SONAME ",
|
||||
quote_name(row[0], name_buff, 0),
|
||||
opt_ignore ? "/*M!100401 IF NOT EXISTS */" : "");
|
||||
unescape(md_result_file, row[3], strlen(row[3]));
|
||||
fputs(";\n", md_result_file);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
mysql_free_result(tableres);
|
||||
|
||||
@@ -5230,6 +5247,7 @@ static int dump_all_udfs()
|
||||
/* Name, ret, dl, type*/
|
||||
while ((row= mysql_fetch_row(tableres)))
|
||||
{
|
||||
char name_buff[NAME_LEN*2+3];
|
||||
retresult= atoi(row[1]);
|
||||
if (retresult < 0 || array_elements(udf_types) <= (size_t) retresult)
|
||||
{
|
||||
@@ -5241,13 +5259,17 @@ static int dump_all_udfs()
|
||||
if (opt_replace_into)
|
||||
{
|
||||
fprintf(md_result_file, "/*!50701 DROP FUNCTION IF EXISTS %s */;\n",
|
||||
row[0]);
|
||||
quote_name(row[0], name_buff, 0));
|
||||
}
|
||||
fprintf(md_result_file,
|
||||
"CREATE %s%sFUNCTION %s%s RETURNS %s SONAME '%s';\n",
|
||||
"CREATE %s%sFUNCTION %s%s RETURNS %s SONAME ",
|
||||
opt_replace_into ? "/*M!100103 OR REPLACE */ ": "",
|
||||
(strcmp("AGGREGATE", row[2])==0 ? "AGGREGATE " : ""),
|
||||
opt_ignore ? "IF NOT EXISTS " : "", row[0], udf_types[retresult], row[2]);
|
||||
(strcmp("aggregate", row[3])==0 ? "AGGREGATE " : ""),
|
||||
opt_ignore ? "IF NOT EXISTS " : "",
|
||||
quote_name(row[0], name_buff, 0), udf_types[retresult]);
|
||||
unescape(md_result_file, row[2], strlen(row[2]));
|
||||
fputs(";\n", md_result_file);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
mysql_free_result(tableres);
|
||||
|
||||
@@ -5271,10 +5293,20 @@ static int dump_all_servers()
|
||||
{
|
||||
/* row[0] is the server name */
|
||||
char buff[20+FN_REFLEN];
|
||||
my_snprintf(buff, sizeof(buff), "show create server %s", row[0]);
|
||||
char name_buff[NAME_LEN*2+3];
|
||||
my_snprintf(buff, sizeof(buff), "show create server %s",
|
||||
quote_name(row[0], name_buff, 0));
|
||||
if (mysql_query_with_error_report(mysql, &serverres, buff))
|
||||
{
|
||||
mysql_free_result(tableres);
|
||||
return 1;
|
||||
row= mysql_fetch_row(serverres);
|
||||
}
|
||||
if (!(row= mysql_fetch_row(serverres)) || mysql_num_fields(serverres) < 2)
|
||||
{
|
||||
mysql_free_result(serverres);
|
||||
mysql_free_result(tableres);
|
||||
return 1;
|
||||
}
|
||||
row[1]+= 14; /* strlen("CREATE SERVER ") == 14 */
|
||||
fprintf(md_result_file, "CREATE %sSERVER %s%s\n",
|
||||
opt_replace_into ? "/*M!100103 OR REPLACE */ ": "",
|
||||
@@ -5540,7 +5572,7 @@ static int dump_tablespaces(char* ts_where)
|
||||
if (first)
|
||||
{
|
||||
first= 0;
|
||||
strxmov(buf, row[0], NullS);
|
||||
strmake_buf(buf, row[0]);
|
||||
}
|
||||
}
|
||||
dynstr_free(&sqlbuf);
|
||||
@@ -5604,7 +5636,7 @@ static int dump_tablespaces(char* ts_where)
|
||||
if (first)
|
||||
{
|
||||
first= 0;
|
||||
strxmov(buf, row[0], NullS);
|
||||
strmake_buf(buf, row[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5888,7 +5920,7 @@ static int dump_all_tables_in_db(char *database)
|
||||
int using_mysql_db= !cmp_database(database, "mysql");
|
||||
DBUG_ENTER("dump_all_tables_in_db");
|
||||
|
||||
afterdot= strmov(hash_key, database);
|
||||
afterdot= strnmov(hash_key, database, NAME_LEN);
|
||||
*afterdot++= '.';
|
||||
|
||||
if (opt_dir)
|
||||
@@ -5909,7 +5941,7 @@ static int dump_all_tables_in_db(char *database)
|
||||
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
|
||||
for (numrows= 0 ; (table= getTableName(1, DUMP_TABLE_ALL)) ; )
|
||||
{
|
||||
char *end= strmov(afterdot, table);
|
||||
char *end= strnmov(afterdot, table, NAME_LEN);
|
||||
if (include_table((uchar*) hash_key,end - hash_key))
|
||||
{
|
||||
numrows++;
|
||||
@@ -5948,14 +5980,14 @@ static int dump_all_tables_in_db(char *database)
|
||||
// First process sequences
|
||||
while ((table= getTableName(1, DUMP_TABLE_SEQUENCE)))
|
||||
{
|
||||
char *end= strmov(afterdot, table);
|
||||
char *end= strnmov(afterdot, table, NAME_LEN);
|
||||
if (include_table((uchar*) hash_key, end - hash_key))
|
||||
get_sequence_structure(table, database);
|
||||
}
|
||||
}
|
||||
while ((table= getTableName(0, DUMP_TABLE_TABLE)))
|
||||
{
|
||||
char *end= strmov(afterdot, table);
|
||||
char *end= strnmov(afterdot, table, NAME_LEN);
|
||||
if (include_table((uchar*) hash_key, end - hash_key))
|
||||
{
|
||||
dump_table(table, database, (uchar*) hash_key, end - hash_key);
|
||||
@@ -6069,7 +6101,7 @@ static my_bool dump_all_views_in_db(char *database)
|
||||
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
|
||||
char *afterdot;
|
||||
|
||||
afterdot= strmov(hash_key, database);
|
||||
afterdot= strnmov(hash_key, database, NAME_LEN);
|
||||
*afterdot++= '.';
|
||||
|
||||
if (init_dumping(database, init_dumping_views))
|
||||
@@ -6082,7 +6114,7 @@ static my_bool dump_all_views_in_db(char *database)
|
||||
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
|
||||
for (numrows= 0 ; (table= getTableName(1, DUMP_TABLE_TABLE)); )
|
||||
{
|
||||
char *end= strmov(afterdot, table);
|
||||
char *end= strnmov(afterdot, table, NAME_LEN);
|
||||
if (include_table((uchar*) hash_key,end - hash_key))
|
||||
{
|
||||
numrows++;
|
||||
@@ -6105,7 +6137,7 @@ static my_bool dump_all_views_in_db(char *database)
|
||||
}
|
||||
while ((table= getTableName(0, DUMP_TABLE_TABLE)))
|
||||
{
|
||||
char *end= strmov(afterdot, table);
|
||||
char *end= strnmov(afterdot, table, NAME_LEN);
|
||||
if (include_table((uchar*) hash_key, end - hash_key))
|
||||
get_view_structure(table, database);
|
||||
}
|
||||
@@ -6585,6 +6617,7 @@ static int do_show_slave_status(MYSQL *mysql_con,
|
||||
const char *gtid_comment_prefix= (use_gtid ? comment_prefix : "-- ");
|
||||
const char *nogtid_comment_prefix= (!use_gtid ? comment_prefix : "-- ");
|
||||
char gtid_pos[MAX_GTID_LENGTH];
|
||||
char name_buff[FN_REFLEN*2+3];
|
||||
|
||||
if (have_info_schema_slave_status)
|
||||
{
|
||||
@@ -6635,17 +6668,23 @@ static int do_show_slave_status(MYSQL *mysql_con,
|
||||
{
|
||||
if (use_gtid)
|
||||
fprintf(md_result_file,
|
||||
"%sCHANGE MASTER '%.*s' TO MASTER_USE_GTID=slave_pos;\n",
|
||||
gtid_comment_prefix, NAME_CHAR_LEN, row[/* Connection_name */ 0]);
|
||||
fprintf(md_result_file, "%sCHANGE MASTER '%.*s' TO ",
|
||||
nogtid_comment_prefix, NAME_CHAR_LEN, row[/* Connection_name */ 0]);
|
||||
"%sCHANGE MASTER %s TO MASTER_USE_GTID=slave_pos;\n",
|
||||
gtid_comment_prefix, quote_for_equal(row[/* Connection_name */ 0],
|
||||
name_buff));
|
||||
fprintf(md_result_file, "%sCHANGE MASTER %s TO ",
|
||||
nogtid_comment_prefix,
|
||||
quote_for_equal(row[/* Connection_name */ 0], name_buff));
|
||||
if (opt_include_master_host_port)
|
||||
fprintf(md_result_file, "MASTER_HOST='%s', MASTER_PORT=%s, ",
|
||||
row[have_info_schema_slave_status ? 1 : /* Master_Host */ 3],
|
||||
row[have_info_schema_slave_status ? 2 : /* Master_Port */ 5]);
|
||||
fprintf(md_result_file, "MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
|
||||
row[have_info_schema_slave_status ? 3 : /* Relay_Master_Log_File */ 11],
|
||||
row[have_info_schema_slave_status ? 4 : /* Exec_Master_Log_Pos */ 23]);
|
||||
fprintf(md_result_file, "MASTER_HOST=%s, MASTER_PORT=%llu, ",
|
||||
quote_for_equal(row[have_info_schema_slave_status ? 1
|
||||
: /* Master_Host */ 3], name_buff),
|
||||
atoll(row[have_info_schema_slave_status ? 2
|
||||
: /* Master_Port */ 5]));
|
||||
fprintf(md_result_file, "MASTER_LOG_FILE=%s, MASTER_LOG_POS=%llu;\n",
|
||||
quote_for_equal(row[have_info_schema_slave_status ? 3
|
||||
: /* Relay_Master_Log_File */ 11], name_buff),
|
||||
atoll(row[have_info_schema_slave_status ? 4
|
||||
: /* Exec_Master_Log_Pos */ 23]));
|
||||
check_io(md_result_file);
|
||||
}
|
||||
|
||||
@@ -7060,8 +7099,8 @@ cleanup:
|
||||
*/
|
||||
|
||||
static int replace(DYNAMIC_STRING *ds_str,
|
||||
const char *search_str, ulong search_len,
|
||||
const char *replace_str, ulong replace_len)
|
||||
const char *search_str, size_t search_len,
|
||||
const char *replace_str, size_t replace_len)
|
||||
{
|
||||
DYNAMIC_STRING ds_tmp;
|
||||
const char *start= strstr(ds_str->str, search_str);
|
||||
@@ -7070,7 +7109,7 @@ static int replace(DYNAMIC_STRING *ds_str,
|
||||
init_dynamic_string_checked(&ds_tmp, "",
|
||||
ds_str->length + replace_len, 256);
|
||||
dynstr_append_mem_checked(&ds_tmp, ds_str->str, (uint)(start - ds_str->str));
|
||||
dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
|
||||
dynstr_append_mem_checked(&ds_tmp, replace_str, (uint)replace_len);
|
||||
dynstr_append_checked(&ds_tmp, start + search_len);
|
||||
dynstr_set_checked(ds_str, ds_tmp.str);
|
||||
dynstr_free(&ds_tmp);
|
||||
@@ -7177,10 +7216,9 @@ static my_bool get_view_structure(char *table, char* db)
|
||||
}
|
||||
else
|
||||
{
|
||||
char *ptr;
|
||||
ulong *lengths;
|
||||
char search_buf[256], replace_buf[256];
|
||||
ulong search_len, replace_len;
|
||||
size_t search_len, replace_len;
|
||||
DYNAMIC_STRING ds_view;
|
||||
|
||||
/* Save the result of SHOW CREATE TABLE in ds_view */
|
||||
@@ -7208,13 +7246,10 @@ static my_bool get_view_structure(char *table, char* db)
|
||||
*/
|
||||
if (strcmp(row[0], "NONE"))
|
||||
{
|
||||
|
||||
ptr= search_buf;
|
||||
search_len= (ulong)(strxmov(ptr, "WITH ", row[0],
|
||||
" CHECK OPTION", NullS) - ptr);
|
||||
ptr= replace_buf;
|
||||
replace_len=(ulong)(strxmov(ptr, "*/\n/*!50002 WITH ", row[0],
|
||||
" CHECK OPTION", NullS) - ptr);
|
||||
search_len= my_snprintf(search_buf, sizeof(search_buf),
|
||||
"WITH %s CHECK OPTION", row[0]);
|
||||
replace_len= my_snprintf(replace_buf, sizeof(replace_buf),
|
||||
"*/\n/*!50002 WITH %s CHECK OPTION", row[0]);
|
||||
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
|
||||
}
|
||||
|
||||
@@ -7233,21 +7268,16 @@ static my_bool get_view_structure(char *table, char* db)
|
||||
parse_user(row[1], lengths[1], user_name_str, &user_name_len,
|
||||
host_name_str, &host_name_len);
|
||||
|
||||
ptr= search_buf;
|
||||
search_len=
|
||||
(ulong)(strxmov(ptr, "DEFINER=",
|
||||
quote_name(user_name_str, quoted_user_name_str, FALSE),
|
||||
"@",
|
||||
quote_name(host_name_str, quoted_host_name_str, FALSE),
|
||||
" SQL SECURITY ", row[2], NullS) - ptr);
|
||||
ptr= replace_buf;
|
||||
replace_len=
|
||||
(ulong)(strxmov(ptr, "*/\n/*!50013 DEFINER=",
|
||||
quote_name(user_name_str, quoted_user_name_str, FALSE),
|
||||
"@",
|
||||
quote_name(host_name_str, quoted_host_name_str, FALSE),
|
||||
" SQL SECURITY ", row[2],
|
||||
" */\n/*!50001", NullS) - ptr);
|
||||
search_len= my_snprintf(search_buf, sizeof(search_buf),
|
||||
"DEFINER=%s@%s SQL SECURITY %s",
|
||||
quote_name(user_name_str, quoted_user_name_str, FALSE),
|
||||
quote_name(host_name_str, quoted_host_name_str, FALSE),
|
||||
row[2]);
|
||||
replace_len= my_snprintf(replace_buf, sizeof(replace_buf),
|
||||
"*/\n/*!50013 DEFINER=%s@%s SQL SECURITY %s */\n/*!50001",
|
||||
quote_name(user_name_str, quoted_user_name_str, FALSE),
|
||||
quote_name(host_name_str, quoted_host_name_str, FALSE),
|
||||
row[2]);
|
||||
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
|
||||
}
|
||||
|
||||
@@ -7846,24 +7876,25 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_system & OPT_SYSTEM_PLUGINS)
|
||||
dump_all_plugins();
|
||||
if ((opt_system & OPT_SYSTEM_PLUGINS) && dump_all_plugins() && !first_error)
|
||||
first_error= EX_MYSQLERR;
|
||||
|
||||
if (opt_system & OPT_SYSTEM_USERS)
|
||||
dump_all_users_roles_and_grants();
|
||||
if ((opt_system & OPT_SYSTEM_USERS) &&
|
||||
dump_all_users_roles_and_grants() && !first_error)
|
||||
first_error= EX_MYSQLERR;
|
||||
|
||||
if (opt_system & OPT_SYSTEM_UDFS)
|
||||
dump_all_udfs();
|
||||
if ((opt_system & OPT_SYSTEM_UDFS) && dump_all_udfs() && !first_error)
|
||||
first_error= EX_MYSQLERR;
|
||||
|
||||
if (opt_system & OPT_SYSTEM_SERVERS)
|
||||
dump_all_servers();
|
||||
if ((opt_system & OPT_SYSTEM_SERVERS) && dump_all_servers() && !first_error)
|
||||
first_error= EX_MYSQLERR;
|
||||
|
||||
/* These must be last as they explicitly change the current database to mysql */
|
||||
if (opt_system & OPT_SYSTEM_STATS)
|
||||
dump_all_stats();
|
||||
if ((opt_system & OPT_SYSTEM_STATS) && dump_all_stats() && !first_error)
|
||||
first_error= EX_MYSQLERR;
|
||||
|
||||
if (opt_system & OPT_SYSTEM_TIMEZONES)
|
||||
dump_all_timezones();
|
||||
if ((opt_system & OPT_SYSTEM_TIMEZONES) && dump_all_timezones() && !first_error)
|
||||
first_error= EX_MYSQLERR;
|
||||
|
||||
if (opt_master_data && master_set_gtid_pos[0])
|
||||
do_print_set_gtid_slave_pos(master_set_gtid_pos, TRUE);
|
||||
|
||||
@@ -711,7 +711,7 @@ int table_load_params::load_data(MYSQL *mysql)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (!opt_local_file)
|
||||
strmov(hard_path,filename);
|
||||
strmake_buf(hard_path, filename);
|
||||
else
|
||||
my_load_path(hard_path, filename, NULL); /* filename includes the path */
|
||||
|
||||
|
||||
@@ -464,7 +464,7 @@ list_dbs(MYSQL *mysql,const char *wild)
|
||||
while ((trow = mysql_fetch_row(tresult)))
|
||||
{
|
||||
my_snprintf(query, sizeof(query),
|
||||
"SELECT COUNT(*) FROM `%s`", trow[0]);
|
||||
"SELECT COUNT(*) FROM %sQ", trow[0]);
|
||||
if (!(mysql_query(mysql,query)))
|
||||
{
|
||||
MYSQL_RES *rresult;
|
||||
@@ -606,7 +606,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
|
||||
if (opt_verbose > 1)
|
||||
{
|
||||
/* Print the count of rows for each table */
|
||||
my_snprintf(query, sizeof(query), "SELECT COUNT(*) FROM `%s`",
|
||||
my_snprintf(query, sizeof(query), "SELECT COUNT(*) FROM %sQ",
|
||||
row[0]);
|
||||
if (!(mysql_query(mysql,query)))
|
||||
{
|
||||
@@ -673,15 +673,13 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild)
|
||||
MYSQL_ROW row;
|
||||
|
||||
len= sizeof(query);
|
||||
len-= my_snprintf(query, len, "show table status from `%s`", db);
|
||||
len-= my_snprintf(query, len, "show table status from %sQ", db);
|
||||
if (wild && wild[0] && len)
|
||||
strxnmov(query + strlen(query), len - 1, " 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",
|
||||
my_progname,db,wild ? wild : "",mysql_error(mysql));
|
||||
if (mysql_errno(mysql) == ER_PARSE_ERROR)
|
||||
fprintf(stderr,"This error probably means that your MariaDB server doesn't support the\n\'show table status' command.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -722,7 +720,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
|
||||
|
||||
if (opt_count)
|
||||
{
|
||||
my_snprintf(query, sizeof(query), "select count(*) from `%s`", table);
|
||||
my_snprintf(query, sizeof(query), "select count(*) from %sQ", 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",
|
||||
@@ -735,7 +733,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
|
||||
}
|
||||
|
||||
len= sizeof(query);
|
||||
len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`",
|
||||
len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from %sQ",
|
||||
table);
|
||||
if (wild && wild[0] && len)
|
||||
strxnmov(query + strlen(query), len - 1, " like '", wild, "'", NullS);
|
||||
@@ -759,7 +757,9 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
|
||||
print_res_top(result);
|
||||
if (opt_show_keys)
|
||||
{
|
||||
my_snprintf(query, sizeof(query), "show keys from `%s`", table);
|
||||
mysql_free_result(result); /* free the columns result set */
|
||||
result= NULL;
|
||||
my_snprintf(query, sizeof(query), "show keys from %sQ", table);
|
||||
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
|
||||
{
|
||||
fprintf(stderr,"%s: Cannot list keys in db: %s, table: %s: %s\n",
|
||||
|
||||
@@ -4700,9 +4700,12 @@ void do_write_file_command(struct st_command *command, my_bool append)
|
||||
static DYNAMIC_STRING ds_content;
|
||||
static DYNAMIC_STRING ds_filename;
|
||||
static DYNAMIC_STRING ds_delimiter;
|
||||
static DYNAMIC_STRING ds_eval_flag;
|
||||
my_bool eval_content;
|
||||
const struct command_arg write_file_args[] = {
|
||||
{ "filename", ARG_STRING, TRUE, &ds_filename, "File to write to" },
|
||||
{ "delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until" }
|
||||
{ "delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until" },
|
||||
{ "eval", ARG_STRING, FALSE, &ds_eval_flag, "Evaluate the content" }
|
||||
};
|
||||
DBUG_ENTER("do_write_file");
|
||||
|
||||
@@ -4715,6 +4718,14 @@ void do_write_file_command(struct st_command *command, my_bool append)
|
||||
if (bad_path(ds_filename.str))
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
if ((eval_content= (ds_eval_flag.length != 0)) &&
|
||||
strcasecmp(ds_eval_flag.str, "eval"))
|
||||
{
|
||||
report_or_die("Invalid argument '%s' to '%.*s', only 'eval' is allowed",
|
||||
ds_eval_flag.str, command->first_word_len, command->query);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
if (!append && access(ds_filename.str, F_OK) == 0)
|
||||
{
|
||||
/* The file should not be overwritten */
|
||||
@@ -4737,10 +4748,24 @@ void do_write_file_command(struct st_command *command, my_bool append)
|
||||
if (cur_block->ok)
|
||||
{
|
||||
DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str));
|
||||
str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
|
||||
if (eval_content)
|
||||
{
|
||||
/* Evaluate on every execution, keep command->content unevaluated */
|
||||
DYNAMIC_STRING ds_eval_content;
|
||||
if (init_dynamic_string(&ds_eval_content, "", ds_content.length + 256, 256))
|
||||
die("Out of memory");
|
||||
do_eval(&ds_eval_content, ds_content.str,
|
||||
ds_content.str + ds_content.length, FALSE);
|
||||
str_to_file2(ds_filename.str, ds_eval_content.str, ds_eval_content.length,
|
||||
append);
|
||||
dynstr_free(&ds_eval_content);
|
||||
}
|
||||
else
|
||||
str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append);
|
||||
}
|
||||
dynstr_free(&ds_filename);
|
||||
dynstr_free(&ds_delimiter);
|
||||
dynstr_free(&ds_eval_flag);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@@ -4751,11 +4776,11 @@ void do_write_file_command(struct st_command *command, my_bool append)
|
||||
command called command
|
||||
|
||||
DESCRIPTION
|
||||
write_file <file_name> [<delimiter>];
|
||||
write_file <file_name> [<delimiter> [eval]];
|
||||
<what to write line 1>
|
||||
<...>
|
||||
< what to write line n>
|
||||
EOF
|
||||
<delimiter>
|
||||
|
||||
--write_file <file_name>;
|
||||
<what to write line 1>
|
||||
@@ -4766,6 +4791,9 @@ void do_write_file_command(struct st_command *command, my_bool append)
|
||||
Write everything between the "write_file" command and 'delimiter'
|
||||
to "file_name"
|
||||
|
||||
If 'eval' is given, variables and expressions in the content are
|
||||
substituted. It requires <delimiter> to be given explicitly.
|
||||
|
||||
NOTE! Will fail if <file_name> exists
|
||||
|
||||
Default <delimiter> is EOF
|
||||
@@ -4827,11 +4855,11 @@ void do_write_line(struct st_command *command)
|
||||
command called command
|
||||
|
||||
DESCRIPTION
|
||||
append_file <file_name> [<delimiter>];
|
||||
append_file <file_name> [<delimiter> [eval]];
|
||||
<what to write line 1>
|
||||
<...>
|
||||
< what to write line n>
|
||||
EOF
|
||||
<delimiter>
|
||||
|
||||
--append_file <file_name>;
|
||||
<what to write line 1>
|
||||
@@ -4842,6 +4870,9 @@ void do_write_line(struct st_command *command)
|
||||
Append everything between the "append_file" command
|
||||
and 'delimiter' to "file_name"
|
||||
|
||||
If 'eval' is given, variables and expressions in the content are
|
||||
substituted. It requires <delimiter> to be given explicitly.
|
||||
|
||||
Default <delimiter> is EOF
|
||||
|
||||
*/
|
||||
|
||||
@@ -12,11 +12,20 @@ MACRO(BUNDLE_LIBFMT)
|
||||
SET(fmt_byproducts BUILD_BYPRODUCTS ${LIBFMT_INCLUDE_DIR}/fmt/format-inl.h)
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
|
||||
# it's for RHEL-7, gcc 4.8.5
|
||||
# with newer fmt it complains about missing space in operator""_a()
|
||||
SET(source URL "https://github.com/fmtlib/fmt/releases/download/11.0.2/fmt-11.0.2.zip"
|
||||
URL_MD5 c622dca45ec3fc95254c48370a9f7a1d)
|
||||
ELSE()
|
||||
SET(source URL "https://github.com/fmtlib/fmt/releases/download/12.2.0/fmt-12.2.0.zip"
|
||||
URL_MD5 6083253772ad29e73a4d5920be08918e)
|
||||
ENDIF()
|
||||
|
||||
ExternalProject_Add(
|
||||
libfmt
|
||||
PREFIX "${dir}"
|
||||
URL "https://github.com/fmtlib/fmt/releases/download/12.1.0/fmt-12.1.0.zip"
|
||||
URL_MD5 028c6979cad96a4260154f091885171a
|
||||
${source}
|
||||
INSTALL_COMMAND ""
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
||||
@@ -347,11 +347,13 @@ MACRO(CONFIGURE_PLUGINS)
|
||||
|
||||
GET_CMAKE_PROPERTY(ALL_VARS VARIABLES)
|
||||
FOREACH (V ${ALL_VARS})
|
||||
IF (V MATCHES "^PLUGIN_" AND ${V} MATCHES "YES")
|
||||
STRING(SUBSTRING ${V} 7 -1 plugin)
|
||||
STRING(TOLOWER ${plugin} target)
|
||||
IF (NOT TARGET ${target})
|
||||
MESSAGE(FATAL_ERROR "Plugin ${plugin} cannot be built")
|
||||
IF (V MATCHES "^PLUGIN_")
|
||||
IF (${V} STREQUAL "YES")
|
||||
STRING(SUBSTRING ${V} 7 -1 plugin)
|
||||
STRING(TOLOWER ${plugin} target)
|
||||
IF (NOT TARGET ${target})
|
||||
MESSAGE(FATAL_ERROR "Plugin ${plugin} cannot be built")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
8
debian/mariadb-test-data.lintian-overrides
vendored
8
debian/mariadb-test-data.lintian-overrides
vendored
@@ -411,11 +411,15 @@ package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-te
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/mariadb-conv/file01.utf8.txt]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/mariadb-conv/file02.latin1.txt]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/mysql5613mysql/README]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/new-format-relay-log-win.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/new-format-relay-log.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/master-10.0.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/master-12.3.2.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/numbers.txt]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/old-format-relay-log-win.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/old-format-relay-log.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/relay-log-10.0-win.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/relay-log-10.0.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/relay-log-12.3.2-win.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/relay-log-12.3.2.info]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/unicode/allkeys1400.txt]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/unicode/allkeys400.txt]
|
||||
package-contains-documentation-outside-usr-share-doc [usr/share/mysql/mariadb-test/std_data/unicode/allkeys520.txt]
|
||||
|
||||
@@ -623,7 +623,7 @@ static uint parse_input_file(const char *file_name, struct errors **top_error,
|
||||
|
||||
static uint parse_error_offset(char *str)
|
||||
{
|
||||
char *soffset, *end;
|
||||
char *soffset;
|
||||
int error;
|
||||
uint ioffset;
|
||||
|
||||
@@ -651,8 +651,7 @@ static uint parse_error_offset(char *str)
|
||||
}
|
||||
DBUG_PRINT("info", ("str: %s", str));
|
||||
|
||||
end= 0;
|
||||
ioffset= (uint) my_strtoll10(soffset, &end, &error);
|
||||
ioffset= (uint) my_strtoll10(soffset, NULL, &error);
|
||||
my_free(soffset);
|
||||
DBUG_RETURN(ioffset);
|
||||
}
|
||||
|
||||
@@ -1544,13 +1544,17 @@ ibx_copy_incremental_over_full()
|
||||
|
||||
if (directory_exists(ROCKSDB_BACKUP_DIR, false)) {
|
||||
if (my_rmtree(ROCKSDB_BACKUP_DIR, MYF(0))) {
|
||||
die("Can't remove " ROCKSDB_BACKUP_DIR);
|
||||
msg("Can't remove " ROCKSDB_BACKUP_DIR);
|
||||
ret = false;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
snprintf(path, sizeof(path), "%s/" ROCKSDB_BACKUP_DIR, xtrabackup_incremental_dir);
|
||||
if (directory_exists(path, false)) {
|
||||
if (my_mkdir(ROCKSDB_BACKUP_DIR, 0777, MYF(0))) {
|
||||
die("my_mkdir failed for " ROCKSDB_BACKUP_DIR);
|
||||
msg("my_mkdir failed for " ROCKSDB_BACKUP_DIR);
|
||||
ret = false;
|
||||
goto cleanup;
|
||||
}
|
||||
ds_data->copy_or_move_dir(path, ROCKSDB_BACKUP_DIR, true, true);
|
||||
}
|
||||
|
||||
@@ -7414,7 +7414,6 @@ void handle_options(int argc, char **argv, char ***argv_server,
|
||||
sys_var_init();
|
||||
plugin_mutex_init();
|
||||
mysql_prlock_init(key_rwlock_LOCK_system_variables_hash, &LOCK_system_variables_hash);
|
||||
opt_stack_trace = 1;
|
||||
test_flags |= TEST_SIGINT;
|
||||
init_signals();
|
||||
#ifndef _WIN32
|
||||
|
||||
@@ -478,6 +478,15 @@ int json_normalize(DYNAMIC_STRING *result,
|
||||
|
||||
int json_skip_array_and_count(json_engine_t *j, int* n_item);
|
||||
|
||||
/*
|
||||
Compare two JSON string values semantically, taking Unicode escape
|
||||
sequences into account. For example, "A" and "\u0041" are considered equal.
|
||||
Returns 0 if the strings are equal, non-zero otherwise.
|
||||
*/
|
||||
int json_string_compare(CHARSET_INFO *cs,
|
||||
const uchar *str1, int len1, int escaped1,
|
||||
const uchar *str2, int len2, int escaped2);
|
||||
|
||||
inline static int json_scan_ended(json_engine_t *j)
|
||||
{
|
||||
return (j->state == JST_ARRAY_END && j->stack_p == 0);
|
||||
|
||||
@@ -59,13 +59,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef DBUG_OFF
|
||||
#if defined(HAVE_STPCPY) && defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
||||
#define strmov(A,B) __builtin_stpcpy((A),(B))
|
||||
#elif defined(HAVE_STPCPY)
|
||||
#define strmov(A,B) stpcpy((A),(B))
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
__attribute__((nonnull))
|
||||
static inline char *strmov(char *dst, const char *src)
|
||||
{
|
||||
size_t l;
|
||||
DBUG_ASSERT(dst != NULL);
|
||||
DBUG_ASSERT(src != NULL);
|
||||
|
||||
l= strlen(src);
|
||||
memmove(dst, src, l + 1);
|
||||
return dst + l;
|
||||
}
|
||||
#endif /* strmov */
|
||||
|
||||
/* Declared in int2str() */
|
||||
extern const char _dig_vec_base62[];
|
||||
@@ -86,14 +96,16 @@ extern char *strfill(char * s,size_t len,pchar fill);
|
||||
extern char *strmake(char *dst,const char *src,size_t length);
|
||||
|
||||
#if !defined(__GNUC__) || (__GNUC__ < 4)
|
||||
#define strmake_buf(D,S) strmake(D, S, sizeof(D) - 1)
|
||||
#define type_assert_buf(D) (D)
|
||||
#else
|
||||
#define strmake_buf(D,S) ({ \
|
||||
#define type_assert_buf(D) ({ \
|
||||
__typeof__ (D) __x __attribute__((unused)) = { 2 }; \
|
||||
strmake(D, S, sizeof(D) - 1); \
|
||||
(D); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define strmake_buf(D,S) strmake(type_assert_buf(D), S, sizeof(D) - 1)
|
||||
|
||||
#ifndef strmov
|
||||
extern char *strmov(char *dst,const char *src);
|
||||
#endif
|
||||
|
||||
@@ -471,7 +471,10 @@ typedef struct st_net {
|
||||
my_bool thread_specific_malloc;
|
||||
unsigned char compress;
|
||||
my_bool pkt_nr_can_be_reset;
|
||||
/* Bits: NET_PROXY_PROTOCOL, NET_PROXY_PROTOCOL_CONNECT_ERRORS */
|
||||
my_bool using_proxy_protocol;
|
||||
#define NET_PROXY_PROTOCOL 1
|
||||
#define NET_PROXY_PROTOCOL_CONNECT_ERRORS 2
|
||||
/*
|
||||
Pointer to query object in query cache, do not equal NULL (0) for
|
||||
queries in cache that have not stored its results yet
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# include/no_valgrind_without_big.inc
|
||||
#
|
||||
# If we are running with Valgrind ($VALGRIND_TEST <> 0) than the resource
|
||||
# consumption (storage space needed, runtime ...) will be extreme.
|
||||
# Therefore we require that the option "--big-test" is also set.
|
||||
#
|
||||
|
||||
if ($VALGRIND_TEST) {
|
||||
if (!$BIG_TEST)
|
||||
{
|
||||
--skip Need "--big-test" when running with Valgrind
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,6 @@ main.group_by_null
|
||||
main.group_min_max
|
||||
main.group_min_max_innodb
|
||||
main.handler_read_last
|
||||
main.handlersocket
|
||||
main.having
|
||||
main.help
|
||||
main.host_cache_size_functionality
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
if "%MTR_PARALLEL%"=="" set MTR_PARALLEL=%NUMBER_OF_PROCESSORS%
|
||||
perl mysql-test-run.pl --force --suite-timeout=120 --max-test-fail=10 --retry=3 --suite=^
|
||||
vcol,gcol,period,perfschema,^
|
||||
vcol,gcol,period,perfschema,parts,^
|
||||
main,^
|
||||
innodb,^
|
||||
versioning,^
|
||||
|
||||
@@ -53,7 +53,6 @@ main.fulltext
|
||||
main.function_defaults
|
||||
main.gis
|
||||
main.grant
|
||||
main.handlersocket
|
||||
main.information_schema
|
||||
main.innodb_ext_key
|
||||
main.log_tables
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# $statement The statement to be checked.
|
||||
# $cleanup_stmt1 The 1st statement to be run in order to revert effects
|
||||
# of statement to be checked.
|
||||
# $cleanup_stmt2 The 2nd statement to be run in order to revert effects
|
||||
# $mkdir_db The 2nd statement to be run in order to revert effects
|
||||
# of statement to be checked.
|
||||
# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third
|
||||
# stage is to check that metadata locks taken by this
|
||||
@@ -45,9 +45,9 @@ if ($cleanup_stmt1)
|
||||
{
|
||||
--eval $cleanup_stmt1;
|
||||
}
|
||||
if ($cleanup_stmt2)
|
||||
if ($mkdir_db)
|
||||
{
|
||||
--eval $cleanup_stmt2;
|
||||
--mkdir $mkdir_db
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ if ($cleanup_stmt1)
|
||||
{
|
||||
--eval $cleanup_stmt1;
|
||||
}
|
||||
if ($cleanup_stmt2)
|
||||
if ($mkdir_db)
|
||||
{
|
||||
--eval $cleanup_stmt2;
|
||||
--mkdir $mkdir_db
|
||||
}
|
||||
|
||||
if (!$skip_3rd_check)
|
||||
@@ -143,9 +143,9 @@ if ($cleanup_stmt1)
|
||||
{
|
||||
--eval $cleanup_stmt1;
|
||||
}
|
||||
if ($cleanup_stmt2)
|
||||
if ($mkdir_db)
|
||||
{
|
||||
--eval $cleanup_stmt2;
|
||||
--mkdir $mkdir_db
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# Setup the mysqld to crash at shutdown
|
||||
SET debug_dbug="d,crash_shutdown";
|
||||
--error 2013
|
||||
--error 2013,2026
|
||||
shutdown;
|
||||
|
||||
# Turn on reconnect
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[lcase_def]
|
||||
[lcase0]
|
||||
[lcase1]
|
||||
lower_case_table_names=1
|
||||
[lcase2]
|
||||
|
||||
@@ -1,2 +1,16 @@
|
||||
# The goal of including this file is to test with different
|
||||
# lower_case_table_names modes (see include/lcase_name.combinations)
|
||||
# lower_case_table_names modes (see include/lcase_names.combinations).
|
||||
# Skip a combination unless the server actually ended up in the intended mode.
|
||||
|
||||
if ($MTR_COMBINATION_LCASE0)
|
||||
{
|
||||
--source include/have_lowercase0.inc
|
||||
}
|
||||
if ($MTR_COMBINATION_LCASE1)
|
||||
{
|
||||
--source include/have_lowercase1.inc
|
||||
}
|
||||
if ($MTR_COMBINATION_LCASE2)
|
||||
{
|
||||
--source include/have_lowercase2.inc
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ system echo wait-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/mysqld.1.exp
|
||||
|
||||
eval SET SESSION debug_dbug=$mvr_debug_option;
|
||||
--echo * crashing mysqld intentionally
|
||||
--error 2013
|
||||
--error 2013,2026
|
||||
eval $mvr_crash_statement; # this will crash (DBUG magic)
|
||||
|
||||
if ($mvr_restore_old_snapshot)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
if (`select @@have_ssl = 'YES'`)
|
||||
if (`select variable_value <> '' from information_schema.session_status where variable_name='ssl_cipher'`)
|
||||
{
|
||||
skip only without SSL;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ EOF
|
||||
|
||||
FLUSH TABLES;
|
||||
SET SESSION debug_dbug="+d,crash_dispatch_command_before";
|
||||
--error 2006,2013
|
||||
--error 2006,2013,2026
|
||||
SELECT 1;
|
||||
|
||||
--source include/wait_until_disconnected.inc
|
||||
@@ -166,7 +166,7 @@ EOF
|
||||
if (!$binlog_in_engine) {
|
||||
FLUSH TABLES;
|
||||
SET SESSION debug_dbug="+d,crash_before_writing_xid";
|
||||
--error 2006,2013
|
||||
--error 2006,2013,2026
|
||||
INSERT INTO t1 SELECT a+4, '++server_1' FROM t2;
|
||||
|
||||
--source include/wait_until_disconnected.inc
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
# [--let $binlog_start= <POSITION> ]
|
||||
# [--let $binlog_limit= 1, 3 ]
|
||||
# [--let $skip_checkpoint_events= 1]
|
||||
# [--let $skip_tablemap_events= 1]
|
||||
# --source include/show_binlog_events.inc
|
||||
#
|
||||
# Parameters:
|
||||
|
||||
@@ -130,6 +130,10 @@ if ($skip_checkpoint_events)
|
||||
{
|
||||
let $filter_script=Binlog_checkpoint;
|
||||
}
|
||||
if ($skip_tablemap_events)
|
||||
{
|
||||
let $filter_script=Table_map;
|
||||
}
|
||||
|
||||
|
||||
#--let $select_columns= 1 3 6
|
||||
|
||||
18
mysql-test/lib/generate-ssl-certs.sh
Executable file → Normal file
18
mysql-test/lib/generate-ssl-certs.sh
Executable file → Normal file
@@ -67,6 +67,24 @@ rm -fv crldir/*
|
||||
cp -v client-cert.crl crldir/`openssl x509 -in client-cert.pem -noout -issuer_hash`.r0
|
||||
|
||||
rm -rf demoCA
|
||||
# --- Galera SST chain certificate ---
|
||||
# A single leaf+intermediate chain certificate usable as both client and
|
||||
# server (a Galera node acts as SST donor and joiner), CN=localhost so the
|
||||
# donor's host check passes over 127.0.0.1. The CA file holds the root only,
|
||||
# the layout produced by cert-manager and similar PKIs.
|
||||
rm -rf gcadir
|
||||
mkdir gcadir
|
||||
openssl genrsa -out gcadir/root.key 4096
|
||||
openssl req -new -x509 '-sha256' -key gcadir/root.key -out galera-chain-ca.pem -days 7300 -subj "/O=MariaDB/OU=MariaDB/CN=Galera Chain Root CA" -addext "basicConstraints=critical,CA:TRUE" -addext "keyUsage=critical,keyCertSign,cRLSign"
|
||||
openssl genrsa -out gcadir/int.key 4096
|
||||
openssl req -new '-sha256' -key gcadir/int.key -out gcadir/int.csr -subj "/O=MariaDB/OU=MariaDB/CN=Galera Chain Intermediate CA"
|
||||
openssl x509 -req -in gcadir/int.csr -CA galera-chain-ca.pem -CAkey gcadir/root.key -CAcreateserial -days 7200 -sha256 -extfile <(printf "basicConstraints=critical,CA:TRUE,pathlen:0\nkeyUsage=critical,keyCertSign,cRLSign") -out gcadir/int.crt
|
||||
openssl genrsa -out galera-chain-key.pem 4096
|
||||
openssl req -new '-sha256' -key galera-chain-key.pem -out gcadir/leaf.csr -subj "/CN=localhost"
|
||||
openssl x509 -req -in gcadir/leaf.csr -CA gcadir/int.crt -CAkey gcadir/int.key -CAcreateserial -days 7100 -sha256 -extfile <(printf "basicConstraints=CA:FALSE\nkeyUsage=critical,digitalSignature,keyEncipherment\nextendedKeyUsage=serverAuth,clientAuth\nsubjectAltName=DNS:localhost,IP:127.0.0.1") -out gcadir/leaf.crt
|
||||
cat gcadir/leaf.crt gcadir/int.crt > galera-chain-cert.pem
|
||||
rm -rf gcadir
|
||||
|
||||
|
||||
# --- Certificate Chain ---
|
||||
# These tests are inspired from the following commit from MySQL Server
|
||||
|
||||
@@ -3201,6 +3201,22 @@ t3 CREATE TABLE `t3` (
|
||||
drop tables t1, t2, t3;
|
||||
# End of 10.11 tests
|
||||
#
|
||||
# MDEV-37739 parts test suite fails on case-insensitive filesystems, debug assertions, wrong results
|
||||
#
|
||||
create database Another;
|
||||
create table t1 (c int) engine=innodb;
|
||||
alter table t1 rename to Another.Tp4;
|
||||
show create table Another.Tp4;
|
||||
Table Create Table
|
||||
Tp4 CREATE TABLE `Tp4`-ok (
|
||||
`c` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
drop table Another.Tp4;
|
||||
drop database Another;
|
||||
#
|
||||
# End of 11.4 tests
|
||||
#
|
||||
#
|
||||
# MDEV-33655 Remove alter_algorithm
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
|
||||
|
||||
@@ -2486,6 +2486,28 @@ drop tables t1, t2, t3;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-37739 parts test suite fails on case-insensitive filesystems, debug assertions, wrong results
|
||||
--echo #
|
||||
|
||||
create database Another;
|
||||
create table t1 (c int) engine=innodb;
|
||||
alter table t1 rename to Another.Tp4;
|
||||
--let $tp4=`select '`Tp4`'`
|
||||
--let $lc1=`select @@lower_case_table_names = 1`
|
||||
if ($lc1)
|
||||
{
|
||||
--let $tp4= `select '`tp4`'`
|
||||
}
|
||||
--replace_result $tp4 `Tp4`-ok
|
||||
show create table Another.Tp4;
|
||||
drop table Another.Tp4;
|
||||
drop database Another;
|
||||
|
||||
--echo #
|
||||
--echo # End of 11.4 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-33655 Remove alter_algorithm
|
||||
--echo #
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_ssl_communication.inc
|
||||
--source include/not_ssl.inc
|
||||
|
||||
#Suppress warning by the server certificate verification check: unrelated CA
|
||||
call mtr.add_suppression("Server SSL certificate doesn't verify");
|
||||
|
||||
@@ -221,23 +221,23 @@ drop table t1;
|
||||
use test;
|
||||
drop table if exists t;
|
||||
create table t(a int, b int check(b>0),
|
||||
constraint b check(a<b), constraint a check(a>0),
|
||||
constraint a_lt_b check(a<b), constraint a check(a>0),
|
||||
constraint x check (a>10));
|
||||
show create table t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL CHECK (`b` > 0),
|
||||
CONSTRAINT `b` CHECK (`a` < `b`),
|
||||
CONSTRAINT `a_lt_b` CHECK (`a` < `b`),
|
||||
CONSTRAINT `a` CHECK (`a` > 0),
|
||||
CONSTRAINT `x` CHECK (`a` > 10)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
# Field constraint 'b' will fail
|
||||
insert into t values (-1, 0);
|
||||
ERROR 23000: CONSTRAINT `t.b` failed for `test`.`t`
|
||||
# Table constraint 'b' will fail
|
||||
# Table constraint 'a_lt_b' will fail
|
||||
insert into t values (1,1);
|
||||
ERROR 23000: CONSTRAINT `b` failed for `test`.`t`
|
||||
ERROR 23000: CONSTRAINT `a_lt_b` failed for `test`.`t`
|
||||
drop table t;
|
||||
create table t1 (a int auto_increment primary key, b int, check (b > 5));
|
||||
insert t1 (b) values (1);
|
||||
@@ -439,6 +439,66 @@ ERROR 22007: Truncated incorrect DECIMAL value: 'a'
|
||||
insert into t1 values ("b");
|
||||
ERROR 22007: Truncated incorrect DECIMAL value: 'b'
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-24598 Duplicate CHECK constraint names are allowed
|
||||
#
|
||||
CREATE TABLE t1 (a INT CHECK (a>2), CONSTRAINT a CHECK (a < 5));
|
||||
ERROR HY000: Duplicate CHECK constraint name 'a'
|
||||
CREATE TABLE t2 (
|
||||
path VARCHAR(100) NOT NULL,
|
||||
json_c1 JSON NOT NULL DEFAULT '{}',
|
||||
CONSTRAINT json_c1 CHECK (path > 0)
|
||||
);
|
||||
ERROR HY000: Duplicate CHECK constraint name 'json_c1'
|
||||
CREATE TABLE t3 (a INT, CONSTRAINT c1 CHECK (a > 0),
|
||||
CONSTRAINT c1 CHECK (a < 100));
|
||||
ERROR HY000: Duplicate CHECK constraint name 'c1'
|
||||
CREATE TABLE t4 (CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 0),
|
||||
CHECK (CONSTRAINT_1 < 100));
|
||||
SHOW CREATE TABLE t4;
|
||||
Table Create Table
|
||||
t4 CREATE TABLE `t4` (
|
||||
`CONSTRAINT_1` int(11) DEFAULT NULL CHECK (`CONSTRAINT_1` > 0),
|
||||
CONSTRAINT `CONSTRAINT_2` CHECK (`CONSTRAINT_1` < 100)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
DROP TABLE t4;
|
||||
CREATE TABLE t5 (a INT, CONSTRAINT b CHECK (a > 0));
|
||||
ALTER TABLE t5 ADD COLUMN b INT CHECK (b > 5);
|
||||
ERROR HY000: Duplicate CHECK constraint name 'b'
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t6 (a INT CHECK (a > 0));
|
||||
ALTER TABLE t6 ADD CONSTRAINT a CHECK (a < 100);
|
||||
ERROR HY000: Duplicate CHECK constraint name 'a'
|
||||
DROP TABLE t6;
|
||||
CREATE TABLE t7 (a INT CHECK (a > 0), CONSTRAINT new_a CHECK (a < 100));
|
||||
ALTER TABLE t7 RENAME COLUMN a TO new_a;
|
||||
ERROR HY000: Duplicate CHECK constraint name 'new_a'
|
||||
DROP TABLE t7;
|
||||
CREATE TABLE t8 (CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 0));
|
||||
ALTER TABLE t8 ADD CHECK (CONSTRAINT_1 < 100);
|
||||
SHOW CREATE TABLE t8;
|
||||
Table Create Table
|
||||
t8 CREATE TABLE `t8` (
|
||||
`CONSTRAINT_1` int(11) DEFAULT NULL CHECK (`CONSTRAINT_1` > 0),
|
||||
CONSTRAINT `CONSTRAINT_2` CHECK (`CONSTRAINT_1` < 100)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
DROP TABLE t8;
|
||||
CREATE TABLE t9 (a INT, CHECK (a > 0));
|
||||
SHOW CREATE TABLE t9;
|
||||
Table Create Table
|
||||
t9 CREATE TABLE `t9` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
ALTER TABLE t9 ADD COLUMN CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 5);
|
||||
ERROR HY000: Duplicate CHECK constraint name 'CONSTRAINT_1'
|
||||
SHOW CREATE TABLE t9;
|
||||
Table Create Table
|
||||
t9 CREATE TABLE `t9` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
DROP TABLE t9;
|
||||
# End of 10.11 tests
|
||||
#
|
||||
# MDEV-32439 INSERT IGNORE VALUES (one row) errors on constraint
|
||||
|
||||
@@ -145,7 +145,7 @@ drop table if exists t;
|
||||
--enable_warnings
|
||||
|
||||
create table t(a int, b int check(b>0),
|
||||
constraint b check(a<b), constraint a check(a>0),
|
||||
constraint a_lt_b check(a<b), constraint a check(a>0),
|
||||
constraint x check (a>10));
|
||||
|
||||
show create table t;
|
||||
@@ -155,8 +155,8 @@ show create table t;
|
||||
--error ER_CONSTRAINT_FAILED
|
||||
insert into t values (-1, 0);
|
||||
|
||||
# Generate error when table constraint 'b' is violated.
|
||||
--echo # Table constraint 'b' will fail
|
||||
# Generate error when table constraint 'a_lt_b' is violated.
|
||||
--echo # Table constraint 'a_lt_b' will fail
|
||||
--error ER_CONSTRAINT_FAILED
|
||||
insert into t values (1,1);
|
||||
|
||||
@@ -339,6 +339,66 @@ insert into t1 values ("a");
|
||||
insert into t1 values ("b");
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-24598 Duplicate CHECK constraint names are allowed
|
||||
--echo #
|
||||
|
||||
#
|
||||
# CREATE TABLE: explicit table-level name clashes with column-level check
|
||||
#
|
||||
|
||||
--error ER_DUP_CONSTRAINT_NAME
|
||||
CREATE TABLE t1 (a INT CHECK (a>2), CONSTRAINT a CHECK (a < 5));
|
||||
|
||||
--error ER_DUP_CONSTRAINT_NAME
|
||||
CREATE TABLE t2 (
|
||||
path VARCHAR(100) NOT NULL,
|
||||
json_c1 JSON NOT NULL DEFAULT '{}',
|
||||
CONSTRAINT json_c1 CHECK (path > 0)
|
||||
);
|
||||
|
||||
--error ER_DUP_CONSTRAINT_NAME
|
||||
CREATE TABLE t3 (a INT, CONSTRAINT c1 CHECK (a > 0),
|
||||
CONSTRAINT c1 CHECK (a < 100));
|
||||
|
||||
# Auto-generated constraint name should not duplicate a column-level check name
|
||||
CREATE TABLE t4 (CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 0),
|
||||
CHECK (CONSTRAINT_1 < 100));
|
||||
SHOW CREATE TABLE t4;
|
||||
DROP TABLE t4;
|
||||
|
||||
# ALTER TABLE ADD COLUMN: new column check clashes with existing constraint
|
||||
CREATE TABLE t5 (a INT, CONSTRAINT b CHECK (a > 0));
|
||||
--error ER_DUP_CONSTRAINT_NAME
|
||||
ALTER TABLE t5 ADD COLUMN b INT CHECK (b > 5);
|
||||
DROP TABLE t5;
|
||||
|
||||
# ALTER TABLE ADD CONSTRAINT: new constraint name clashes with column-level check
|
||||
CREATE TABLE t6 (a INT CHECK (a > 0));
|
||||
--error ER_DUP_CONSTRAINT_NAME
|
||||
ALTER TABLE t6 ADD CONSTRAINT a CHECK (a < 100);
|
||||
DROP TABLE t6;
|
||||
|
||||
# ALTER TABLE RENAME COLUMN: renamed column check clashes with existing constraint
|
||||
CREATE TABLE t7 (a INT CHECK (a > 0), CONSTRAINT new_a CHECK (a < 100));
|
||||
--error ER_DUP_CONSTRAINT_NAME
|
||||
ALTER TABLE t7 RENAME COLUMN a TO new_a;
|
||||
DROP TABLE t7;
|
||||
|
||||
# ALTER TABLE ADD CHECK: auto-generated name must not clash with column-level check
|
||||
CREATE TABLE t8 (CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 0));
|
||||
ALTER TABLE t8 ADD CHECK (CONSTRAINT_1 < 100);
|
||||
SHOW CREATE TABLE t8;
|
||||
DROP TABLE t8;
|
||||
|
||||
# ALTER TABLE ADD COLUMN whose name matches an existing auto-generated constraint
|
||||
CREATE TABLE t9 (a INT, CHECK (a > 0));
|
||||
SHOW CREATE TABLE t9;
|
||||
--error ER_DUP_CONSTRAINT_NAME
|
||||
ALTER TABLE t9 ADD COLUMN CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 5);
|
||||
SHOW CREATE TABLE t9;
|
||||
DROP TABLE t9;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
--echo #
|
||||
|
||||
@@ -481,7 +481,7 @@ set global max_connections= 10;
|
||||
while ($n)
|
||||
{
|
||||
--error 0,ER_CON_COUNT_ERROR
|
||||
--connect (con$n,localhost,root)
|
||||
--connect con$n,localhost,root,,,,,NOSSL
|
||||
if ($mysql_errno) {
|
||||
--echo # ERROR $mysql_errno
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ disconnect con1;
|
||||
connection default;
|
||||
set global debug_dbug='+d,simulate_failed_connection_1';
|
||||
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
|
||||
--error 1041,2013
|
||||
--error 1041,2013,2026
|
||||
connect(con1,localhost,root,,test,,);
|
||||
connection default;
|
||||
set global debug_dbug=@old_debug;
|
||||
set global debug_dbug='+d,simulate_failed_connection_2';
|
||||
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
|
||||
--error 1041,2013
|
||||
--error 1041,2013,2026
|
||||
connect(con1,localhost,root,,test,,);
|
||||
--enable_result_log
|
||||
connection default;
|
||||
@@ -38,13 +38,13 @@ disconnect con1;
|
||||
connection default;
|
||||
set global debug_dbug='+d,simulate_failed_connection_1';
|
||||
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_EXTRA_PORT MASTER_PORT
|
||||
--error 1041,2013
|
||||
--error 1041,2013,2026
|
||||
connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
|
||||
connection default;
|
||||
set global debug_dbug=@old_debug;
|
||||
set global debug_dbug='+d,simulate_failed_connection_2';
|
||||
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_EXTRA_PORT MASTER_PORT
|
||||
--error 1041,2013
|
||||
--error 1041,2013,2026
|
||||
connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
|
||||
connection default;
|
||||
set global debug_dbug=@old_debug;
|
||||
@@ -66,7 +66,7 @@ disconnect con2;
|
||||
connection default;
|
||||
set global debug_dbug='+d,simulate_failed_connection_2';
|
||||
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_EXTRA_PORT MASTER_PORT
|
||||
--error 1041,2013
|
||||
--error 1041,2013,2026
|
||||
connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
|
||||
connection default;
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ Warning 1911 Unknown option 'foo'
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`f` int(11) DEFAULT NULL `foo`=bar CHECK (`f` > 0)
|
||||
`f` int(11) DEFAULT NULL `foo`='bar' CHECK (`f` > 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
DROP table test.t;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
|
||||
@@ -3,7 +3,7 @@ START TRANSACTION;
|
||||
insert into t1 values(9);
|
||||
SET GLOBAL debug_dbug="d,crash_commit_before";
|
||||
COMMIT;
|
||||
ERROR HY000: Lost connection to server during query
|
||||
Got one of the listed errors
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
|
||||
@@ -20,7 +20,7 @@ SET GLOBAL debug_dbug="d,crash_commit_before";
|
||||
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
|
||||
# Run the crashing query
|
||||
--error 2013
|
||||
--error 2013,2026
|
||||
COMMIT;
|
||||
|
||||
# Turn on reconnect
|
||||
|
||||
@@ -1228,7 +1228,7 @@ create table t3 (a int) row_format=page;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
# -- End of Bug#45829
|
||||
create table `#mysql50#t-1` (a int) engine=myisam;
|
||||
create table t1 (a int) engine=myisam;
|
||||
insert into `#mysql50#t-1` values (1);
|
||||
show tables;
|
||||
Tables_in_test
|
||||
|
||||
@@ -1179,7 +1179,10 @@ drop table t1,t2,t3;
|
||||
# new table creation/renaming is NOT blocked if old encoded table present
|
||||
#
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
create table `#mysql50#t-1` (a int) engine=myisam;
|
||||
create table t1 (a int) engine=myisam;
|
||||
--move_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t-1.frm
|
||||
--move_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t-1.MYI
|
||||
--move_file $MYSQLD_DATADIR/test/t1.MYD $MYSQLD_DATADIR/test/t-1.MYD
|
||||
insert into `#mysql50#t-1` values (1);
|
||||
show tables;
|
||||
create table `t-1` (a int);
|
||||
|
||||
@@ -3382,12 +3382,12 @@ SELECT * FROM t1 WHERE (a XOR '0');
|
||||
a
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '`1'
|
||||
Warning 1292 Truncated incorrect BOOLEAN value: '`1'
|
||||
SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
|
||||
a
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '`1'
|
||||
Warning 1292 Truncated incorrect BOOLEAN value: '`1'
|
||||
# ' 1' should not be propagated into (a XIR '0')
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
|
||||
@@ -9017,3 +9017,22 @@ DROP TABLE t1;
|
||||
#
|
||||
# End of 10.6 tests
|
||||
#
|
||||
#
|
||||
# MDEV-39690: UBSAN: signed integer overflow in `my_strntoll_8bit`, `my_strntoll_mb2_or_mb4` during BLOB-to-integer conversion
|
||||
#
|
||||
SET @old_mode=@@sql_mode;
|
||||
SET sql_mode='';
|
||||
CREATE TABLE t1 (c BLOB);
|
||||
INSERT INTO t1 VALUES ('-9223372036854775808');
|
||||
SELECT * FROM t1 WHERE c IN (VALUES(1));
|
||||
c
|
||||
CREATE TABLE t2 (c VARCHAR(30) CHARACTER SET latin1);
|
||||
INSERT INTO t2 VALUES ('-9223372036854775809'),('-9223372036854775808'),('1');
|
||||
SELECT * FROM t2 WHERE c IN (VALUES(1));
|
||||
c
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775809'
|
||||
DROP TABLE t1, t2;
|
||||
SET @@sql_mode= @old_mode;
|
||||
# End of 10.11 tests
|
||||
|
||||
@@ -559,3 +559,23 @@ DROP TABLE t1;
|
||||
--echo #
|
||||
--echo # End of 10.6 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-39690: UBSAN: signed integer overflow in `my_strntoll_8bit`, `my_strntoll_mb2_or_mb4` during BLOB-to-integer conversion
|
||||
--echo #
|
||||
|
||||
SET @old_mode=@@sql_mode;
|
||||
SET sql_mode='';
|
||||
|
||||
CREATE TABLE t1 (c BLOB);
|
||||
INSERT INTO t1 VALUES ('-9223372036854775808');
|
||||
SELECT * FROM t1 WHERE c IN (VALUES(1));
|
||||
|
||||
CREATE TABLE t2 (c VARCHAR(30) CHARACTER SET latin1);
|
||||
INSERT INTO t2 VALUES ('-9223372036854775809'),('-9223372036854775808'),('1');
|
||||
SELECT * FROM t2 WHERE c IN (VALUES(1));
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
SET @@sql_mode= @old_mode;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
@@ -6794,3 +6794,18 @@ SET names latin1;
|
||||
#
|
||||
# End of 10.6 tests
|
||||
#
|
||||
#
|
||||
# MDEV-39690: UBSAN: signed integer overflow in `my_strntoll_8bit`, `my_strntoll_mb2_or_mb4` during BLOB-to-integer conversion
|
||||
#
|
||||
SET @old_mode=@@sql_mode;
|
||||
SET sql_mode='';
|
||||
CREATE TABLE t1 (c VARCHAR(30) CHARACTER SET ucs2);
|
||||
INSERT INTO t1 VALUES ('-9223372036854775809'),('-9223372036854775808'),('1');
|
||||
SELECT * FROM t1 WHERE c IN (VALUES(1));
|
||||
c
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775809'
|
||||
DROP TABLE t1;
|
||||
SET @@sql_mode= @old_mode;
|
||||
# End of 10.11 tests
|
||||
|
||||
@@ -1260,3 +1260,19 @@ SET names latin1;
|
||||
--echo #
|
||||
--echo # End of 10.6 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-39690: UBSAN: signed integer overflow in `my_strntoll_8bit`, `my_strntoll_mb2_or_mb4` during BLOB-to-integer conversion
|
||||
--echo #
|
||||
|
||||
SET @old_mode=@@sql_mode;
|
||||
SET sql_mode='';
|
||||
|
||||
CREATE TABLE t1 (c VARCHAR(30) CHARACTER SET ucs2);
|
||||
INSERT INTO t1 VALUES ('-9223372036854775809'),('-9223372036854775808'),('1');
|
||||
SELECT * FROM t1 WHERE c IN (VALUES(1));
|
||||
|
||||
DROP TABLE t1;
|
||||
SET @@sql_mode= @old_mode;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
@@ -689,7 +689,7 @@ t1 CREATE TABLE `t1` (
|
||||
INSERT INTO t1 VALUES ();
|
||||
SELECT * FROM t1;
|
||||
i01 1
|
||||
i02 99
|
||||
i02 14649
|
||||
i03 1
|
||||
i04 1
|
||||
i05 NULL
|
||||
|
||||
@@ -395,7 +395,7 @@ create table t1 (a int, b int) engine=myisam;
|
||||
insert into t1 values (1,1);
|
||||
SET debug_dbug="d,crash_shutdown";
|
||||
shutdown;
|
||||
ERROR HY000: Lost connection to server during query
|
||||
Got one of the listed errors
|
||||
call mtr.add_suppression(" marked as crashed and should be repaired");
|
||||
call mtr.add_suppression("Checking table");
|
||||
insert delayed into t1 values (2,2);
|
||||
|
||||
@@ -1526,6 +1526,31 @@ SELECT * FROM v6_t;
|
||||
ERROR HY000: View 'test.v6_t' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
DROP VIEW v1_t, v2_t, v3_t, v4_t, v5_t, v6_t;
|
||||
DROP TABLE t;
|
||||
#
|
||||
# MDEV-17846 Wrong result with grouping select from merged derived table
|
||||
#
|
||||
CREATE TABLE t1 (f1 int);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE TABLE t2 (f1 int, t1_f1 int);
|
||||
INSERT INTO t2 VALUES (674,1),(679,1),(684,1),(689,1),(694,1),(901,1),(608,1),
|
||||
(610,1),(299,1),(667,1),(51951034,2),(281,2),(116,2),(740,2),(974,2);
|
||||
SET optimizer_switch = 'derived_merge=off';
|
||||
SELECT dt.tf1,
|
||||
(SELECT COUNT(dt.tf1) FROM t1 WHERE t1.f1 = dt.tf1 AND dt.tf1 = 1) AS val
|
||||
FROM (SELECT t1.f1 AS tf1, t2.f1 FROM t1 JOIN t2 ON t1.f1 = t2.t1_f1) AS dt
|
||||
GROUP BY dt.tf1;
|
||||
tf1 val
|
||||
1 10
|
||||
2 NULL
|
||||
SET optimizer_switch = 'derived_merge=on';
|
||||
SELECT dt.tf1,
|
||||
(SELECT COUNT(dt.tf1) FROM t1 WHERE t1.f1 = dt.tf1 AND dt.tf1 = 1) AS val
|
||||
FROM (SELECT t1.f1 AS tf1, t2.f1 FROM t1 JOIN t2 ON t1.f1 = t2.t1_f1) AS dt
|
||||
GROUP BY dt.tf1;
|
||||
tf1 val
|
||||
1 10
|
||||
2 NULL
|
||||
drop table t1, t2;
|
||||
# End of 10.11 tests
|
||||
#
|
||||
# Test of "Derived tables and union can now create distinct keys"
|
||||
|
||||
@@ -1297,6 +1297,32 @@ DROP VIEW v1_t, v2_t, v3_t, v4_t, v5_t, v6_t;
|
||||
DROP TABLE t;
|
||||
--enable_view_protocol
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17846 Wrong result with grouping select from merged derived table
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (f1 int);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
CREATE TABLE t2 (f1 int, t1_f1 int);
|
||||
INSERT INTO t2 VALUES (674,1),(679,1),(684,1),(689,1),(694,1),(901,1),(608,1),
|
||||
(610,1),(299,1),(667,1),(51951034,2),(281,2),(116,2),(740,2),(974,2);
|
||||
|
||||
let $q=
|
||||
SELECT dt.tf1,
|
||||
(SELECT COUNT(dt.tf1) FROM t1 WHERE t1.f1 = dt.tf1 AND dt.tf1 = 1) AS val
|
||||
FROM (SELECT t1.f1 AS tf1, t2.f1 FROM t1 JOIN t2 ON t1.f1 = t2.t1_f1) AS dt
|
||||
GROUP BY dt.tf1;
|
||||
|
||||
SET optimizer_switch = 'derived_merge=off';
|
||||
eval $q;
|
||||
|
||||
SET optimizer_switch = 'derived_merge=on';
|
||||
eval $q;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
--echo #
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
call mtr.add_suppression("table or database name 'abc`def'");
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
drop database if exists client_test_db;
|
||||
call mtr.add_suppression("Invalid .old.. table or database name 'a-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234'");
|
||||
drop table t1;
|
||||
ERROR 42S02: Unknown table 'test.t1'
|
||||
create table t1(n int);
|
||||
@@ -79,8 +77,6 @@ show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
drop table t1;
|
||||
drop database if exists mysqltest;
|
||||
drop table if exists t1;
|
||||
create table t1 (i int);
|
||||
create database mysqltest;
|
||||
lock tables t1 read;
|
||||
@@ -99,7 +95,6 @@ connection addconroot2;
|
||||
disconnect addconroot2;
|
||||
disconnect addconroot1;
|
||||
connection default;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
lock table t1 read;
|
||||
@@ -125,7 +120,7 @@ disconnect addconroot;
|
||||
connection default;
|
||||
unlock tables;
|
||||
drop table t1,t2;
|
||||
End of 5.0 tests
|
||||
# End of 5.0 tests
|
||||
create database mysql_test;
|
||||
create table mysql_test.t1(f1 int);
|
||||
create table mysql_test.`#sql-347f_7` (f1 int);
|
||||
@@ -146,56 +141,44 @@ database()
|
||||
NULL
|
||||
use test;
|
||||
|
||||
# --
|
||||
# -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not
|
||||
# -- exist.
|
||||
# --
|
||||
DROP DATABASE IF EXISTS mysql_test;
|
||||
#
|
||||
# Bug#29958: Weird message on DROP DATABASE if mysql.proc does not exist
|
||||
#
|
||||
CREATE DATABASE mysql_test;
|
||||
DROP TABLE mysql.proc;
|
||||
DROP DATABASE mysql_test;
|
||||
Warnings:
|
||||
Error 1146 Table 'mysql.proc' doesn't exist
|
||||
|
||||
# --
|
||||
# -- End of Bug#29958.
|
||||
# --
|
||||
|
||||
#
|
||||
# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks
|
||||
#
|
||||
create database mysqltestbug26703;
|
||||
use mysqltestbug26703;
|
||||
create table `#mysql50#abc``def` ( id int );
|
||||
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
|
||||
ERROR 42000: Incorrect table name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
|
||||
create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234` (a int);
|
||||
create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345` (a int);
|
||||
ERROR 42000: Incorrect table name '#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345'
|
||||
create table t1 (id int);
|
||||
show tables;
|
||||
Tables_in_mysqltestbug26703
|
||||
#mysql50#a-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234
|
||||
#mysql50#abc`def
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
show create table `#mysql50#abc``def`;
|
||||
Table Create Table
|
||||
#mysql50#abc`def CREATE TABLE `#mysql50#abc``def` (
|
||||
`id` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
use test;
|
||||
drop database mysqltestbug26703;
|
||||
End of 5.1 tests
|
||||
# End of 5.1 tests
|
||||
|
||||
# --
|
||||
# -- Bug#37431 (DROP TABLE does not report errors correctly).
|
||||
# --
|
||||
DROP TABLE IF EXISTS t1;
|
||||
#
|
||||
# Bug#37431 (DROP TABLE does not report errors correctly).
|
||||
#
|
||||
DROP TABLE t1;
|
||||
ERROR 42S02: Unknown table 'test.t1'
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Error 1051 Unknown table 'test.t1'
|
||||
|
||||
# --
|
||||
# -- End of Bug#37431.
|
||||
# --
|
||||
#
|
||||
# Bug#54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
LOCK TABLE t1 WRITE;
|
||||
DROP TABLE t1, t1;
|
||||
@@ -233,7 +216,6 @@ INSERT INTO table2 SELECT t.notable.*;
|
||||
INSERT INTO table1 VALUES (1);
|
||||
ERROR 42S02: Unknown table 't.notable'
|
||||
DROP TABLE table1,table2;
|
||||
# End BUG#34750
|
||||
#
|
||||
# MDEV-11105 Table named 'db' has weird side effect.
|
||||
#
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
call mtr.add_suppression("table or database name 'abc`def'");
|
||||
call mtr.add_suppression("Invalid .old.. table or database name 'a-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234'");
|
||||
|
||||
# Initialise
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop database if exists mysqltest;
|
||||
# If earlier test failed
|
||||
drop database if exists client_test_db;
|
||||
--enable_warnings
|
||||
|
||||
--error 1051
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t1;
|
||||
create table t1(n int);
|
||||
insert into t1 values(1);
|
||||
create temporary table t1( n int);
|
||||
insert into t1 values(2);
|
||||
--error 1050
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
create table t1(n int);
|
||||
drop table t1;
|
||||
select * from t1;
|
||||
@@ -41,14 +34,14 @@ create database mysqltest;
|
||||
# (tableN instead on tN)
|
||||
#
|
||||
use mysqltest;
|
||||
--error 1051
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table table1, table2, table3, table4, table5, table6,
|
||||
table7, table8, table9, table10, table11, table12, table13,
|
||||
table14, table15, table16, table17, table18, table19, table20,
|
||||
table21, table22, table23, table24, table25, table26, table27,
|
||||
table28;
|
||||
|
||||
--error 1051
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table table1, table2, table3, table4, table5, table6,
|
||||
table7, table8, table9, table10, table11, table12, table13,
|
||||
table14, table15, table16, table17, table18, table19, table20,
|
||||
@@ -60,24 +53,24 @@ drop database mysqltest;
|
||||
|
||||
# test drop/create database and FLUSH TABLES WITH READ LOCK
|
||||
flush tables with read lock;
|
||||
--error 1209,1223
|
||||
--error ER_CREATE_DB_WITH_READ_LOCK,ER_CANT_UPDATE_WITH_READLOCK
|
||||
create database mysqltest;
|
||||
unlock tables;
|
||||
create database mysqltest;
|
||||
show databases;
|
||||
flush tables with read lock;
|
||||
--error 1208,1223
|
||||
--error ER_DROP_DB_WITH_READ_LOCK,ER_CANT_UPDATE_WITH_READLOCK
|
||||
drop database mysqltest;
|
||||
unlock tables;
|
||||
drop database mysqltest;
|
||||
show databases;
|
||||
--error 1008
|
||||
--error ER_DB_DROP_EXISTS
|
||||
drop database mysqltest;
|
||||
|
||||
# test create table and FLUSH TABLES WITH READ LOCK
|
||||
drop table t1;
|
||||
flush tables with read lock;
|
||||
--error 1223
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
create table t1(n int);
|
||||
unlock tables;
|
||||
create table t1(n int);
|
||||
@@ -100,10 +93,6 @@ drop table t1;
|
||||
# and one of name-locking command.
|
||||
#
|
||||
--disable_service_connection
|
||||
--disable_warnings
|
||||
drop database if exists mysqltest;
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (i int);
|
||||
create database mysqltest;
|
||||
lock tables t1 read;
|
||||
@@ -131,9 +120,6 @@ connection default;
|
||||
# Bug#25858 Some DROP TABLE under LOCK TABLES can cause deadlocks
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
lock table t1 read;
|
||||
@@ -160,7 +146,7 @@ connection default;
|
||||
unlock tables;
|
||||
drop table t1,t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
--echo # End of 5.0 tests
|
||||
|
||||
#
|
||||
# Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
|
||||
@@ -198,14 +184,9 @@ use test;
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo # --
|
||||
--echo # -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not
|
||||
--echo # -- exist.
|
||||
--echo # --
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysql_test;
|
||||
--enable_warnings
|
||||
--echo #
|
||||
--echo # Bug#29958: Weird message on DROP DATABASE if mysql.proc does not exist
|
||||
--echo #
|
||||
|
||||
CREATE DATABASE mysql_test;
|
||||
|
||||
@@ -235,62 +216,41 @@ DROP DATABASE mysql_test;
|
||||
--remove_file $copy_of_proc_MAD
|
||||
--remove_file $copy_of_proc_MAI
|
||||
|
||||
--echo
|
||||
--echo # --
|
||||
--echo # -- End of Bug#29958.
|
||||
--echo # --
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
#
|
||||
# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks
|
||||
--echo #
|
||||
create database mysqltestbug26703;
|
||||
use mysqltestbug26703;
|
||||
create table `#mysql50#abc``def` ( id int );
|
||||
--error ER_WRONG_TABLE_NAME
|
||||
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
|
||||
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
|
||||
create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234` (a int);
|
||||
--error ER_WRONG_TABLE_NAME
|
||||
create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345` (a int);
|
||||
create table t1 (id int);
|
||||
--copy_file $MYSQLD_DATADIR/mysqltestbug26703/t1.frm $MYSQLD_DATADIR/mysqltestbug26703/a-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234.frm
|
||||
--copy_file $MYSQLD_DATADIR/mysqltestbug26703/t1.MYD $MYSQLD_DATADIR/mysqltestbug26703/a-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234.MYD
|
||||
--copy_file $MYSQLD_DATADIR/mysqltestbug26703/t1.MYI $MYSQLD_DATADIR/mysqltestbug26703/a-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234.MYI
|
||||
--move_file $MYSQLD_DATADIR/mysqltestbug26703/t1.frm $MYSQLD_DATADIR/mysqltestbug26703/abc`def.frm
|
||||
--move_file $MYSQLD_DATADIR/mysqltestbug26703/t1.MYD $MYSQLD_DATADIR/mysqltestbug26703/abc`def.MYD
|
||||
--move_file $MYSQLD_DATADIR/mysqltestbug26703/t1.MYI $MYSQLD_DATADIR/mysqltestbug26703/abc`def.MYI
|
||||
show tables;
|
||||
show create table `#mysql50#abc``def`;
|
||||
use test;
|
||||
drop database mysqltestbug26703;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
--echo # End of 5.1 tests
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo # --
|
||||
--echo # -- Bug#37431 (DROP TABLE does not report errors correctly).
|
||||
--echo # --
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
--echo #
|
||||
--echo # Bug#37431 (DROP TABLE does not report errors correctly).
|
||||
--echo #
|
||||
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
DROP TABLE t1;
|
||||
|
||||
SHOW WARNINGS;
|
||||
|
||||
--echo
|
||||
--echo # --
|
||||
--echo # -- End of Bug#37431.
|
||||
--echo # --
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
LOCK TABLE t1 WRITE;
|
||||
--error ER_NONUNIQ_TABLE
|
||||
@@ -334,8 +294,6 @@ INSERT INTO table1 VALUES (1);
|
||||
|
||||
DROP TABLE table1,table2;
|
||||
|
||||
--echo # End BUG#34750
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-11105 Table named 'db' has weird side effect.
|
||||
--echo #
|
||||
|
||||
@@ -57,7 +57,6 @@ create temporary table t1_temp(i int) engine=myisam;
|
||||
create temporary table t2_temp(j int) engine=myisam;
|
||||
create temporary table t3_temp_trans(i int) engine=innodb;
|
||||
create database mysqltest1;
|
||||
create database `#mysql50#mysqltest-2`;
|
||||
create procedure p1() begin end;
|
||||
create function f1() returns int return 0;
|
||||
create view v1 as select 1 as i;
|
||||
|
||||
@@ -74,7 +74,8 @@ create temporary table t1_temp(i int) engine=myisam;
|
||||
create temporary table t2_temp(j int) engine=myisam;
|
||||
create temporary table t3_temp_trans(i int) engine=innodb;
|
||||
create database mysqltest1;
|
||||
create database `#mysql50#mysqltest-2`;
|
||||
--let $datadir=`select @@datadir`
|
||||
--mkdir $datadir/mysqltest-2
|
||||
create procedure p1() begin end;
|
||||
create function f1() returns int return 0;
|
||||
create view v1 as select 1 as i;
|
||||
@@ -110,7 +111,7 @@ connection default;
|
||||
|
||||
let $con_aux1=con1;
|
||||
let $con_aux2=con2;
|
||||
let $cleanup_stmt2= ;
|
||||
let $mkdir_db= ;
|
||||
let $skip_3rd_check= ;
|
||||
|
||||
--echo #
|
||||
@@ -144,9 +145,9 @@ let $cleanup_stmt1= alter database mysqltest1 default character set latin1;
|
||||
--echo #
|
||||
let $statement= alter database `#mysql50#mysqltest-2` upgrade data directory name;
|
||||
let $cleanup_stmt1= drop database `mysqltest-2`;
|
||||
let $cleanup_stmt2= create database `#mysql50#mysqltest-2`;
|
||||
let $mkdir_db= $datadir/mysqltest-2;
|
||||
--source include/check_ftwrl_incompatible.inc
|
||||
let $cleanup_stmt2= ;
|
||||
let $mkdir_db= ;
|
||||
|
||||
--echo #
|
||||
--echo # 1.4) ALTER PROCEDURE should be incompatible with FTWRL.
|
||||
|
||||
@@ -59,7 +59,7 @@ KILL CONNECTION @id;
|
||||
connection con1;
|
||||
--echo # Try to reap FLUSH TABLES WITH READ LOCK,
|
||||
--echo # it fail due to killed statement and connection.
|
||||
--error 1317,2013
|
||||
--error 1317,2013,2026
|
||||
reap;
|
||||
|
||||
connection con2;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (
|
||||
a int not null references t2,
|
||||
b int not null constraint t2_c references t2 (c),
|
||||
@@ -13,6 +12,10 @@ foreign key (a,b) references t3 (c,d) on update set null);
|
||||
create index a on t1 (a);
|
||||
create unique index b on t1 (a,b);
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
#
|
||||
# Bug#44987 DELETE IGNORE and FK constraint
|
||||
#
|
||||
create table t1 (id int primary key) engine = innodb;
|
||||
create table t2 (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES t1(id)) engine=innodb;
|
||||
insert into t1 values (1), (2), (3), (4), (5), (6);
|
||||
@@ -40,7 +43,9 @@ id
|
||||
5
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
drop table if exists t_34455;
|
||||
#
|
||||
# Bug#34455 (Ambiguous foreign keys syntax is accepted)
|
||||
#
|
||||
create table t_34455 (
|
||||
a int not null,
|
||||
foreign key (a) references t3 (a) match full match partial);
|
||||
@@ -109,6 +114,20 @@ ERROR 42000: Duplicate key name 'sid'
|
||||
DROP TABLE tfk;
|
||||
DROP TABLE tpk;
|
||||
#
|
||||
# MDEV-39818 backtick in FK names breaks SHOW CREATE TABLE
|
||||
#
|
||||
CREATE TABLE p (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
CREATE TABLE t1 (a INT, CONSTRAINT `foo `` bar` FOREIGN KEY (a) REFERENCES p(a)) ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
KEY `foo `` bar` (`a`),
|
||||
CONSTRAINT `foo `` bar` FOREIGN KEY (`a`) REFERENCES `p` (`a`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
DROP TABLE t1, p;
|
||||
# End of 10.6 tests
|
||||
#
|
||||
# MDEV-33223 Assertion `dst_size > 4' failed in size_t Identifier_chain2::make_sep_name_opt_casedn(char*, size_t, int, bool) const
|
||||
#
|
||||
CREATE DATABASE x;
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (
|
||||
a int not null references t2,
|
||||
b int not null constraint t2_c references t2 (c),
|
||||
@@ -24,19 +20,18 @@ create index a on t1 (a);
|
||||
create unique index b on t1 (a,b);
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
--echo # End of 4.1 tests
|
||||
|
||||
#
|
||||
# Test DELETE IGNORE
|
||||
# Bug#44987 DELETE IGNORE and FK constraint
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug#44987 DELETE IGNORE and FK constraint
|
||||
--echo #
|
||||
|
||||
create table t1 (id int primary key) engine = innodb;
|
||||
create table t2 (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES t1(id)) engine=innodb;
|
||||
insert into t1 values (1), (2), (3), (4), (5), (6);
|
||||
insert into t2 values (3), (5);
|
||||
|
||||
--error 1451
|
||||
--error ER_ROW_IS_REFERENCED_2
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
|
||||
@@ -46,13 +41,9 @@ select * from t1;
|
||||
drop table t2;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#34455 (Ambiguous foreign keys syntax is accepted)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t_34455;
|
||||
--enable_warnings
|
||||
--echo #
|
||||
--echo # Bug#34455 (Ambiguous foreign keys syntax is accepted)
|
||||
--echo #
|
||||
|
||||
# 2 match clauses, illegal
|
||||
--error ER_PARSE_ERROR
|
||||
@@ -141,6 +132,15 @@ DROP TABLE tfk;
|
||||
|
||||
DROP TABLE tpk;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-39818 backtick in FK names breaks SHOW CREATE TABLE
|
||||
--echo #
|
||||
CREATE TABLE p (a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
CREATE TABLE t1 (a INT, CONSTRAINT `foo `` bar` FOREIGN KEY (a) REFERENCES p(a)) ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1, p;
|
||||
|
||||
--echo # End of 10.6 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-33223 Assertion `dst_size > 4' failed in size_t Identifier_chain2::make_sep_name_opt_casedn(char*, size_t, int, bool) const
|
||||
|
||||
@@ -4,6 +4,8 @@ json_valid('[1, 2]')
|
||||
select json_valid('"string"}');
|
||||
json_valid('"string"}')
|
||||
0
|
||||
Warnings:
|
||||
Note 4038 Syntax error in JSON text in argument 1 to function 'json_valid' at position 9
|
||||
select json_valid('{"key1":1, "key2":[2,3]}');
|
||||
json_valid('{"key1":1, "key2":[2,3]}')
|
||||
1
|
||||
@@ -13,9 +15,13 @@ json_valid('[false, true, null]')
|
||||
select json_valid(repeat('[', 1000));
|
||||
json_valid(repeat('[', 1000))
|
||||
0
|
||||
Warnings:
|
||||
Note 4037 Unexpected end of JSON text in argument 1 to function 'json_valid'
|
||||
select json_valid(repeat('{"a":', 1000));
|
||||
json_valid(repeat('{"a":', 1000))
|
||||
0
|
||||
Warnings:
|
||||
Note 4037 Unexpected end of JSON text in argument 1 to function 'json_valid'
|
||||
select json_value('{"key1":123}', '$.key2');
|
||||
json_value('{"key1":123}', '$.key2')
|
||||
NULL
|
||||
@@ -749,6 +755,8 @@ Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_
|
||||
select JSON_VALID(0x36f0c8dccd83c5eac156da);
|
||||
JSON_VALID(0x36f0c8dccd83c5eac156da)
|
||||
0
|
||||
Warnings:
|
||||
Note 4035 Broken JSON string in argument 1 to function 'json_valid' at position 1
|
||||
create table t1(a double not null);
|
||||
insert into t1 values (2),(1);
|
||||
select 1 from t1 where json_extract(a,'$','$[81]');
|
||||
@@ -848,6 +856,8 @@ SET sql_mode=default;
|
||||
select JSON_VALID( '{"a":1]' );
|
||||
JSON_VALID( '{"a":1]' )
|
||||
0
|
||||
Warnings:
|
||||
Note 4038 Syntax error in JSON text in argument 1 to function 'json_valid' at position 7
|
||||
#
|
||||
# MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
|
||||
#
|
||||
@@ -1499,12 +1509,18 @@ JSON_VALUE(' {"number": 0E-4}', '$.number')
|
||||
select JSON_VALID(' {"number": 00E-4}');
|
||||
JSON_VALID(' {"number": 00E-4}')
|
||||
0
|
||||
Warnings:
|
||||
Note 4038 Syntax error in JSON text in argument 1 to function 'json_valid' at position 14
|
||||
select JSON_VALID(' {"number": 01E-4}');
|
||||
JSON_VALID(' {"number": 01E-4}')
|
||||
0
|
||||
Warnings:
|
||||
Note 4038 Syntax error in JSON text in argument 1 to function 'json_valid' at position 14
|
||||
select JSON_VALID(' {"number": 0E-4.0}');
|
||||
JSON_VALID(' {"number": 0E-4.0}')
|
||||
0
|
||||
Warnings:
|
||||
Note 4038 Syntax error in JSON text in argument 1 to function 'json_valid' at position 17
|
||||
# End of 10.4 tests
|
||||
#
|
||||
# MDEV-16620 JSON_ARRAYAGG
|
||||
@@ -1817,6 +1833,18 @@ je
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_exists' at position 6
|
||||
#
|
||||
# MDEV-39817 JSON_ARRAYAGG() returns garbage because of off-by-one error
|
||||
#
|
||||
set session group_concat_max_len = 9;
|
||||
create temporary table t (c varchar(20) character set latin1);
|
||||
insert into t values ('ab'), ('cd'), ('ef');
|
||||
select json_arrayagg(c order by c) from t;
|
||||
json_arrayagg(c order by c)
|
||||
["ab","cd"]
|
||||
Warnings:
|
||||
Warning 1260 Row 3 was cut by json_arrayagg()
|
||||
drop temporary table t;
|
||||
# End of 10.6 tests
|
||||
SELECT json_extract(t.j, '$')
|
||||
FROM (SELECT json_extract('["a",1]', '$') AS j) AS t;
|
||||
@@ -2891,6 +2919,8 @@ Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' a
|
||||
SELECT JSON_VALID('{ "A": [0,] }');
|
||||
JSON_VALID('{ "A": [0,] }')
|
||||
0
|
||||
Warnings:
|
||||
Note 4038 Syntax error in JSON text in argument 1 to function 'json_valid' at position 11
|
||||
#
|
||||
# MDEV-38264 Assertion in json_find_path() fails after computing
|
||||
# array size of invalid json structure
|
||||
@@ -2921,6 +2951,8 @@ Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' a
|
||||
SELECT JSON_VALID('{ "A": [0,] }');
|
||||
JSON_VALID('{ "A": [0,] }')
|
||||
0
|
||||
Warnings:
|
||||
Note 4038 Syntax error in JSON text in argument 1 to function 'json_valid' at position 11
|
||||
#
|
||||
# MDEV-35548 UBSAN: runtime error: index -1 out of bounds for type 'json_path_step_t[32]'
|
||||
# (aka 'struct st_json_path_step_t[32]')
|
||||
@@ -2939,6 +2971,15 @@ JSON_EXTRACT('0E+0','$')
|
||||
SELECT JSON_ARRAY_INSERT (0,NULL,1) as j;
|
||||
j
|
||||
NULL
|
||||
#
|
||||
# MDEV-40414 Server crash in Charset::charset upon JSON operations
|
||||
#
|
||||
SELECT JSON_EQUALS('[]', JSON_ARRAY_INSERT(NULL,'$[0]',1)) AS x;
|
||||
x
|
||||
NULL
|
||||
SELECT JSON_OVERLAPS(JSON_ARRAY_INSERT(NULL,'$[0]',1), '[]') AS x;
|
||||
x
|
||||
NULL
|
||||
# End of 10.11 Test
|
||||
#
|
||||
# MDEV-32007: JSON_VALUE and JSON_EXTRACT doesn't handle dash (-)
|
||||
@@ -5425,9 +5466,13 @@ NULL
|
||||
select json_array_intersect(@arr1, @obj1);
|
||||
json_array_intersect(@arr1, @obj1)
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4038 Syntax error in JSON text in argument 2 to function 'json_array_intersect' at position 1
|
||||
select json_array_intersect(@arr1, @num1);
|
||||
json_array_intersect(@arr1, @num1)
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4038 Syntax error in JSON text in argument 2 to function 'json_array_intersect' at position 1
|
||||
select json_array_intersect(@num1, @bool1);
|
||||
json_array_intersect(@num1, @bool1)
|
||||
NULL
|
||||
@@ -5580,6 +5625,51 @@ full overlap jai
|
||||
DROP TABLE t1;
|
||||
# End of 11.4 Test
|
||||
#
|
||||
# MDEV-38033: JSON_SCHEMA_VALID function returning wrong result
|
||||
#
|
||||
SET @schema= '
|
||||
{
|
||||
"type": "object",
|
||||
"properties":
|
||||
{
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"arr_fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"field1": {
|
||||
"type": "string"
|
||||
},
|
||||
"field2": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": ["field1"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}';
|
||||
SET @value= '
|
||||
{
|
||||
"id": "zero",
|
||||
"arr_fields": [
|
||||
{
|
||||
"field1": "A",
|
||||
"field2": 123
|
||||
},
|
||||
{
|
||||
"field1": "B"
|
||||
}
|
||||
]
|
||||
}';
|
||||
SELECT JSON_SCHEMA_VALID(@schema, @value);
|
||||
JSON_SCHEMA_VALID(@schema, @value)
|
||||
1
|
||||
#
|
||||
# MDEV-38702 Behaviour of IF() with boolean JSON_EXTRACT as expression is wrong
|
||||
#
|
||||
SELECT JSON_TYPE(JSON_EXTRACT(x.val, '$.booleanValue')) AS json_type,
|
||||
|
||||
@@ -26,10 +26,7 @@ select json_array(1);
|
||||
--disable_view_protocol
|
||||
select json_array(1, "text", false, null);
|
||||
|
||||
#enable after fix MDEV-31554
|
||||
--disable_cursor_protocol
|
||||
select json_array_append('["a", "b"]', '$', FALSE);
|
||||
--enable_cursor_protocol
|
||||
--enable_view_protocol
|
||||
select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2);
|
||||
select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2);
|
||||
@@ -1244,6 +1241,15 @@ SELECT JSON_EXISTS(CONCAT('[', REPEAT('[', 4000), 'Y', REPEAT(']', 4000), ', 1]'
|
||||
SELECT JSON_EXISTS('[[[[[Y[[[[n[[[[[[[[[[[n[[[Vn]]]]]]]]]]]]]],]]:]]]](', '$[0 to rrrrrRR-1]') as je;
|
||||
SELECT JSON_EXISTS('[[[[[Y[[[[[[[[[[[[[[[[[[Vn]]]]]]]]]]]]]],]]:]]]](', '$[0 to rrrrRR-1]') as je;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-39817 JSON_ARRAYAGG() returns garbage because of off-by-one error
|
||||
--echo #
|
||||
set session group_concat_max_len = 9;
|
||||
create temporary table t (c varchar(20) character set latin1);
|
||||
insert into t values ('ab'), ('cd'), ('ef');
|
||||
select json_arrayagg(c order by c) from t;
|
||||
drop temporary table t;
|
||||
|
||||
--echo # End of 10.6 tests
|
||||
|
||||
SELECT json_extract(t.j, '$')
|
||||
@@ -2101,6 +2107,13 @@ SELECT JSON_EXTRACT('0E+0','$');
|
||||
|
||||
SELECT JSON_ARRAY_INSERT (0,NULL,1) as j;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-40414 Server crash in Charset::charset upon JSON operations
|
||||
--echo #
|
||||
|
||||
SELECT JSON_EQUALS('[]', JSON_ARRAY_INSERT(NULL,'$[0]',1)) AS x;
|
||||
SELECT JSON_OVERLAPS(JSON_ARRAY_INSERT(NULL,'$[0]',1), '[]') AS x;
|
||||
|
||||
--echo # End of 10.11 Test
|
||||
|
||||
--echo #
|
||||
@@ -4338,6 +4351,53 @@ DROP TABLE t1;
|
||||
|
||||
--echo # End of 11.4 Test
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-38033: JSON_SCHEMA_VALID function returning wrong result
|
||||
--echo #
|
||||
|
||||
SET @schema= '
|
||||
{
|
||||
"type": "object",
|
||||
"properties":
|
||||
{
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"arr_fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"field1": {
|
||||
"type": "string"
|
||||
},
|
||||
"field2": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": ["field1"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}';
|
||||
|
||||
SET @value= '
|
||||
{
|
||||
"id": "zero",
|
||||
"arr_fields": [
|
||||
{
|
||||
"field1": "A",
|
||||
"field2": 123
|
||||
},
|
||||
{
|
||||
"field1": "B"
|
||||
}
|
||||
]
|
||||
}';
|
||||
|
||||
SELECT JSON_SCHEMA_VALID(@schema, @value);
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-38702 Behaviour of IF() with boolean JSON_EXTRACT as expression is wrong
|
||||
--echo #
|
||||
|
||||
@@ -16,6 +16,8 @@ select json_array_append(@arr, '$[0]', 1);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_array_insert(@arr, '$[0]', 1);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_array_intersect(@arr, @arr);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_insert(@obj, '$.meta', 1);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_compact(@arr);
|
||||
@@ -24,6 +26,10 @@ select json_contains(@obj, '"d"', '$.c');
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_contains_path(@obj, 'one', '$.c');
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_depth(@obj);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_equals(@obj, @arr);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_exists(@obj, '$.c');
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_extract(@obj, '$.c');
|
||||
@@ -34,20 +40,34 @@ select json_keys(@obj, '$.c');
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_loose(@arr);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_length(@arr);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_merge(@obj, @arr);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_merge_patch(@obj, @obj);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_merge_preserve(@obj, @arr);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_normalize(@obj);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_overlaps(@obj, @arr);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_remove(@obj,'$.foo');
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_replace(@obj,'$.foo',1);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_schema_valid(@obj, '{"type":"object"}');
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_set(@arr,'$[1000]',1);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select json_valid(@arr);
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select ST_AsTEXT(ST_GeomFromGeoJSON(JSON_OBJECT("type", "Point", "coordinates", @arr),2)) as exp;
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select @obj IS JSON;
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
select @arr IS JSON;
|
||||
ERROR 70100: Query was interrupted: execution time limit 0.0001 sec exceeded
|
||||
SET debug_dbug= @old_debug;
|
||||
disconnect u;
|
||||
connection default;
|
||||
|
||||
@@ -21,22 +21,32 @@ SET @old_debug= @@debug_dbug;
|
||||
SET debug_dbug='+d,json_pause_execution';
|
||||
select json_array_append(@arr, '$[0]', 1);
|
||||
select json_array_insert(@arr, '$[0]', 1);
|
||||
select json_array_intersect(@arr, @arr);
|
||||
select json_insert(@obj, '$.meta', 1);
|
||||
select json_compact(@arr);
|
||||
select json_contains(@obj, '"d"', '$.c');
|
||||
select json_contains_path(@obj, 'one', '$.c');
|
||||
select json_depth(@obj);
|
||||
select json_equals(@obj, @arr);
|
||||
select json_exists(@obj, '$.c');
|
||||
select json_extract(@obj, '$.c');
|
||||
select json_detailed(@arr);
|
||||
select json_keys(@obj, '$.c');
|
||||
select json_loose(@arr);
|
||||
select json_length(@arr);
|
||||
select json_merge(@obj, @arr);
|
||||
select json_merge_patch(@obj, @obj);
|
||||
select json_merge_preserve(@obj, @arr);
|
||||
select json_normalize(@obj);
|
||||
select json_overlaps(@obj, @arr);
|
||||
select json_remove(@obj,'$.foo');
|
||||
select json_replace(@obj,'$.foo',1);
|
||||
select json_schema_valid(@obj, '{"type":"object"}');
|
||||
select json_set(@arr,'$[1000]',1);
|
||||
select json_valid(@arr);
|
||||
select ST_AsTEXT(ST_GeomFromGeoJSON(JSON_OBJECT("type", "Point", "coordinates", @arr),2)) as exp;
|
||||
select @obj IS JSON;
|
||||
select @arr IS JSON;
|
||||
enable_abort_on_error;
|
||||
SET debug_dbug= @old_debug;
|
||||
disconnect u;
|
||||
|
||||
129
mysql-test/main/func_json_unicode_escape.result
Normal file
129
mysql-test/main/func_json_unicode_escape.result
Normal file
@@ -0,0 +1,129 @@
|
||||
#
|
||||
# MDEV-39995: JSON_CONTAINS and JSON_EQUALS do not compare strings
|
||||
# based on semantic
|
||||
#
|
||||
#
|
||||
# JSON string values with Unicode escape sequences should be treated
|
||||
# as semantically equal to their literal equivalents.
|
||||
# \u0041 is the Unicode escape for 'A'.
|
||||
#
|
||||
# JSON_CONTAINS: should return 1 for semantically equal strings
|
||||
SELECT JSON_CONTAINS('"A"', '"\\u0041"');
|
||||
JSON_CONTAINS('"A"', '"\\u0041"')
|
||||
1
|
||||
SELECT JSON_CONTAINS('"\\u0041"', '"A"');
|
||||
JSON_CONTAINS('"\\u0041"', '"A"')
|
||||
1
|
||||
# JSON_OVERLAPS: should return 1 for semantically equal strings
|
||||
SELECT JSON_OVERLAPS('"A"', '"\\u0041"');
|
||||
JSON_OVERLAPS('"A"', '"\\u0041"')
|
||||
1
|
||||
# JSON_EQUALS: should return 1 for semantically equal strings
|
||||
SELECT JSON_EQUALS('"A"', '"\\u0041"');
|
||||
JSON_EQUALS('"A"', '"\\u0041"')
|
||||
1
|
||||
# JSON_UNQUOTE correctly resolves the escape (proving they are the same)
|
||||
SELECT JSON_UNQUOTE('"A"') = JSON_UNQUOTE('"\\u0041"');
|
||||
JSON_UNQUOTE('"A"') = JSON_UNQUOTE('"\\u0041"')
|
||||
1
|
||||
#
|
||||
# Additional test from MDEV-39995 comment:
|
||||
# Using hex literal that represents the bytes of '"\u0041"'
|
||||
#
|
||||
SELECT JSON_UNQUOTE('"A"');
|
||||
JSON_UNQUOTE('"A"')
|
||||
A
|
||||
SELECT JSON_UNQUOTE(CAST(0x225C753030343122 AS CHAR));
|
||||
JSON_UNQUOTE(CAST(0x225C753030343122 AS CHAR))
|
||||
A
|
||||
SELECT JSON_CONTAINS('"A"', CAST(0x225C753030343122 AS CHAR));
|
||||
JSON_CONTAINS('"A"', CAST(0x225C753030343122 AS CHAR))
|
||||
1
|
||||
SELECT JSON_CONTAINS(JSON_QUOTE(JSON_UNQUOTE('"A"')),
|
||||
JSON_QUOTE(JSON_UNQUOTE(CAST(0x225C753030343122 AS CHAR))));
|
||||
JSON_CONTAINS(JSON_QUOTE(JSON_UNQUOTE('"A"')),
|
||||
JSON_QUOTE(JSON_UNQUOTE(CAST(0x225C753030343122 AS CHAR))))
|
||||
1
|
||||
#
|
||||
# More Unicode escape equivalences
|
||||
#
|
||||
# \u0048\u0065\u006C\u006C\u006F = "Hello"
|
||||
SELECT JSON_CONTAINS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"');
|
||||
JSON_CONTAINS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"')
|
||||
1
|
||||
SELECT JSON_EQUALS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"');
|
||||
JSON_EQUALS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"')
|
||||
1
|
||||
SELECT JSON_OVERLAPS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"');
|
||||
JSON_OVERLAPS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"')
|
||||
1
|
||||
# Mixed literal and escape in the same string: "H\u0065llo" = "Hello"
|
||||
SELECT JSON_EQUALS('"Hello"', '"H\\u0065llo"');
|
||||
JSON_EQUALS('"Hello"', '"H\\u0065llo"')
|
||||
1
|
||||
#
|
||||
# Test within arrays and objects
|
||||
#
|
||||
SELECT JSON_CONTAINS('["A", "B"]', '["\\u0041"]');
|
||||
JSON_CONTAINS('["A", "B"]', '["\\u0041"]')
|
||||
1
|
||||
SELECT JSON_CONTAINS('{"key": "A"}', '{"key": "\\u0041"}');
|
||||
JSON_CONTAINS('{"key": "A"}', '{"key": "\\u0041"}')
|
||||
1
|
||||
SELECT JSON_EQUALS('["A", "B"]', '["\\u0041", "\\u0042"]');
|
||||
JSON_EQUALS('["A", "B"]', '["\\u0041", "\\u0042"]')
|
||||
1
|
||||
SELECT JSON_EQUALS('{"key": "A"}', '{"key": "\\u0041"}');
|
||||
JSON_EQUALS('{"key": "A"}', '{"key": "\\u0041"}')
|
||||
1
|
||||
#
|
||||
# Surrogate pairs: characters above U+FFFF encoded as two \uXXXX escapes.
|
||||
# U+1F600 (😀) = \uD83D\uDE00
|
||||
# U+1F60A (😊) = \uD83D\uDE0A
|
||||
#
|
||||
SET NAMES utf8mb4;
|
||||
SELECT JSON_EQUALS('"😀"', '"\\uD83D\\uDE00"');
|
||||
JSON_EQUALS('"?"', '"\\uD83D\\uDE00"')
|
||||
1
|
||||
SELECT JSON_CONTAINS('"😀"', '"\\uD83D\\uDE00"');
|
||||
JSON_CONTAINS('"?"', '"\\uD83D\\uDE00"')
|
||||
1
|
||||
SELECT JSON_OVERLAPS('"😀"', '"\\uD83D\\uDE00"');
|
||||
JSON_OVERLAPS('"?"', '"\\uD83D\\uDE00"')
|
||||
1
|
||||
SELECT JSON_EQUALS('"😊"', '"\\uD83D\\uDE0A"');
|
||||
JSON_EQUALS('"?"', '"\\uD83D\\uDE0A"')
|
||||
1
|
||||
SELECT JSON_CONTAINS('["😀", "hello"]', '["\\uD83D\\uDE00"]');
|
||||
JSON_CONTAINS('["?", "hello"]', '["\\uD83D\\uDE00"]')
|
||||
1
|
||||
SELECT JSON_EQUALS('{"emoji": "😀"}', '{"emoji": "\\uD83D\\uDE00"}');
|
||||
JSON_EQUALS('{"emoji": "?"}', '{"emoji": "\\uD83D\\uDE00"}')
|
||||
1
|
||||
#
|
||||
# Escaped object keys: \u006B\u0065\u0079 = "key"
|
||||
#
|
||||
SELECT JSON_EQUALS('{"key":"A"}', '{"\\u006B\\u0065\\u0079":"A"}');
|
||||
JSON_EQUALS('{"key":"A"}', '{"\\u006B\\u0065\\u0079":"A"}')
|
||||
1
|
||||
SELECT JSON_CONTAINS('{"key":"A"}', '{"\\u006B\\u0065\\u0079":"A"}');
|
||||
JSON_CONTAINS('{"key":"A"}', '{"\\u006B\\u0065\\u0079":"A"}')
|
||||
1
|
||||
#
|
||||
# BMP non-ASCII: é = U+00E9, literal UTF-8 vs escape
|
||||
#
|
||||
SELECT JSON_EQUALS('"é"', '"\\u00E9"');
|
||||
JSON_EQUALS('"é"', '"\\u00E9"')
|
||||
1
|
||||
SELECT JSON_CONTAINS('"é"', '"\\u00E9"');
|
||||
JSON_CONTAINS('"é"', '"\\u00E9"')
|
||||
1
|
||||
SELECT JSON_OVERLAPS('["é"]', '["\\u00E9"]');
|
||||
JSON_OVERLAPS('["é"]', '["\\u00E9"]')
|
||||
1
|
||||
#
|
||||
# CJK: 中 = U+4E2D
|
||||
#
|
||||
SELECT JSON_EQUALS('"中"', '"\\u4E2D"');
|
||||
JSON_EQUALS('"中"', '"\\u4E2D"')
|
||||
1
|
||||
89
mysql-test/main/func_json_unicode_escape.test
Normal file
89
mysql-test/main/func_json_unicode_escape.test
Normal file
@@ -0,0 +1,89 @@
|
||||
--echo #
|
||||
--echo # MDEV-39995: JSON_CONTAINS and JSON_EQUALS do not compare strings
|
||||
--echo # based on semantic
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # JSON string values with Unicode escape sequences should be treated
|
||||
--echo # as semantically equal to their literal equivalents.
|
||||
--echo # \u0041 is the Unicode escape for 'A'.
|
||||
--echo #
|
||||
|
||||
--echo # JSON_CONTAINS: should return 1 for semantically equal strings
|
||||
SELECT JSON_CONTAINS('"A"', '"\\u0041"');
|
||||
SELECT JSON_CONTAINS('"\\u0041"', '"A"');
|
||||
|
||||
--echo # JSON_OVERLAPS: should return 1 for semantically equal strings
|
||||
SELECT JSON_OVERLAPS('"A"', '"\\u0041"');
|
||||
|
||||
--echo # JSON_EQUALS: should return 1 for semantically equal strings
|
||||
SELECT JSON_EQUALS('"A"', '"\\u0041"');
|
||||
|
||||
--echo # JSON_UNQUOTE correctly resolves the escape (proving they are the same)
|
||||
SELECT JSON_UNQUOTE('"A"') = JSON_UNQUOTE('"\\u0041"');
|
||||
|
||||
--echo #
|
||||
--echo # Additional test from MDEV-39995 comment:
|
||||
--echo # Using hex literal that represents the bytes of '"\u0041"'
|
||||
--echo #
|
||||
SELECT JSON_UNQUOTE('"A"');
|
||||
SELECT JSON_UNQUOTE(CAST(0x225C753030343122 AS CHAR));
|
||||
SELECT JSON_CONTAINS('"A"', CAST(0x225C753030343122 AS CHAR));
|
||||
--disable_view_protocol
|
||||
SELECT JSON_CONTAINS(JSON_QUOTE(JSON_UNQUOTE('"A"')),
|
||||
JSON_QUOTE(JSON_UNQUOTE(CAST(0x225C753030343122 AS CHAR))));
|
||||
--enable_view_protocol
|
||||
|
||||
--echo #
|
||||
--echo # More Unicode escape equivalences
|
||||
--echo #
|
||||
--echo # \u0048\u0065\u006C\u006C\u006F = "Hello"
|
||||
--disable_view_protocol
|
||||
SELECT JSON_CONTAINS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"');
|
||||
SELECT JSON_EQUALS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"');
|
||||
SELECT JSON_OVERLAPS('"Hello"', '"\\u0048\\u0065\\u006C\\u006C\\u006F"');
|
||||
--enable_view_protocol
|
||||
|
||||
--echo # Mixed literal and escape in the same string: "H\u0065llo" = "Hello"
|
||||
SELECT JSON_EQUALS('"Hello"', '"H\\u0065llo"');
|
||||
|
||||
--echo #
|
||||
--echo # Test within arrays and objects
|
||||
--echo #
|
||||
SELECT JSON_CONTAINS('["A", "B"]', '["\\u0041"]');
|
||||
SELECT JSON_CONTAINS('{"key": "A"}', '{"key": "\\u0041"}');
|
||||
SELECT JSON_EQUALS('["A", "B"]', '["\\u0041", "\\u0042"]');
|
||||
SELECT JSON_EQUALS('{"key": "A"}', '{"key": "\\u0041"}');
|
||||
|
||||
--echo #
|
||||
--echo # Surrogate pairs: characters above U+FFFF encoded as two \uXXXX escapes.
|
||||
--echo # U+1F600 (😀) = \uD83D\uDE00
|
||||
--echo # U+1F60A (😊) = \uD83D\uDE0A
|
||||
--echo #
|
||||
--disable_service_connection
|
||||
SET NAMES utf8mb4;
|
||||
SELECT JSON_EQUALS('"😀"', '"\\uD83D\\uDE00"');
|
||||
SELECT JSON_CONTAINS('"😀"', '"\\uD83D\\uDE00"');
|
||||
SELECT JSON_OVERLAPS('"😀"', '"\\uD83D\\uDE00"');
|
||||
SELECT JSON_EQUALS('"😊"', '"\\uD83D\\uDE0A"');
|
||||
SELECT JSON_CONTAINS('["😀", "hello"]', '["\\uD83D\\uDE00"]');
|
||||
SELECT JSON_EQUALS('{"emoji": "😀"}', '{"emoji": "\\uD83D\\uDE00"}');
|
||||
|
||||
--echo #
|
||||
--echo # Escaped object keys: \u006B\u0065\u0079 = "key"
|
||||
--echo #
|
||||
SELECT JSON_EQUALS('{"key":"A"}', '{"\\u006B\\u0065\\u0079":"A"}');
|
||||
SELECT JSON_CONTAINS('{"key":"A"}', '{"\\u006B\\u0065\\u0079":"A"}');
|
||||
|
||||
--echo #
|
||||
--echo # BMP non-ASCII: é = U+00E9, literal UTF-8 vs escape
|
||||
--echo #
|
||||
SELECT JSON_EQUALS('"é"', '"\\u00E9"');
|
||||
SELECT JSON_CONTAINS('"é"', '"\\u00E9"');
|
||||
SELECT JSON_OVERLAPS('["é"]', '["\\u00E9"]');
|
||||
|
||||
--echo #
|
||||
--echo # CJK: 中 = U+4E2D
|
||||
--echo #
|
||||
SELECT JSON_EQUALS('"中"', '"\\u4E2D"');
|
||||
--enable_service_connection
|
||||
@@ -3982,3 +3982,121 @@ SIGN(-' 0 ')
|
||||
Warnings:
|
||||
Note 1292 Truncated incorrect DOUBLE value: ' 0 '
|
||||
# End of 13 tests
|
||||
#
|
||||
# MDEV-38210: Incorrect query result
|
||||
#
|
||||
CREATE TABLE t1 (c1 LONGTEXT);
|
||||
INSERT INTO t1 VALUES ('03ksy'),('12abc'),('999'),('-7xy'),('abc'),(NULL);
|
||||
SELECT c1, MIN(LOWER(-(CAST(c1 AS BINARY)))) AS m FROM t1 GROUP BY c1;
|
||||
c1 m
|
||||
-7xy 7
|
||||
03ksy -3
|
||||
12abc -12
|
||||
999 -999
|
||||
NULL NULL
|
||||
abc 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '-7xy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '03ksy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '12abc'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
SELECT c1, -(CAST(c1 AS BINARY)) AS v FROM t1 GROUP BY c1;
|
||||
c1 v
|
||||
-7xy 7
|
||||
03ksy -3
|
||||
12abc -12
|
||||
999 -999
|
||||
NULL NULL
|
||||
abc 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '-7xy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '03ksy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '12abc'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 LONGBLOB);
|
||||
INSERT INTO t1 VALUES ('03ksy'),('abc'),(NULL);
|
||||
SELECT c1, MIN(LOWER(-(CAST(c1 AS BINARY)))) AS m FROM t1 GROUP BY c1;
|
||||
c1 m
|
||||
03ksy -3
|
||||
NULL NULL
|
||||
abc 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '03ksy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 VARCHAR(10));
|
||||
INSERT INTO t1 VALUES ('03ksy'),('12abc'),('999'),('-7xy'),('abc'),(NULL);
|
||||
SELECT c1, MIN(LOWER(-(CAST(c1 AS BINARY)))) AS m FROM t1 GROUP BY c1;
|
||||
c1 m
|
||||
-7xy 7
|
||||
03ksy -3
|
||||
12abc -12
|
||||
999 -999
|
||||
NULL NULL
|
||||
abc 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '-7xy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '03ksy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '12abc'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
SELECT -(CAST(c1 AS BINARY)) AS v FROM t1;
|
||||
v
|
||||
-12
|
||||
-3
|
||||
-999
|
||||
0
|
||||
7
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '-7xy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '03ksy'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '12abc'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 DECIMAL(65,0));
|
||||
INSERT INTO t1 VALUES
|
||||
(12345678901234567890123456789012345678901234567890123456789012345),
|
||||
(-9999999999999999999999999999999999999999999999999999999999999999),
|
||||
(0),(NULL);
|
||||
SELECT c1, MIN(-(c1)) AS m FROM t1 GROUP BY c1;
|
||||
c1 m
|
||||
-9999999999999999999999999999999999999999999999999999999999999999 9999999999999999999999999999999999999999999999999999999999999999
|
||||
0 0
|
||||
12345678901234567890123456789012345678901234567890123456789012345 -12345678901234567890123456789012345678901234567890123456789012345
|
||||
NULL NULL
|
||||
SELECT c1, -(c1) AS v FROM t1 GROUP BY c1;
|
||||
c1 v
|
||||
-9999999999999999999999999999999999999999999999999999999999999999 9999999999999999999999999999999999999999999999999999999999999999
|
||||
0 0
|
||||
12345678901234567890123456789012345678901234567890123456789012345 -12345678901234567890123456789012345678901234567890123456789012345
|
||||
NULL NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 BIGINT);
|
||||
INSERT INTO t1 VALUES
|
||||
(123),(-456),(9223372036854775807),(-9223372036854775807),(0),(NULL);
|
||||
SELECT c1, MIN(ABS(c1)) AS m FROM t1 GROUP BY c1;
|
||||
c1 m
|
||||
-456 456
|
||||
-9223372036854775807 9223372036854775807
|
||||
0 0
|
||||
123 123
|
||||
9223372036854775807 9223372036854775807
|
||||
NULL NULL
|
||||
SELECT c1, ABS(c1) AS v FROM t1 GROUP BY c1;
|
||||
c1 v
|
||||
-456 456
|
||||
-9223372036854775807 9223372036854775807
|
||||
0 0
|
||||
123 123
|
||||
9223372036854775807 9223372036854775807
|
||||
NULL NULL
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-38061 Assertion `args[0]->decimal_precision() < 22' in
|
||||
# Item_func_round::fix_arg_hex_hybrid
|
||||
#
|
||||
SELECT ROUND(NAME_CONST('x', 0x0123456789ABCDEF0123456789ABCDEF0123456789AB)) as a;
|
||||
a
|
||||
14839080548208970155
|
||||
# End of 10.11 tests
|
||||
|
||||
@@ -2155,3 +2155,73 @@ SELECT SIGN(-'00');
|
||||
SELECT SIGN(-' 0 ');
|
||||
|
||||
--echo # End of 13 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-38210: Incorrect query result
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (c1 LONGTEXT);
|
||||
INSERT INTO t1 VALUES ('03ksy'),('12abc'),('999'),('-7xy'),('abc'),(NULL);
|
||||
--sorted_result
|
||||
SELECT c1, MIN(LOWER(-(CAST(c1 AS BINARY)))) AS m FROM t1 GROUP BY c1;
|
||||
--sorted_result
|
||||
SELECT c1, -(CAST(c1 AS BINARY)) AS v FROM t1 GROUP BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c1 LONGBLOB);
|
||||
INSERT INTO t1 VALUES ('03ksy'),('abc'),(NULL);
|
||||
--sorted_result
|
||||
SELECT c1, MIN(LOWER(-(CAST(c1 AS BINARY)))) AS m FROM t1 GROUP BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# A bounded string type exercises the length plus one branch because its
|
||||
# argument width is below the double display length. The plain selection
|
||||
# builds no temporary table, so it confirms the negated values independently
|
||||
# of the GROUP BY materialization the earlier sections cover.
|
||||
CREATE TABLE t1 (c1 VARCHAR(10));
|
||||
INSERT INTO t1 VALUES ('03ksy'),('12abc'),('999'),('-7xy'),('abc'),(NULL);
|
||||
--sorted_result
|
||||
SELECT c1, MIN(LOWER(-(CAST(c1 AS BINARY)))) AS m FROM t1 GROUP BY c1;
|
||||
--sorted_result
|
||||
SELECT -(CAST(c1 AS BINARY)) AS v FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Negation of a DECIMAL value takes the decimal branch, which adds one to the
|
||||
# argument width for the sign just as the blob path did. DECIMAL precision is
|
||||
# bounded at 65, so the width stays far below the value where the addition
|
||||
# would wrap. GROUP BY stores the negated column in a temporary table, the
|
||||
# path that dropped the value in the blob case, so a full precision result
|
||||
# confirms the decimal branch is unaffected.
|
||||
CREATE TABLE t1 (c1 DECIMAL(65,0));
|
||||
INSERT INTO t1 VALUES
|
||||
(12345678901234567890123456789012345678901234567890123456789012345),
|
||||
(-9999999999999999999999999999999999999999999999999999999999999999),
|
||||
(0),(NULL);
|
||||
--sorted_result
|
||||
SELECT c1, MIN(-(c1)) AS m FROM t1 GROUP BY c1;
|
||||
--sorted_result
|
||||
SELECT c1, -(c1) AS v FROM t1 GROUP BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# ABS of an integer takes the integer branch, which copies the argument width
|
||||
# unchanged, so no addition can wrap and no clamp against the display length
|
||||
# is needed. GROUP BY materializes the result, so the values across the full
|
||||
# BIGINT range confirm the integer branch is unaffected.
|
||||
CREATE TABLE t1 (c1 BIGINT);
|
||||
INSERT INTO t1 VALUES
|
||||
(123),(-456),(9223372036854775807),(-9223372036854775807),(0),(NULL);
|
||||
--sorted_result
|
||||
SELECT c1, MIN(ABS(c1)) AS m FROM t1 GROUP BY c1;
|
||||
--sorted_result
|
||||
SELECT c1, ABS(c1) AS v FROM t1 GROUP BY c1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-38061 Assertion `args[0]->decimal_precision() < 22' in
|
||||
--echo # Item_func_round::fix_arg_hex_hybrid
|
||||
--echo #
|
||||
|
||||
SELECT ROUND(NAME_CONST('x', 0x0123456789ABCDEF0123456789ABCDEF0123456789AB)) as a;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
@@ -485,3 +485,17 @@ sformat(a,b,c)
|
||||
[10 -> {}]
|
||||
[ 1 <- {:30}]
|
||||
drop table t1;
|
||||
# End of 10.8 tests
|
||||
#
|
||||
# MDEV-31024 Server crash / ASAN use-after-poison in Binary_string::free_buffer / Item_func_sformat::~Item_func_sformat
|
||||
#
|
||||
create table t (a char(8), i int);
|
||||
insert into t values ('foo',1),('bar',2);
|
||||
create view v as select a, sum(i) as s from t group by a;
|
||||
select * from v where a != sformat('{}', 'qux');
|
||||
a s
|
||||
bar 2
|
||||
foo 1
|
||||
drop view v;
|
||||
drop table t;
|
||||
# End of 10.11 tests
|
||||
|
||||
@@ -260,3 +260,18 @@ create table t1 (a text, b int, c text);
|
||||
insert t1 values ('[{} -> {}]', 10, '{}'), ('[{:20} <- {}]', 1, '{:30}');
|
||||
select sformat(a,b,c) from t1;
|
||||
drop table t1;
|
||||
|
||||
echo # End of 10.8 tests;
|
||||
|
||||
echo #;
|
||||
echo # MDEV-31024 Server crash / ASAN use-after-poison in Binary_string::free_buffer / Item_func_sformat::~Item_func_sformat;
|
||||
echo #;
|
||||
|
||||
create table t (a char(8), i int);
|
||||
insert into t values ('foo',1),('bar',2);
|
||||
create view v as select a, sum(i) as s from t group by a;
|
||||
select * from v where a != sformat('{}', 'qux');
|
||||
drop view v;
|
||||
drop table t;
|
||||
|
||||
echo # End of 10.11 tests;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
drop table if exists t1,t2;
|
||||
select 0=0,1>0,1>=1,1<0,1<=0,1!=0,strcmp("abc","abcd"),strcmp("b","a"),strcmp("a","a") ;
|
||||
0=0 1>0 1>=1 1<0 1<=0 1!=0 strcmp("abc","abcd") strcmp("b","a") strcmp("a","a")
|
||||
1 1 1 0 0 1 -1 1 0
|
||||
@@ -415,6 +414,12 @@ GREATEST(a,b) 4294967295
|
||||
GREATEST(b,a) 4294967295
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.1 tests
|
||||
#
|
||||
# MDEV-39363 Logical Bug in `NOT ( ... XOR ... )` Evaluation with Implicit Type Conversion
|
||||
#
|
||||
set @a=1e-1;
|
||||
select @a XOR 1, NOT(@a XOR 1);
|
||||
@a XOR 1 NOT(@a XOR 1)
|
||||
0 1
|
||||
# End of 10.11 tests
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
#
|
||||
# Testing of comparison functions
|
||||
#
|
||||
@@ -231,7 +228,12 @@ SELECT * FROM t2;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # End of 10.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.1 tests
|
||||
--echo # MDEV-39363 Logical Bug in `NOT ( ... XOR ... )` Evaluation with Implicit Type Conversion
|
||||
--echo #
|
||||
set @a=1e-1;
|
||||
select @a XOR 1, NOT(@a XOR 1);
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
@@ -889,4 +889,11 @@ NULL
|
||||
SELECT ST_COVEREDBY (ST_GEOMFROMTEXT ('POINT(0 0)'),ST_GEOMFROMTEXT ('POLYGON ((0 0,0 0,0 0,0 0,0 0))')) a;
|
||||
a
|
||||
0
|
||||
#
|
||||
# MDEV-31267 Server crash or assertion failure in get_n_sincos with nested ST_BUFFER.
|
||||
#
|
||||
set @geom=ST_BUFFER(ST_BUFFER(ST_POLYGONFROMTEXT('POLYGON((0 0, 5 5, 6 6, 0 0))'),1),2);
|
||||
select round(area(@geom), 5);
|
||||
round(area(@geom), 5)
|
||||
79.16890
|
||||
# End of 12.3 tests
|
||||
|
||||
@@ -502,4 +502,11 @@ SELECT ST_CROSSES( ST_GEOMFROMTEXT('POLYGON ((59 18,67 18,67 13,59 13,59 18)) ')
|
||||
--echo #
|
||||
SELECT ST_COVEREDBY (ST_GEOMFROMTEXT ('POINT(0 0)'),ST_GEOMFROMTEXT ('POLYGON ((0 0,0 0,0 0,0 0,0 0))')) a;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31267 Server crash or assertion failure in get_n_sincos with nested ST_BUFFER.
|
||||
--echo #
|
||||
|
||||
set @geom=ST_BUFFER(ST_BUFFER(ST_POLYGONFROMTEXT('POLYGON((0 0, 5 5, 6 6, 0 0))'),1),2);
|
||||
select round(area(@geom), 5);
|
||||
|
||||
--echo # End of 12.3 tests
|
||||
|
||||
@@ -5598,8 +5598,51 @@ gc
|
||||
SELECT HEX(ST_GeometryN(0x000000000107000000010000000101000000, 1));
|
||||
HEX(ST_GeometryN(0x000000000107000000010000000101000000, 1))
|
||||
NULL
|
||||
#
|
||||
# MDEV-40328 ASAN error on malformed WKB multipolygon
|
||||
#
|
||||
select st_area(x'0000000001060000000100000001030000');
|
||||
st_area(x'0000000001060000000100000001030000')
|
||||
NULL
|
||||
select st_centroid(x'0000000001060000000100000001030000');
|
||||
st_centroid(x'0000000001060000000100000001030000')
|
||||
NULL
|
||||
select glength(x'0000000001050000000100000001020000');
|
||||
glength(x'0000000001050000000100000001020000')
|
||||
NULL
|
||||
#
|
||||
# MDEV-40329 Binary_string::qs_append(char): Assertion `str_length + (uint32) (1) <= Alloced_length' failed in AsText
|
||||
#
|
||||
select astext(concat(x'00000000', repeat(x'010700000001000000', 200), x'010100000000000000000000000000000000000000')) as oops;
|
||||
oops
|
||||
GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(0 0)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
# End of 10.6 tests
|
||||
#
|
||||
# MDEV-35595 UBSAN: runtime error: load of value 3 for 'wkbByteOrder'
|
||||
#
|
||||
SELECT ST_GEOMFROMWKB (0x01060000000100000003020000000100000000000000000000000000000000000000) as g;
|
||||
g
|
||||
NULL
|
||||
SELECT ST_GEOMFROMWKB (0x01060000000100000083020000000100000000000000000000000000000000000000) as g;
|
||||
g
|
||||
NULL
|
||||
#
|
||||
# MDEV-26813 UBSAN: load of value 2 for bool 'wkbByteOrder' via 'Geometry::wkbByteOrder' for multi_line_string
|
||||
#
|
||||
SELECT ST_GEOMFROMWKB (0x01070000000100000002010000000000000000000000) as g;
|
||||
g
|
||||
NULL
|
||||
SELECT ST_GEOMFROMWKB (0x01070000000100000082010000000000000000000000) as g;
|
||||
g
|
||||
NULL
|
||||
SELECT ST_GEOMFROMWKB (0x01050000000100000002040000000100000000000000000000000000000000000000) as g;
|
||||
g
|
||||
NULL
|
||||
SELECT ST_GEOMFROMWKB (0x01050000000100000082040000000100000000000000000000000000000000000000) as g;
|
||||
g
|
||||
NULL
|
||||
# End of 10.11 tests
|
||||
#
|
||||
# Start of 11.5 tests
|
||||
#
|
||||
#
|
||||
|
||||
@@ -3569,8 +3569,40 @@ SELECT ST_GeomFromWKB(x'01070000000100000001070000000100000001070000000100000001
|
||||
--echo #
|
||||
SELECT HEX(ST_GeometryN(0x000000000107000000010000000101000000, 1));
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-40328 ASAN error on malformed WKB multipolygon
|
||||
--echo #
|
||||
select st_area(x'0000000001060000000100000001030000');
|
||||
select st_centroid(x'0000000001060000000100000001030000');
|
||||
|
||||
# similar on multilinestring
|
||||
select glength(x'0000000001050000000100000001020000');
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-40329 Binary_string::qs_append(char): Assertion `str_length + (uint32) (1) <= Alloced_length' failed in AsText
|
||||
--echo #
|
||||
select astext(concat(x'00000000', repeat(x'010700000001000000', 200), x'010100000000000000000000000000000000000000')) as oops;
|
||||
|
||||
--echo # End of 10.6 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35595 UBSAN: runtime error: load of value 3 for 'wkbByteOrder'
|
||||
--echo #
|
||||
|
||||
SELECT ST_GEOMFROMWKB (0x01060000000100000003020000000100000000000000000000000000000000000000) as g;
|
||||
SELECT ST_GEOMFROMWKB (0x01060000000100000083020000000100000000000000000000000000000000000000) as g;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-26813 UBSAN: load of value 2 for bool 'wkbByteOrder' via 'Geometry::wkbByteOrder' for multi_line_string
|
||||
--echo #
|
||||
|
||||
SELECT ST_GEOMFROMWKB (0x01070000000100000002010000000000000000000000) as g;
|
||||
SELECT ST_GEOMFROMWKB (0x01070000000100000082010000000000000000000000) as g;
|
||||
SELECT ST_GEOMFROMWKB (0x01050000000100000002040000000100000000000000000000000000000000000000) as g;
|
||||
SELECT ST_GEOMFROMWKB (0x01050000000100000082040000000100000000000000000000000000000000000000) as g;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
--echo #
|
||||
--echo # Start of 11.5 tests
|
||||
--echo #
|
||||
|
||||
@@ -788,19 +788,19 @@ show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
||||
GRANT SELECT ON `ÂÄ`.* TO `root`@`localhost`
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT PROXY ON ``@`%` TO `root`@`localhost` WITH GRANT OPTION
|
||||
flush privileges;
|
||||
show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
||||
GRANT SELECT ON `ÂÄ`.* TO `root`@`localhost`
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT PROXY ON ``@`%` TO `root`@`localhost` WITH GRANT OPTION
|
||||
drop database ÂÄ;
|
||||
revoke all privileges on ÂÄ.* from root@localhost;
|
||||
show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT PROXY ON ``@`%` TO `root`@`localhost` WITH GRANT OPTION
|
||||
set names latin1;
|
||||
create user mysqltest_7@;
|
||||
set password for mysqltest_7@ = password('systpass');
|
||||
@@ -2864,4 +2864,24 @@ RENAME USER 'name' to 'a';
|
||||
DROP USER foo;
|
||||
DROP USER a;
|
||||
# End of 10.4 tests
|
||||
#
|
||||
# MDEV-39047 Impossible to create DB grant for long escaped DB name
|
||||
#
|
||||
CREATE USER u@localhost;
|
||||
CREATE DATABASE very_long_database_name_with_underscore_symbols_inside_the_name;
|
||||
GRANT ALL ON `very\_long\_database\_name\_with\_underscore\_symbols\_inside\_the\_name`.* TO u@localhost;
|
||||
ERROR 42000: Incorrect database name 'very\_long\_database\_name\_with\_underscore\_symbols\_inside\_the\_name'
|
||||
GRANT ALL ON `very_long_database_name_with_underscore_symbols_inside_the_name`.* TO u@localhost;
|
||||
SHOW GRANTS FOR u@localhost;
|
||||
Grants for u@localhost
|
||||
GRANT USAGE ON *.* TO `u`@`localhost`
|
||||
GRANT ALL PRIVILEGES ON `very_long_database_name_with_underscore_symbols_inside_the_name`.* TO `u`@`localhost`
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR u@localhost;
|
||||
Grants for u@localhost
|
||||
GRANT USAGE ON *.* TO `u`@`localhost`
|
||||
GRANT ALL PRIVILEGES ON `very_long_database_name_with_underscore_symbols_inside_the_name`.* TO `u`@`localhost`
|
||||
DROP DATABASE very_long_database_name_with_underscore_symbols_inside_the_name;
|
||||
DROP USER u@localhost;
|
||||
# End of 10.6 tests
|
||||
update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
|
||||
|
||||
@@ -2331,4 +2331,23 @@ DROP USER a;
|
||||
|
||||
--echo # End of 10.4 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-39047 Impossible to create DB grant for long escaped DB name
|
||||
--echo #
|
||||
CREATE USER u@localhost;
|
||||
# 62-char db name with underscores; escaped form (\_) exceeds 64 chars and
|
||||
# was silently truncated in mysql.db, creating a broken grant.
|
||||
CREATE DATABASE very_long_database_name_with_underscore_symbols_inside_the_name;
|
||||
--error ER_WRONG_DB_NAME
|
||||
GRANT ALL ON `very\_long\_database\_name\_with\_underscore\_symbols\_inside\_the\_name`.* TO u@localhost;
|
||||
# Unescaped name fits and works
|
||||
GRANT ALL ON `very_long_database_name_with_underscore_symbols_inside_the_name`.* TO u@localhost;
|
||||
SHOW GRANTS FOR u@localhost;
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR u@localhost;
|
||||
DROP DATABASE very_long_database_name_with_underscore_symbols_inside_the_name;
|
||||
DROP USER u@localhost;
|
||||
|
||||
--echo # End of 10.6 tests
|
||||
|
||||
update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';
|
||||
|
||||
@@ -920,3 +920,90 @@ DROP USER mysqltest_u3@localhost;
|
||||
DROP USER mysqltest_u4@localhost;
|
||||
DROP USER mysqltest_u5@localhost;
|
||||
set GLOBAL sql_mode=default;
|
||||
# End of 10.1 tests
|
||||
#
|
||||
# MDEV-37951 SHOW TABLES allows users with only GRANT OPTION privilege to read all table names in the database "mysql"
|
||||
#
|
||||
create user u@localhost;
|
||||
grant grant option on *.* to u@localhost;
|
||||
connect con1, localhost, u;
|
||||
show grants;
|
||||
Grants for u@localhost
|
||||
GRANT USAGE ON *.* TO `u`@`localhost` WITH GRANT OPTION
|
||||
show tables from mysql;
|
||||
ERROR 42000: Access denied for user 'u'@'localhost' to database 'mysql'
|
||||
select * from information_schema.tables where table_schema='mysql';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
|
||||
disconnect con1;
|
||||
connection default;
|
||||
revoke grant option on *.* from u@localhost;
|
||||
grant select (host) on mysql.user to u@localhost with grant option;
|
||||
revoke select (host) on mysql.user from u@localhost;
|
||||
connect con1, localhost, u;
|
||||
show grants;
|
||||
Grants for u@localhost
|
||||
GRANT USAGE ON *.* TO `u`@`localhost`
|
||||
GRANT USAGE ON `mysql`.`user` TO `u`@`localhost` WITH GRANT OPTION
|
||||
show tables from mysql;
|
||||
Tables_in_mysql
|
||||
user
|
||||
select * from information_schema.tables where table_schema='mysql';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
|
||||
def mysql user VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL
|
||||
disconnect con1;
|
||||
connection default;
|
||||
revoke grant option on mysql.user from u@localhost;
|
||||
create procedure mysql.p1() select 1;
|
||||
grant execute on procedure mysql.p1 to u@localhost with grant option;
|
||||
revoke execute on procedure mysql.p1 from u@localhost;
|
||||
connect con1, localhost, u;
|
||||
show grants;
|
||||
Grants for u@localhost
|
||||
GRANT USAGE ON *.* TO `u`@`localhost`
|
||||
GRANT USAGE ON PROCEDURE `mysql`.`p1` TO `u`@`localhost` WITH GRANT OPTION
|
||||
show tables from mysql;
|
||||
Tables_in_mysql
|
||||
select * from information_schema.tables where table_schema='mysql';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
|
||||
disconnect con1;
|
||||
connection default;
|
||||
drop procedure mysql.p1;
|
||||
drop user u@localhost;
|
||||
# End of 10.11 tests
|
||||
create user u@localhost;
|
||||
grant grant option on *.* to u@localhost;
|
||||
connect con1, localhost, u;
|
||||
show grants;
|
||||
Grants for u@localhost
|
||||
GRANT USAGE ON *.* TO `u`@`localhost` WITH GRANT OPTION
|
||||
show create database mysql;
|
||||
ERROR 42000: Access denied for user 'u'@'localhost' to database 'mysql'
|
||||
select * from information_schema.tables where table_schema='mysql';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
|
||||
disconnect con1;
|
||||
connection default;
|
||||
create table mysql.t_mdev37951(a int check (a > 0), key(a));
|
||||
grant select (a) on mysql.t_mdev37951 to u@localhost with grant option;
|
||||
revoke select (a) on mysql.t_mdev37951 from u@localhost;
|
||||
connect con2, localhost, u;
|
||||
show grants;
|
||||
Grants for u@localhost
|
||||
GRANT USAGE ON *.* TO `u`@`localhost` WITH GRANT OPTION
|
||||
GRANT USAGE ON `mysql`.`t_mdev37951` TO `u`@`localhost` WITH GRANT OPTION
|
||||
show tables from mysql like 't_mdev37951';
|
||||
Tables_in_mysql (t_mdev37951)
|
||||
t_mdev37951
|
||||
select * from information_schema.statistics where table_schema='mysql' and table_name='t_mdev37951';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT IGNORED CREATE_OPTIONS
|
||||
def mysql t_mdev37951 1 mysql a 1 a A NULL NULL NULL YES BTREE NO
|
||||
select * from information_schema.key_column_usage where table_schema='mysql' and table_name='t_mdev37951';
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
|
||||
select * from information_schema.check_constraints where constraint_schema='mysql' and table_name='t_mdev37951';
|
||||
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME LEVEL CHECK_CLAUSE
|
||||
disconnect con2;
|
||||
connection default;
|
||||
revoke grant option on *.* from u@localhost;
|
||||
revoke grant option on mysql.t_mdev37951 from u@localhost;
|
||||
drop table mysql.t_mdev37951;
|
||||
drop user u@localhost;
|
||||
# End of 13.1 tests
|
||||
|
||||
@@ -1005,5 +1005,75 @@ DROP USER mysqltest_u2@localhost;
|
||||
DROP USER mysqltest_u3@localhost;
|
||||
DROP USER mysqltest_u4@localhost;
|
||||
DROP USER mysqltest_u5@localhost;
|
||||
|
||||
set GLOBAL sql_mode=default;
|
||||
|
||||
--echo # End of 10.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-37951 SHOW TABLES allows users with only GRANT OPTION privilege to read all table names in the database "mysql"
|
||||
--echo #
|
||||
create user u@localhost;
|
||||
grant grant option on *.* to u@localhost;
|
||||
connect con1, localhost, u;
|
||||
show grants;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
show tables from mysql;
|
||||
select * from information_schema.tables where table_schema='mysql';
|
||||
disconnect con1;
|
||||
connection default;
|
||||
revoke grant option on *.* from u@localhost;
|
||||
|
||||
grant select (host) on mysql.user to u@localhost with grant option;
|
||||
revoke select (host) on mysql.user from u@localhost;
|
||||
connect con1, localhost, u;
|
||||
show grants;
|
||||
show tables from mysql;
|
||||
select * from information_schema.tables where table_schema='mysql';
|
||||
disconnect con1;
|
||||
connection default;
|
||||
revoke grant option on mysql.user from u@localhost;
|
||||
|
||||
create procedure mysql.p1() select 1;
|
||||
grant execute on procedure mysql.p1 to u@localhost with grant option;
|
||||
revoke execute on procedure mysql.p1 from u@localhost;
|
||||
connect con1, localhost, u;
|
||||
show grants;
|
||||
show tables from mysql;
|
||||
select * from information_schema.tables where table_schema='mysql';
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
||||
drop procedure mysql.p1;
|
||||
drop user u@localhost;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
create user u@localhost;
|
||||
grant grant option on *.* to u@localhost;
|
||||
connect con1, localhost, u;
|
||||
show grants;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
show create database mysql;
|
||||
select * from information_schema.tables where table_schema='mysql';
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
||||
create table mysql.t_mdev37951(a int check (a > 0), key(a));
|
||||
grant select (a) on mysql.t_mdev37951 to u@localhost with grant option;
|
||||
revoke select (a) on mysql.t_mdev37951 from u@localhost;
|
||||
|
||||
connect con2, localhost, u;
|
||||
show grants;
|
||||
show tables from mysql like 't_mdev37951';
|
||||
select * from information_schema.statistics where table_schema='mysql' and table_name='t_mdev37951';
|
||||
select * from information_schema.key_column_usage where table_schema='mysql' and table_name='t_mdev37951';
|
||||
select * from information_schema.check_constraints where constraint_schema='mysql' and table_name='t_mdev37951';
|
||||
disconnect con2;
|
||||
connection default;
|
||||
|
||||
revoke grant option on *.* from u@localhost;
|
||||
revoke grant option on mysql.t_mdev37951 from u@localhost;
|
||||
drop table mysql.t_mdev37951;
|
||||
drop user u@localhost;
|
||||
|
||||
--echo # End of 13.1 tests
|
||||
|
||||
@@ -478,6 +478,31 @@ DROP USER foo@localhost;
|
||||
CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin;
|
||||
ERROR HY000: Plugin 'not_installed_plugin' is not loaded
|
||||
# End of 10.5 tests
|
||||
# MDEV-40470 GRANT PROXY with empty password incorrectly checks grantor's privileges
|
||||
#
|
||||
create user u1@localhost;
|
||||
create user u2@localhost identified by 'pwd';
|
||||
grant all privileges on *.* to u2@localhost with grant option;
|
||||
show create user u2@localhost;
|
||||
CREATE USER for u2@localhost
|
||||
CREATE USER `u2`@`localhost` IDENTIFIED BY PASSWORD '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD'
|
||||
connect u,localhost,u1;
|
||||
show grants;
|
||||
Grants for u1@localhost
|
||||
GRANT USAGE ON *.* TO `u1`@`localhost`
|
||||
grant proxy on u1@localhost to u2@localhost identified via 'foo';
|
||||
ERROR 42000: Access denied for user 'u1'@'localhost' to database 'mysql'
|
||||
grant proxy on u1@localhost to u2@localhost identified via '';
|
||||
ERROR 42000: Access denied for user 'u1'@'localhost' to database 'mysql'
|
||||
connection default;
|
||||
show create user u2@localhost;
|
||||
CREATE USER for u2@localhost
|
||||
CREATE USER `u2`@`localhost` IDENTIFIED BY PASSWORD '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD'
|
||||
drop user u1@localhost;
|
||||
Warnings:
|
||||
Note 4227 Dropped users 'u1'@'localhost' have active connections. Use KILL CONNECTION if they should not be used anymore.
|
||||
drop user u2@localhost;
|
||||
# End of 10.6 tests
|
||||
#
|
||||
# MDEV-37256: The permission check of LOAD INDEX INTO CACHE and CACHE INDEX is broken
|
||||
#
|
||||
|
||||
@@ -441,6 +441,26 @@ CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin;
|
||||
|
||||
--echo # End of 10.5 tests
|
||||
|
||||
--echo # MDEV-40470 GRANT PROXY with empty password incorrectly checks grantor's privileges
|
||||
--echo #
|
||||
create user u1@localhost;
|
||||
create user u2@localhost identified by 'pwd';
|
||||
grant all privileges on *.* to u2@localhost with grant option;
|
||||
|
||||
show create user u2@localhost;
|
||||
connect u,localhost,u1;
|
||||
show grants;
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
grant proxy on u1@localhost to u2@localhost identified via 'foo';
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
grant proxy on u1@localhost to u2@localhost identified via '';
|
||||
connection default;
|
||||
show create user u2@localhost;
|
||||
drop user u1@localhost;
|
||||
drop user u2@localhost;
|
||||
|
||||
--echo # End of 10.6 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-37256: The permission check of LOAD INDEX INTO CACHE and CACHE INDEX is broken
|
||||
--echo #
|
||||
|
||||
@@ -15,11 +15,11 @@ connection root;
|
||||
show grants for current_user;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT PROXY ON ``@`%` TO `root`@`localhost` WITH GRANT OPTION
|
||||
show grants;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT PROXY ON ``@`%` TO `root`@`localhost` WITH GRANT OPTION
|
||||
create database if not exists mysqltest;
|
||||
create table mysqltest.t1 (a int,b int,c int);
|
||||
create table mysqltest.t2 (a int,b int,c int);
|
||||
|
||||
@@ -15,11 +15,11 @@ connection root;
|
||||
show grants for current_user;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT PROXY ON ``@`%` TO `root`@`localhost` WITH GRANT OPTION
|
||||
show grants;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT PROXY ON ``@`%` TO `root`@`localhost` WITH GRANT OPTION
|
||||
create database if not exists mysqltest;
|
||||
create table mysqltest.t1 (a int,b int,c int);
|
||||
create table mysqltest.t2 (a int,b int,c int);
|
||||
|
||||
@@ -86,7 +86,7 @@ GRANT FEDERATED ADMIN ON *.* TO user1@localhost;
|
||||
connect con1,localhost,user1,,;
|
||||
SHOW CREATE SERVER srv;
|
||||
Server Create Server
|
||||
srv CREATE SERVER `srv` FOREIGN DATA WRAPPER mysql OPTIONS (USER 'remote_user', HOST 'localhost', PASSWORD 'secret', DATABASE 'test2');
|
||||
srv CREATE SERVER `srv` FOREIGN DATA WRAPPER `mysql` OPTIONS (USER 'remote_user', HOST 'localhost', PASSWORD 'secret', DATABASE 'test2');
|
||||
disconnect con1;
|
||||
connection default;
|
||||
DROP SERVER srv;
|
||||
|
||||
@@ -1047,7 +1047,10 @@ m
|
||||
3
|
||||
SELECT (SELECT SUM(t1_outer.a) FROM t1 AS t1_inner LIMIT 1)
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY
|
||||
(SELECT SUM(t1_outer.a) FROM t1 AS t1_inner LIMIT 1)
|
||||
3
|
||||
7
|
||||
11
|
||||
SELECT 1 FROM t1 as t1_outer
|
||||
WHERE (SELECT t1_outer.b FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1);
|
||||
1
|
||||
@@ -3090,6 +3093,54 @@ EXPLAIN
|
||||
DROP TABLE t1,t2;
|
||||
# End of 10.5 tests
|
||||
#
|
||||
# MDEV-39932: Assert correct ONLY_FULL_GROUP_BY behavior with outer refs in correlated subqueries
|
||||
#
|
||||
SET @save_sql_mode=@@sql_mode;
|
||||
SET SQL_MODE = 'ONLY_FULL_GROUP_BY';
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t1 VALUES (1,1),(2,1),(3,2),(4,2),(5,3),(6,3);
|
||||
SELECT (SELECT SUM(t1_inner.a) + t1_outer.a FROM t1 AS t1_inner LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY
|
||||
SELECT (SELECT SUM(t1_outer.b) + t1_outer.a FROM t1 AS t1_inner LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY
|
||||
SELECT (SELECT SUM(t1_inner.a + t1_outer.a) FROM t1 AS t1_inner LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY
|
||||
SELECT (SELECT SUM(t1_outer.a) + t1_outer.b FROM t1 AS t1_inner LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
c1
|
||||
4
|
||||
9
|
||||
14
|
||||
SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner WHERE t1_inner.a = t1_outer.a LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY
|
||||
SELECT (SELECT t1_inner.a FROM t1 AS t1_inner WHERE t1_outer.a > 5 LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY
|
||||
SELECT (SELECT t1_inner.a FROM t1 AS t1_inner WHERE SUM(t1_outer.a) > 5 LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
c1
|
||||
NULL
|
||||
1
|
||||
1
|
||||
SELECT (SELECT t1_inner.a FROM t1 AS t1_inner GROUP BY t1_inner.a HAVING t1_inner.a + SUM(t1_outer.a) > 5 LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
c1
|
||||
3
|
||||
1
|
||||
1
|
||||
SELECT COUNT(*), (SELECT SUM(t1_inner.a + t1_outer.a) FROM t1 AS t1_inner LIMIT 1)
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
ERROR 42000: 'test.t1_outer.a' isn't in GROUP BY
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=@save_sql_mode;
|
||||
#
|
||||
# End of 10.11 tests
|
||||
#
|
||||
#
|
||||
# Test new group_min_max optimization
|
||||
#
|
||||
create table t1 (a int, b int, c int, key(a,b,c));
|
||||
|
||||
@@ -793,7 +793,6 @@ SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1)
|
||||
AS m
|
||||
FROM t1 AS t1_outer;
|
||||
|
||||
--error ER_WRONG_FIELD_WITH_GROUP
|
||||
SELECT (SELECT SUM(t1_outer.a) FROM t1 AS t1_inner LIMIT 1)
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
@@ -2182,6 +2181,55 @@ DROP TABLE t1,t2;
|
||||
|
||||
--echo # End of 10.5 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-39932: Assert correct ONLY_FULL_GROUP_BY behavior with outer refs in correlated subqueries
|
||||
--echo #
|
||||
SET @save_sql_mode=@@sql_mode;
|
||||
SET SQL_MODE = 'ONLY_FULL_GROUP_BY';
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
|
||||
INSERT INTO t1 VALUES (1,1),(2,1),(3,2),(4,2),(5,3),(6,3);
|
||||
|
||||
--error ER_WRONG_FIELD_WITH_GROUP
|
||||
SELECT (SELECT SUM(t1_inner.a) + t1_outer.a FROM t1 AS t1_inner LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
--error ER_WRONG_FIELD_WITH_GROUP
|
||||
SELECT (SELECT SUM(t1_outer.b) + t1_outer.a FROM t1 AS t1_inner LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
--error ER_WRONG_FIELD_WITH_GROUP
|
||||
SELECT (SELECT SUM(t1_inner.a + t1_outer.a) FROM t1 AS t1_inner LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
SELECT (SELECT SUM(t1_outer.a) + t1_outer.b FROM t1 AS t1_inner LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
--error ER_WRONG_FIELD_WITH_GROUP
|
||||
SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner WHERE t1_inner.a = t1_outer.a LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
--error ER_WRONG_FIELD_WITH_GROUP
|
||||
SELECT (SELECT t1_inner.a FROM t1 AS t1_inner WHERE t1_outer.a > 5 LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
SELECT (SELECT t1_inner.a FROM t1 AS t1_inner WHERE SUM(t1_outer.a) > 5 LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
SELECT (SELECT t1_inner.a FROM t1 AS t1_inner GROUP BY t1_inner.a HAVING t1_inner.a + SUM(t1_outer.a) > 5 LIMIT 1) AS c1
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
--error ER_WRONG_FIELD_WITH_GROUP
|
||||
SELECT COUNT(*), (SELECT SUM(t1_inner.a + t1_outer.a) FROM t1 AS t1_inner LIMIT 1)
|
||||
FROM t1 AS t1_outer GROUP BY t1_outer.b;
|
||||
|
||||
DROP TABLE t1;
|
||||
SET sql_mode=@save_sql_mode;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.11 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Test new group_min_max optimization
|
||||
--echo #
|
||||
@@ -2230,4 +2278,3 @@ DROP TABLE t1, t2;
|
||||
|
||||
--echo # End of 11.8 tests
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--plugin-maturity=unknown
|
||||
@@ -1,14 +0,0 @@
|
||||
install plugin handlersocket soname 'handlersocket.so';
|
||||
select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description, plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket';
|
||||
plugin_name handlersocket
|
||||
plugin_version 1.0
|
||||
plugin_status ACTIVE
|
||||
plugin_type DAEMON
|
||||
plugin_library handlersocket.so
|
||||
plugin_library_version 1.16
|
||||
plugin_author higuchi dot akira at dena dot jp
|
||||
plugin_description Direct access into InnoDB
|
||||
plugin_license BSD
|
||||
plugin_maturity Beta
|
||||
plugin_auth_version 1.0
|
||||
uninstall plugin handlersocket;
|
||||
@@ -1,10 +0,0 @@
|
||||
--source include/not_windows_embedded.inc
|
||||
|
||||
if (`select length('$HANDLERSOCKET_SO') = 0`) {
|
||||
skip handlersocket plugin is not built;
|
||||
}
|
||||
|
||||
install plugin handlersocket soname 'handlersocket.so';
|
||||
--query_vertical select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description, plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket'
|
||||
uninstall plugin handlersocket;
|
||||
|
||||
@@ -6596,4 +6596,16 @@ EXPLAIN
|
||||
}
|
||||
}
|
||||
drop table t1, t2;
|
||||
#
|
||||
# MDEV-39916: Crash when pushing "NOT col" from HAVING into WHERE
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0), (1);
|
||||
SELECT a
|
||||
FROM t1
|
||||
GROUP BY a
|
||||
HAVING (NOT a) AND TRUE;
|
||||
a
|
||||
0
|
||||
DROP TABLE t1;
|
||||
# End of 10.11 tests
|
||||
|
||||
@@ -1807,4 +1807,18 @@ execute stmt;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-39916: Crash when pushing "NOT col" from HAVING into WHERE
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0), (1);
|
||||
|
||||
SELECT a
|
||||
FROM t1
|
||||
GROUP BY a
|
||||
HAVING (NOT a) AND TRUE;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # End of 10.11 tests
|
||||
|
||||
@@ -1328,7 +1328,7 @@ where state='User sleep' and
|
||||
info='select * from information_schema.tables where 1=sleep(100000)';
|
||||
--source include/wait_condition.inc
|
||||
connection conn1;
|
||||
--error 2013,ER_CONNECTION_KILLED
|
||||
--error 2013,2026,ER_CONNECTION_KILLED
|
||||
reap;
|
||||
connection default;
|
||||
disconnect conn1;
|
||||
@@ -1352,7 +1352,7 @@ where state='User sleep' and
|
||||
info='select * from information_schema.columns where 1=sleep(100000)';
|
||||
--source include/wait_condition.inc
|
||||
connection conn1;
|
||||
--error 2013,ER_CONNECTION_KILLED
|
||||
--error 2013,2026,ER_CONNECTION_KILLED
|
||||
reap;
|
||||
connection default;
|
||||
disconnect conn1;
|
||||
|
||||
@@ -49,7 +49,7 @@ select @a;
|
||||
# We got disconnected after receiving the above error message; any further
|
||||
# requests should fail with a notice that no one's listening to us.
|
||||
# --error CR_SERVER_GONE_ERROR,CR_SERVER_LOST
|
||||
--error 2013,2006
|
||||
--error 2013,2026,2006
|
||||
select @a;
|
||||
connection con0;
|
||||
drop table t1;
|
||||
|
||||
@@ -23,17 +23,23 @@ concat('b-', 1000 + A.a + B.a*10 + C.a*100, '=B'),
|
||||
from t0 A, t0 B, t0 C;
|
||||
create table t2 (a char(8)) charset=latin1;
|
||||
insert into t2 values ('a-1010=A'), ('a-1030=A'), ('a-1020=A');
|
||||
analyze table t1, t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze status OK
|
||||
This should use join buffer:
|
||||
explain select * from t1, t2 where t1.a=t2.a;
|
||||
explain select t1.a as t1a, t2.a as t2a, t1.filler from t1, t2 where t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 8 test.t2.a 1 Using join buffer (flat, BKA join); Key-ordered scan
|
||||
This output must be sorted by value of t1.a:
|
||||
select * from t1, t2 where t1.a=t2.a;
|
||||
a b filler a
|
||||
a-1010=A b-1010=B filler a-1010=A
|
||||
a-1020=A b-1020=B filler a-1020=A
|
||||
a-1030=A b-1030=B filler a-1030=A
|
||||
select t1.a as t1a, t2.a as t2a, t1.filler from t1, t2 where t1.a=t2.a;
|
||||
t1a t2a filler
|
||||
a-1010=A a-1010=A filler
|
||||
a-1020=A a-1020=A filler
|
||||
a-1030=A a-1030=A filler
|
||||
drop table t1, t2;
|
||||
create table t1(
|
||||
a char(8) character set utf8, b int, filler char(100),
|
||||
@@ -46,27 +52,39 @@ concat('a-', 1000 + A.a + B.a*10 + C.a*100, '=A'),
|
||||
from t0 A, t0 B, t0 C;
|
||||
create table t2 (a char(8) character set utf8, b int);
|
||||
insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020);
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
analyze table t1, t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze status OK
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 36 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler a b
|
||||
a-1010=A 1010 filler a-1010=A 1010
|
||||
a-1020=A 1020 filler a-1020=A 1020
|
||||
a-1030=A 1030 filler a-1030=A 1030
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler
|
||||
a-1010=A 1010 filler
|
||||
a-1020=A 1020 filler
|
||||
a-1030=A 1030 filler
|
||||
insert into t2 values ('a-1030=A', 1030), ('a-1020=A', 1020);
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
analyze table t1, t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze status OK
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 36 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler a b
|
||||
a-1010=A 1010 filler a-1010=A 1010
|
||||
a-1020=A 1020 filler a-1020=A 1020
|
||||
a-1020=A 1020 filler a-1020=A 1020
|
||||
a-1030=A 1030 filler a-1030=A 1030
|
||||
a-1030=A 1030 filler a-1030=A 1030
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler
|
||||
a-1010=A 1010 filler
|
||||
a-1020=A 1020 filler
|
||||
a-1020=A 1020 filler
|
||||
a-1030=A 1030 filler
|
||||
a-1030=A 1030 filler
|
||||
drop table t1, t2;
|
||||
create table t1(
|
||||
a varchar(8) character set utf8, b int, filler char(100),
|
||||
@@ -79,24 +97,30 @@ concat('a-', 1000 + A.a + B.a*10 + C.a*100, '=A'),
|
||||
from t0 A, t0 B, t0 C;
|
||||
create table t2 (a char(8) character set utf8, b int);
|
||||
insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020);
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
analyze table t1, t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze status OK
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 38 test.t2.a,test.t2.b 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler a b
|
||||
a-1010=A 1010 filler a-1010=A 1010
|
||||
a-1020=A 1020 filler a-1020=A 1020
|
||||
a-1030=A 1030 filler a-1030=A 1030
|
||||
explain select * from t1, t2 where t1.a=t2.a;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler
|
||||
a-1010=A 1010 filler
|
||||
a-1020=A 1020 filler
|
||||
a-1030=A 1030 filler
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 34 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a;
|
||||
a b filler a b
|
||||
a-1010=A 1010 filler a-1010=A 1010
|
||||
a-1020=A 1020 filler a-1020=A 1020
|
||||
a-1030=A 1030 filler a-1030=A 1030
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a;
|
||||
a b filler
|
||||
a-1010=A 1010 filler
|
||||
a-1020=A 1020 filler
|
||||
a-1030=A 1030 filler
|
||||
drop table t1, t2;
|
||||
create table t1 (a int, b int, c int, filler char(100), primary key(a,b,c));
|
||||
insert into t1 select A.a, B.a, C.a, 'filler' from t0 A, t0 B, t0 C;
|
||||
@@ -108,41 +132,47 @@ insert into t1 values (11, 33, 124, 'filler');
|
||||
insert into t1 values (11, 33, 125, 'filler');
|
||||
create table t2 (a int, b int);
|
||||
insert into t2 values (11,33), (11,22), (11,11);
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
analyze table t1, t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze status OK
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 8 test.t2.a,test.t2.b 1 Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b c filler a b
|
||||
11 11 11 filler 11 11
|
||||
11 11 12 filler 11 11
|
||||
11 11 13 filler 11 11
|
||||
11 22 1234 filler 11 22
|
||||
11 33 124 filler 11 33
|
||||
11 33 125 filler 11 33
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 8 test.t2.a,test.t2.b 9 Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler
|
||||
11 11 filler
|
||||
11 11 filler
|
||||
11 11 filler
|
||||
11 22 filler
|
||||
11 33 filler
|
||||
11 33 filler
|
||||
set join_cache_level=0;
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b c filler a b
|
||||
11 33 124 filler 11 33
|
||||
11 33 125 filler 11 33
|
||||
11 22 1234 filler 11 22
|
||||
11 11 11 filler 11 11
|
||||
11 11 12 filler 11 11
|
||||
11 11 13 filler 11 11
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
a b filler
|
||||
11 33 filler
|
||||
11 33 filler
|
||||
11 22 filler
|
||||
11 11 filler
|
||||
11 11 filler
|
||||
11 11 filler
|
||||
set join_cache_level=6;
|
||||
explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
a b c filler a b
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t2.a 91 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
a b filler
|
||||
set optimizer_switch='index_condition_pushdown=off';
|
||||
explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
a b c filler a b
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 4 test.t2.a 91 Using where; Using join buffer (flat, BKA join); Key-ordered scan
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
a b filler
|
||||
set optimizer_switch='index_condition_pushdown=on';
|
||||
drop table t1,t2;
|
||||
drop table t0;
|
||||
@@ -164,6 +194,12 @@ concat('kp1-', 1000 +A.a),
|
||||
concat('val-', 1000 +A.a)
|
||||
from test.t0 A ;
|
||||
create table t2 as select kp1 as a from t1;
|
||||
analyze table t1, t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze status OK
|
||||
set join_cache_level=8;
|
||||
set optimizer_switch='mrr=on,mrr_sort_keys=on';
|
||||
explain
|
||||
@@ -201,6 +237,12 @@ INSERT INTO t1 VALUES
|
||||
(1, 9, 'one', 11), (2, 6, 'two', 12), (3, 2, 'three', 13), (4, 5, 'four', 14);
|
||||
CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,9), (2,6) ;
|
||||
analyze table t1, t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze status OK
|
||||
SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e );
|
||||
a b c d e g
|
||||
1 9 one 11 1 9
|
||||
@@ -221,6 +263,13 @@ url text CHARACTER SET utf8
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
insert into t1 select '03b2ca8c' from t0 A, t0 B limit 80;
|
||||
insert into t2 select '03b2ca8c','' from t0 A, t0 B, t0 C;
|
||||
analyze table t1, t2 persistent for all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
test.t2 analyze status Engine-independent statistics collected
|
||||
test.t2 analyze Warning Engine-independent statistics are not collected for column 'url'
|
||||
test.t2 analyze status OK
|
||||
set @tmp_mdev5037=@@join_cache_level;
|
||||
set join_cache_level=3;
|
||||
explain SELECT 1 FROM (SELECT url, id FROM t2 LIMIT 1 OFFSET 20) derived RIGHT JOIN t1 ON t1.id = derived.id;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
# #rows, the call is there at all only for applicability check
|
||||
#
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/innodb_stable_estimates.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t0,t1,t2,t3;
|
||||
@@ -39,12 +40,13 @@ from t0 A, t0 B, t0 C;
|
||||
|
||||
create table t2 (a char(8)) charset=latin1;
|
||||
insert into t2 values ('a-1010=A'), ('a-1030=A'), ('a-1020=A');
|
||||
analyze table t1, t2 persistent for all;
|
||||
|
||||
--echo This should use join buffer:
|
||||
explain select * from t1, t2 where t1.a=t2.a;
|
||||
explain select t1.a as t1a, t2.a as t2a, t1.filler from t1, t2 where t1.a=t2.a;
|
||||
|
||||
--echo This output must be sorted by value of t1.a:
|
||||
select * from t1, t2 where t1.a=t2.a;
|
||||
select t1.a as t1a, t2.a as t2a, t1.filler from t1, t2 where t1.a=t2.a;
|
||||
drop table t1, t2;
|
||||
|
||||
# Try multi-column indexes
|
||||
@@ -61,13 +63,15 @@ from t0 A, t0 B, t0 C;
|
||||
|
||||
create table t2 (a char(8) character set utf8, b int);
|
||||
insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020);
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
analyze table t1, t2 persistent for all;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
|
||||
# Try with dataset that causes identical lookup keys:
|
||||
insert into t2 values ('a-1030=A', 1030), ('a-1020=A', 1020);
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
analyze table t1, t2 persistent for all;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
@@ -84,14 +88,15 @@ from t0 A, t0 B, t0 C;
|
||||
|
||||
create table t2 (a char(8) character set utf8, b int);
|
||||
insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020);
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
analyze table t1, t2 persistent for all;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
|
||||
#
|
||||
# Try scanning on a CPK prefix
|
||||
#
|
||||
explain select * from t1, t2 where t1.a=t2.a;
|
||||
select * from t1, t2 where t1.a=t2.a;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
@@ -111,25 +116,26 @@ insert into t1 values (11, 33, 125, 'filler');
|
||||
|
||||
create table t2 (a int, b int);
|
||||
insert into t2 values (11,33), (11,22), (11,11);
|
||||
analyze table t1, t2 persistent for all;
|
||||
|
||||
explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
|
||||
# Check a real resultset for comparison:
|
||||
set join_cache_level=0;
|
||||
select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t1.b=t2.b;
|
||||
set join_cache_level=6;
|
||||
|
||||
|
||||
#
|
||||
# Check that Index Condition Pushdown (BKA) actually works:
|
||||
#
|
||||
explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
|
||||
set optimizer_switch='index_condition_pushdown=off';
|
||||
explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
explain select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
select t1.a, t2.b, t1.filler from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
|
||||
set optimizer_switch='index_condition_pushdown=on';
|
||||
|
||||
drop table t1,t2;
|
||||
@@ -157,6 +163,7 @@ select
|
||||
from test.t0 A ;
|
||||
|
||||
create table t2 as select kp1 as a from t1;
|
||||
analyze table t1, t2 persistent for all;
|
||||
|
||||
set join_cache_level=8;
|
||||
set optimizer_switch='mrr=on,mrr_sort_keys=on';
|
||||
@@ -187,6 +194,7 @@ INSERT INTO t1 VALUES
|
||||
|
||||
CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,9), (2,6) ;
|
||||
analyze table t1, t2 persistent for all;
|
||||
|
||||
SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e );
|
||||
|
||||
@@ -210,6 +218,7 @@ CREATE TABLE t2 (
|
||||
|
||||
insert into t1 select '03b2ca8c' from t0 A, t0 B limit 80;
|
||||
insert into t2 select '03b2ca8c','' from t0 A, t0 B, t0 C;
|
||||
analyze table t1, t2 persistent for all;
|
||||
|
||||
set @tmp_mdev5037=@@join_cache_level;
|
||||
set join_cache_level=3;
|
||||
|
||||
@@ -1094,13 +1094,12 @@ NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
|
||||
set sql_mode= 'oracle';
|
||||
explain SELECT * from t3 union select * from u3 intersect all select * from i3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2
|
||||
4 DERIVED <derived2> ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
5 INTERSECT NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
||||
NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL
|
||||
4 INTERSECT i3 system NULL NULL NULL NULL 0 Const row not found
|
||||
NULL INTERSECT RESULT <intersect1,4> ALL NULL NULL NULL NULL NULL
|
||||
select x from t3 union select x from u3 intersect select x from i3;
|
||||
x
|
||||
SELECT x from t3 union select x from u3 intersect all select x from i3;
|
||||
@@ -1224,23 +1223,22 @@ a b
|
||||
2 3
|
||||
explain select * from t1 intersect all select * from t2 union values (1, 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 8
|
||||
4 DERIVED <derived2> ALL NULL NULL NULL NULL 7
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 7
|
||||
3 INTERSECT t2 ALL NULL NULL NULL NULL 7
|
||||
NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL
|
||||
5 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL
|
||||
4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select "__6"."a" AS "a","__6"."b" AS "b" from (select "__4"."a" AS "a","__4"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__4" union values (1,2)) "__6" latin1 latin1_swedish_ci
|
||||
v1 CREATE VIEW "v1" AS select "__5"."a" AS "a","__5"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__5" union values (1,2) latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
a b
|
||||
1 2
|
||||
2 3
|
||||
show create view v2;
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE VIEW "v2" AS select "__7"."a" AS "a","__7"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" union select "__5"."1" AS "1","__5"."2" AS "2" from (select "__6"."1" AS "1","__6"."2" AS "2" from (values (1,2) intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__6") "__5") "__7" latin1 latin1_swedish_ci
|
||||
v2 CREATE VIEW "v2" AS select "t1"."a" AS "a","t1"."b" AS "b" from "t1" union select "__5"."1" AS "1","__5"."2" AS "2" from (values (1,2) intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__5" latin1 latin1_swedish_ci
|
||||
select * from v2;
|
||||
a b
|
||||
1 2
|
||||
@@ -1249,7 +1247,7 @@ a b
|
||||
create view v3 as select * from t1 union values (1, 2) intersect all select * from t2;
|
||||
show create view v3;
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE VIEW "v3" AS select "__6"."a" AS "a","__6"."b" AS "b" from (select "__8"."a" AS "a","__8"."b" AS "b" from (select "__4"."a" AS "a","__4"."b" AS "b" from (select "__6"."a" AS "a","__6"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" union values (1,2)) "__6") "__4" intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__8") "__6" latin1 latin1_swedish_ci
|
||||
v3 CREATE VIEW "v3" AS select "__5"."a" AS "a","__5"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" union values (1,2)) "__5" intersect all select "t2"."a" AS "a","t2"."b" AS "b" from "t2" latin1 latin1_swedish_ci
|
||||
select * from v3;
|
||||
a b
|
||||
1 2
|
||||
@@ -1326,20 +1324,19 @@ set sql_mode= 'oracle';
|
||||
create view v2 as select * from t1 except all select * from t2 intersect all values (1, 2);
|
||||
show create view v2;
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE VIEW "v2" AS select "__6"."a" AS "a","__6"."b" AS "b" from (select "__8"."a" AS "a","__8"."b" AS "b" from (select "__4"."a" AS "a","__4"."b" AS "b" from (select "__6"."a" AS "a","__6"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" except all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__6") "__4" intersect all values (1,2)) "__8") "__6" latin1 latin1_swedish_ci
|
||||
v2 CREATE VIEW "v2" AS select "__5"."a" AS "a","__5"."b" AS "b" from (select "t1"."a" AS "a","t1"."b" AS "b" from "t1" except all select "t2"."a" AS "a","t2"."b" AS "b" from "t2") "__5" intersect all values (1,2) latin1 latin1_swedish_ci
|
||||
select * from v2;
|
||||
a b
|
||||
1 2
|
||||
drop view v2;
|
||||
EXPLAIN select * from t1 except all select * from t2 intersect all values (1, 2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2
|
||||
4 DERIVED <derived2> ALL NULL NULL NULL NULL 4
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 4
|
||||
3 EXCEPT t2 ALL NULL NULL NULL NULL 2
|
||||
NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL
|
||||
5 INTERSECT NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL
|
||||
4 INTERSECT NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
NULL INTERSECT RESULT <intersect1,4> ALL NULL NULL NULL NULL NULL
|
||||
select * from t2 union all select * from t2;
|
||||
a b
|
||||
1 2
|
||||
|
||||
@@ -10,12 +10,18 @@ NULL
|
||||
select json_equals("", "");
|
||||
json_equals("", "")
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_equals'
|
||||
select json_equals("", 1);
|
||||
json_equals("", 1)
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_equals'
|
||||
select json_equals(now(), now());
|
||||
json_equals(now(), now())
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_equals' at position 5
|
||||
select json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3, 4]}');
|
||||
json_equals('{"a":[1, 2, 3]}', '{"a":[1, 2, 3, 4]}')
|
||||
0
|
||||
|
||||
@@ -43,6 +43,8 @@ NULL
|
||||
select json_normalize('{ "invalid": "no_close"');
|
||||
json_normalize('{ "invalid": "no_close"')
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_normalize'
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
create table t1 (text varchar(200) character set 'latin1');
|
||||
@@ -75,3 +77,152 @@ select concat_ws(' ', json_normalize(t1.text), json_normalize(t1.text)) from t1;
|
||||
concat_ws(' ', json_normalize(t1.text), json_normalize(t1.text))
|
||||
0.0E0 0.0E0
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-28922 JSON_NORMALIZE handling of duplicate keys
|
||||
#
|
||||
SET @j = '{"x": 1, "y": 2, "z": 3, "b": 0, "c": 5, "b":3, "a": 4, "b": 1, "a": 3, "a": 2, "a": 1, "b": 2}';
|
||||
SELECT @k := JSON_NORMALIZE(@j);
|
||||
@k := JSON_NORMALIZE(@j)
|
||||
{"a":1.0E0,"a":2.0E0,"a":3.0E0,"a":4.0E0,"b":0.0E0,"b":1.0E0,"b":2.0E0,"b":3.0E0,"c":5.0E0,"x":1.0E0,"y":2.0E0,"z":3.0E0}
|
||||
SELECT JSON_EXTRACT(@j, '$.b') as j1, JSON_EXTRACT(@k, '$.b') as j2;
|
||||
j1 j2
|
||||
0 0.0E0
|
||||
Primitives
|
||||
SET @j='{"a": null, "a": true, "a": false, "a": 123, "a": "string"}';
|
||||
SELECT JSON_NORMALIZE(@j);
|
||||
JSON_NORMALIZE(@j)
|
||||
{"a":"string","a":1.23E2,"a":true,"a":false,"a":null}
|
||||
SET @j2='{"a": "string", "a": 123, "a": false, "a": true, "a": null}';
|
||||
SELECT JSON_NORMALIZE(@j2);
|
||||
JSON_NORMALIZE(@j2)
|
||||
{"a":"string","a":1.23E2,"a":true,"a":false,"a":null}
|
||||
SELECT JSON_EQUALS(@j, @j2) je;
|
||||
je
|
||||
1
|
||||
Objects
|
||||
SET @j='{
|
||||
"a": {},
|
||||
"a": {"x":1},
|
||||
"a": {"x":1,"y":2},
|
||||
"a": {"x":1,"y":2,"z":3}
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j);
|
||||
JSON_NORMALIZE(@j)
|
||||
{"a":{},"a":{"x":1.0E0},"a":{"x":1.0E0,"y":2.0E0},"a":{"x":1.0E0,"y":2.0E0,"z":3.0E0}}
|
||||
SET @j2='{
|
||||
"a": {"x":1,"y":2,"z":3},
|
||||
"a": {"x":1},
|
||||
"a": {},
|
||||
"a": {"x":1,"y":2}
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j2);
|
||||
JSON_NORMALIZE(@j2)
|
||||
{"a":{},"a":{"x":1.0E0},"a":{"x":1.0E0,"y":2.0E0},"a":{"x":1.0E0,"y":2.0E0,"z":3.0E0}}
|
||||
SELECT JSON_EQUALS(@j, @j2) as je;
|
||||
je
|
||||
1
|
||||
Arrays
|
||||
SET @j='{
|
||||
"a": [],
|
||||
"a": [1],
|
||||
"a": [1,2],
|
||||
"a": [1,2,3],
|
||||
"a": [1,2,3,4]
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j);
|
||||
JSON_NORMALIZE(@j)
|
||||
{"a":[],"a":[1.0E0],"a":[1.0E0,2.0E0],"a":[1.0E0,2.0E0,3.0E0],"a":[1.0E0,2.0E0,3.0E0,4.0E0]}
|
||||
SET @j2='{
|
||||
"a": [1,2,3],
|
||||
"a": [],
|
||||
"a": [1,2,3,4],
|
||||
"a": [1],
|
||||
"a": [1,2]
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j2);
|
||||
JSON_NORMALIZE(@j2)
|
||||
{"a":[],"a":[1.0E0],"a":[1.0E0,2.0E0],"a":[1.0E0,2.0E0,3.0E0],"a":[1.0E0,2.0E0,3.0E0,4.0E0]}
|
||||
SELECT JSON_EQUALS(@j, @j2) je;
|
||||
je
|
||||
1
|
||||
Mixed Arrays
|
||||
SET @j='{
|
||||
"a": [],
|
||||
"a": [null],
|
||||
"a": [1,"x",true],
|
||||
"a": [{"k":1}],
|
||||
"a": [[1,2],[3,4]]
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j);
|
||||
JSON_NORMALIZE(@j)
|
||||
{"a":[],"a":[{"k":1.0E0}],"a":[null],"a":[[1.0E0,2.0E0],[3.0E0,4.0E0]],"a":[1.0E0,"x",true]}
|
||||
SET @j2='{
|
||||
"a": [[1,2],[3,4]],
|
||||
"a": [{"k":1}],
|
||||
"a": [],
|
||||
"a": [1,"x",true],
|
||||
"a": [null]
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j2);
|
||||
JSON_NORMALIZE(@j2)
|
||||
{"a":[],"a":[{"k":1.0E0}],"a":[null],"a":[[1.0E0,2.0E0],[3.0E0,4.0E0]],"a":[1.0E0,"x",true]}
|
||||
SELECT JSON_EQUALS(@j, @j2) je;
|
||||
je
|
||||
1
|
||||
Nested objects
|
||||
SET @j='{
|
||||
"a": {"x":{"y":1}},
|
||||
"a": {"x":{"y":[1,2]}},
|
||||
"a": {"x":{"y":{"z":3}}},
|
||||
"a": {"x":{}}
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j);
|
||||
JSON_NORMALIZE(@j)
|
||||
{"a":{"x":{}},"a":{"x":{"y":{"z":3.0E0}}},"a":{"x":{"y":[1.0E0,2.0E0]}},"a":{"x":{"y":1.0E0}}}
|
||||
SET @j2='{
|
||||
"a": {"x":{}},
|
||||
"a": {"x":{"y":{"z":3}}},
|
||||
"a": {"x":{"y":1}},
|
||||
"a": {"x":{"y":[1,2]}}
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j2);
|
||||
JSON_NORMALIZE(@j2)
|
||||
{"a":{"x":{}},"a":{"x":{"y":{"z":3.0E0}}},"a":{"x":{"y":[1.0E0,2.0E0]}},"a":{"x":{"y":1.0E0}}}
|
||||
SELECT JSON_EQUALS(@j, @j2) je;
|
||||
je
|
||||
1
|
||||
Everything mixed
|
||||
SET @j='{
|
||||
"a": null,
|
||||
"a": 1,
|
||||
"a": "abc",
|
||||
"a": true,
|
||||
"a": [],
|
||||
"a": [1],
|
||||
"a": [1,2],
|
||||
"a": {},
|
||||
"a": {"k":1},
|
||||
"a": {"k":1,"m":2}
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j);
|
||||
JSON_NORMALIZE(@j)
|
||||
{"a":{},"a":{"k":1.0E0},"a":{"k":1.0E0,"m":2.0E0},"a":[],"a":[1.0E0],"a":[1.0E0,2.0E0],"a":"abc","a":1.0E0,"a":true,"a":null}
|
||||
SET @j2='{
|
||||
"a": {"k":1},
|
||||
"a": [],
|
||||
"a": true,
|
||||
"a": {"k":1,"m":2},
|
||||
"a": "abc",
|
||||
"a": null,
|
||||
"a": [1,2],
|
||||
"a": 1,
|
||||
"a": {},
|
||||
"a": [1]
|
||||
}';
|
||||
SELECT JSON_NORMALIZE(@j2);
|
||||
JSON_NORMALIZE(@j2)
|
||||
{"a":{},"a":{"k":1.0E0},"a":{"k":1.0E0,"m":2.0E0},"a":[],"a":[1.0E0],"a":[1.0E0,2.0E0],"a":"abc","a":1.0E0,"a":true,"a":null}
|
||||
SELECT JSON_EQUALS(@j, @j2) je;
|
||||
je
|
||||
1
|
||||
# End of 10.11 tests
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user