summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-10-18 14:11:55 +0400
committerAlexander Barkov <bar@mariadb.org>2017-10-18 14:11:55 +0400
commit30e7d6709f7fb0f70a07c80a1a06614ca23da5f4 (patch)
tree9ba11fd32d82ac5c1364a537532ac896c4dd2058 /mysql-test
parent75aabd03d57f85d63d57b25a239b4f930a3ae3c0 (diff)
parent3bc094d32a360b7d51600cf11bc4ce24117ecb78 (diff)
downloadmariadb-git-30e7d6709f7fb0f70a07c80a1a06614ca23da5f4.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/lib/My/SafeProcess.pm7
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt1
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_kill_win.cc82
-rw-r--r--mysql-test/r/cte_nonrecursive.result36
-rw-r--r--mysql-test/r/cte_recursive.result31
-rw-r--r--mysql-test/r/func_json.result20
-rw-r--r--mysql-test/r/gis-precise.result19
-rw-r--r--mysql-test/r/gis2.result24
-rw-r--r--mysql-test/r/information_schema.result32
-rw-r--r--mysql-test/r/type_float.result26
-rw-r--r--mysql-test/suite/innodb/disabled.def9
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter.result30
-rw-r--r--mysql-test/suite/innodb/r/innodb-online-alter-gis.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb_defrag_concurrent.result17
-rw-r--r--mysql-test/suite/innodb/r/log_file_size.result8
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter.test28
-rw-r--r--mysql-test/suite/innodb/t/innodb-online-alter-gis.test10
-rw-r--r--mysql-test/suite/innodb/t/innodb_defrag_concurrent.test28
-rw-r--r--mysql-test/suite/innodb/t/log_file_size.test25
-rw-r--r--mysql-test/suite/innodb_gis/r/alter_spatial_index.result16
-rw-r--r--mysql-test/suite/innodb_gis/t/alter_spatial_index.test20
-rw-r--r--mysql-test/suite/mariabackup/xb_file_key_management.result1
-rw-r--r--mysql-test/suite/mariabackup/xb_file_key_management.test1
-rw-r--r--mysql-test/t/cte_nonrecursive.test19
-rw-r--r--mysql-test/t/func_json.test16
-rw-r--r--mysql-test/t/gis-precise.test19
-rw-r--r--mysql-test/t/gis2.test28
-rw-r--r--mysql-test/t/information_schema.test26
-rw-r--r--mysql-test/t/type_float.test15
29 files changed, 557 insertions, 47 deletions
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
index f3ee772cca3..3260a6ed593 100644
--- a/mysql-test/lib/My/SafeProcess.pm
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -336,9 +336,14 @@ sub start_kill {
sub dump_core {
my ($self)= @_;
- return if IS_WINDOWS;
my $pid= $self->{SAFE_PID};
die "Can't get core from not started process" unless defined $pid;
+
+ if (IS_WINDOWS) {
+ system("$safe_kill $pid dump");
+ return 1;
+ }
+
_verbose("Sending ABRT to $self");
kill ("ABRT", $pid);
return 1;
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index ec93f94a3e8..ff842f3468f 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -25,6 +25,7 @@ SET(INSTALL_ARGS
IF (WIN32)
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS})
MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS})
+ TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi)
ELSE()
MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS})
ENDIF()
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
index 2ac29c61bc7..e5ec33af571 100644
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
@@ -25,6 +25,80 @@
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
+#include <psapi.h>
+#include <DbgHelp.h>
+
+static int create_dump(DWORD pid)
+{
+ char path[MAX_PATH];
+ char working_dir[MAX_PATH];
+ int ret= -1;
+ HANDLE process= INVALID_HANDLE_VALUE;
+ HANDLE file= INVALID_HANDLE_VALUE;
+ char *p;
+
+ process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, (DWORD)pid);
+ if (!process)
+ {
+ fprintf(stderr,"safe_kill : cannot open process pid=%u to create dump, last error %u\n",
+ pid, GetLastError());
+ goto exit;
+ }
+
+ DWORD size = MAX_PATH;
+ if (QueryFullProcessImageName(process, 0, path, &size) == 0)
+ {
+ fprintf(stderr,"safe_kill : cannot read process path for pid %u, last error %u\n",
+ pid, GetLastError());
+ goto exit;
+ }
+
+ if ((p = strrchr(path, '.')) == 0)
+ p= path + strlen(path);
+
+ strncpy(p, ".dmp", path + MAX_PATH - p);
+
+ /* Create dump in current directory.*/
+ const char *filename= strrchr(path, '\\');
+ if (filename == 0)
+ filename = path;
+ else
+ filename++;
+
+ if (!GetCurrentDirectory(MAX_PATH, working_dir))
+ {
+ fprintf(stderr, "GetCurrentDirectory failed, last error %u",GetLastError());
+ goto exit;
+ }
+
+ file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE,
+ 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+
+ if (file == INVALID_HANDLE_VALUE)
+ {
+ fprintf(stderr,"safe_kill : CreateFile() failed for file %s, working dir %s, last error = %u\n",
+ filename, working_dir, GetLastError());
+ goto exit;
+ }
+
+ if (!MiniDumpWriteDump(process, pid, file, MiniDumpNormal, 0,0,0))
+ {
+ fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %u\n",
+ filename, working_dir, GetLastError());
+ goto exit;
+ }
+
+ ret = 0;
+ fprintf(stderr, "Minidump written to %s, directory %s\n", filename, working_dir);
+
+exit:
+ if(process!= 0 && process != INVALID_HANDLE_VALUE)
+ CloseHandle(process);
+
+ if (file != 0 && file != INVALID_HANDLE_VALUE)
+ CloseHandle(file);
+ return ret;
+}
int main(int argc, const char** argv )
{
@@ -37,12 +111,16 @@ int main(int argc, const char** argv )
signal(SIGBREAK, SIG_IGN);
signal(SIGTERM, SIG_IGN);
- if (argc != 2) {
- fprintf(stderr, "safe_kill <pid>\n");
+ if ((argc != 2 && argc != 3) || (argc == 3 && strcmp(argv[2],"dump"))) {
+ fprintf(stderr, "safe_kill <pid> [dump]\n");
exit(2);
}
pid= atoi(argv[1]);
+ if (argc == 3)
+ {
+ return create_dump(pid);
+ }
_snprintf(safe_process_name, sizeof(safe_process_name),
"safe_process[%d]", pid);
diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 2fceebd1971..3ad6fb8fabe 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -86,7 +86,7 @@ select * from t2,t where t2.c=t.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
explain
select * from t2, (select a, count(*) from t1 where b >= 'c' group by a) as t
where t2.c=t.a;
@@ -176,7 +176,7 @@ select * from t2 where c in (select c from t);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
1 PRIMARY <derived2> ref key0 key0 8 test.t2.c 2 Using where; FirstMatch(t2)
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
explain
select * from t2
where c in (select c from (select count(*) as c from t1
@@ -245,8 +245,8 @@ select * from t as r1, t as r2 where r1.a=r2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <derived3> ref key0 key0 5 r1.a 2
-3 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
+3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
explain
select * from (select distinct a from t1 where b >= 'c') as r1,
(select distinct a from t1 where b >= 'c') as r2
@@ -370,7 +370,7 @@ select * from t2,t where t2.c=t.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
-2 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where
3 UNION t2 ALL NULL NULL NULL NULL 4 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
explain
@@ -598,7 +598,7 @@ select * from v2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
1 PRIMARY <derived3> ref key0 key0 5 test.t2.c 2
-3 SUBQUERY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
+3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
# with clause in the specification of a view that whose definition
# table alias for a with table
create view v3 as
@@ -1055,3 +1055,27 @@ deallocate prepare stmt1;
deallocate prepare stmt2;
drop view v1,v2;
drop table t1,t2;
+#
+# MDEV-13796: UNION of two materialized CTEs
+#
+CREATE TABLE t1 (id int, k int);
+CREATE TABLE t2 (id int);
+INSERT INTO t1 VALUES (3,5), (1,7), (4,3);
+INSERT INTO t2 VALUES (4), (3), (2);
+WITH d1 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id),
+d2 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id)
+SELECT * FROM d1 UNION SELECT * FROM d2;
+SUM(k)
+8
+explain WITH d1 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id),
+d2 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id)
+SELECT * FROM d1 UNION SELECT * FROM d2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9
+2 DERIVED t1 ALL NULL NULL NULL NULL 3
+2 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+4 UNION <derived3> ALL NULL NULL NULL NULL 9
+3 DERIVED t1 ALL NULL NULL NULL NULL 3
+3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result
index 946ba16ac5c..a4f32927cf1 100644
--- a/mysql-test/r/cte_recursive.result
+++ b/mysql-test/r/cte_recursive.result
@@ -86,7 +86,7 @@ select t2.a from t1,t2 where t1.a+1=t2.a
select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 30
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
3 UNION t1 ALL NULL NULL NULL NULL 5
3 UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -114,7 +114,7 @@ select t2.a from t1,t2 where t1.a+1=t2.a
select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 5
3 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
@@ -691,13 +691,13 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY <derived3> ref key0 key0 5 c.h_id 2 100.00
1 PRIMARY <derived3> ref key0 key0 5 c.w_id 2 100.00
-3 SUBQUERY folks ALL NULL NULL NULL NULL 12 100.00 Using where
+3 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where
4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
4 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
5 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 2 100.00
5 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL NULL
-2 UNCACHEABLE SUBQUERY <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where
+2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where
Warnings:
Note 1003 with recursive ancestor_couple_ids as (/* select#2 */ select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors as (/* select#3 */ select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all /* select#4 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all /* select#5 */ select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)/* select#1 */ select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id`
# simple mutual recursion
@@ -877,7 +877,7 @@ where p.id = a.father or p.id = a.mother
select * from ancestors;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 100.00
-2 SUBQUERY folks ALL NULL NULL NULL NULL 12 100.00 Using where
+2 DERIVED folks ALL NULL NULL NULL NULL 12 100.00 Using where
3 RECURSIVE UNION p ALL NULL NULL NULL NULL 12 100.00
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
@@ -1236,7 +1236,7 @@ where p.id = ma.mother
select * from ancestors;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12
-2 SUBQUERY folks ALL NULL NULL NULL NULL 12 Using where
+2 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
3 RECURSIVE UNION p ALL PRIMARY NULL NULL NULL 12
3 RECURSIVE UNION <derived2> ref key0 key0 5 test.p.id 2
4 RECURSIVE UNION p ALL PRIMARY NULL NULL NULL 12
@@ -1300,14 +1300,14 @@ from prev_gen
select ancestors.name, ancestors.dob from ancestors;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 24
-4 SUBQUERY folks ALL NULL NULL NULL NULL 12 Using where
+4 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
6 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12
-5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24
-NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL
-3 SUBQUERY folks ALL NULL NULL NULL NULL 12 Using where
+3 DERIVED folks ALL NULL NULL NULL NULL 12 Using where
2 RECURSIVE UNION folks ALL PRIMARY NULL NULL NULL 12
2 RECURSIVE UNION <derived3> ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union3,2> ALL NULL NULL NULL NULL NULL
+5 RECURSIVE UNION <derived4> ALL NULL NULL NULL NULL 24
+NULL UNION RESULT <union4,6,5> ALL NULL NULL NULL NULL NULL
explain FORMAT=JSON
with recursive
prev_gen
@@ -1353,7 +1353,6 @@ EXPLAIN
{
"query_block": {
"select_id": 4,
- "operation": "UNION",
"table": {
"table_name": "folks",
"access_type": "ALL",
@@ -1382,7 +1381,6 @@ EXPLAIN
{
"query_block": {
"select_id": 3,
- "operation": "UNION",
"table": {
"table_name": "folks",
"access_type": "ALL",
@@ -1489,7 +1487,6 @@ EXPLAIN
{
"query_block": {
"select_id": 3,
- "operation": "UNION",
"table": {
"table_name": "v",
"access_type": "ALL",
@@ -1757,7 +1754,6 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
- "operation": "UNION",
"table": {
"table_name": "t1",
"access_type": "ALL",
@@ -1840,7 +1836,7 @@ select t2.a from t1,t2 where t1.a+1=t2.a
select * from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5
-2 SUBQUERY t2 ALL NULL NULL NULL NULL 5 Using where
+2 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where
4 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 5
4 RECURSIVE UNION t2 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,4> ALL NULL NULL NULL NULL NULL
@@ -2387,7 +2383,6 @@ ANALYZE
{
"query_block": {
"select_id": 2,
- "operation": "UNION",
"table": {
"message": "No tables used"
}
@@ -2794,7 +2789,7 @@ SELECT c1 FROM t, cte
) SELECT COUNT(*) FROM cte;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
-2 SUBQUERY t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+2 DERIVED t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
@@ -2812,7 +2807,7 @@ SELECT c2 FROM t, cte
) SELECT COUNT(*) FROM cte;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
-2 SUBQUERY t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+2 DERIVED t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result
index b1d3d96aa73..15e4fbec605 100644
--- a/mysql-test/r/func_json.result
+++ b/mysql-test/r/func_json.result
@@ -152,6 +152,9 @@ json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]')
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]')
1
+select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
+json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}')
+1
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]")
1
@@ -402,6 +405,13 @@ abc
select json_unquote('abc');
json_unquote('abc')
abc
+create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1;
+insert into t1 values ('abc'),('def');
+select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1;
+fld
+{"foo": "{\"bar\": \"abc\"}", "qux": "abc"}
+{"foo": "{\"bar\": \"def\"}", "qux": "def"}
+drop table t1;
select json_object("a", json_object("b", "abcd"));
json_object("a", json_object("b", "abcd"))
{"a": {"b": "abcd"}}
@@ -443,6 +453,11 @@ json_length('{"a": 1, "b": {"c": 30}}', '$.b')
select json_length('{"a": 1, "b": {"c": 30}}');
json_length('{"a": 1, "b": {"c": 30}}')
2
+select json_length('{}{');
+json_length('{}{')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' at position 3
create table json (j INT);
show create table json;
Table Create Table
@@ -705,6 +720,11 @@ json_data
SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
json_data
{"user": "Jožko Mrkvičká"}
+select json_contains_path('{"foo":"bar"}', 'one', '$[]');
+json_contains_path('{"foo":"bar"}', 'one', '$[]')
+NULL
+Warnings:
+Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_path' at position 3
#
# Start of 10.3 tests
#
diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result
index f816278a0ba..292dfe0462c 100644
--- a/mysql-test/r/gis-precise.result
+++ b/mysql-test/r/gis-precise.result
@@ -485,6 +485,25 @@ ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText
select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'))
0
+SELECT ST_RELATE(
+ST_DIFFERENCE(
+GEOMETRYFROMTEXT('
+ MULTILINESTRING(
+ ( 12841 36140, 8005 31007, 26555 31075, 52765 41191,
+ 28978 6548, 45720 32057, 53345 3221 ),
+ ( 8304 59107, 25233 31592, 40502 25303, 8205 42940 ),
+ ( 7829 7305, 58841 56759, 64115 8512, 37562 54145, 2210 14701 ),
+ ( 20379 2805, 40807 27770, 28147 14883, 26439 29383, 55663 5086 ),
+ ( 35944 64702, 14433 23728, 49317 26241, 790 16941 )
+ )
+ '),
+GEOMETRYFROMTEXT('POINT(46061 13545)')
+),
+GEOMETRYFROMTEXT('POINT(4599 60359)'),
+'F*FFFF**F'
+ ) as relate_res;
+relate_res
+0
DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN
diff --git a/mysql-test/r/gis2.result b/mysql-test/r/gis2.result
index 214431e1d2d..c0b476e080b 100644
--- a/mysql-test/r/gis2.result
+++ b/mysql-test/r/gis2.result
@@ -12,3 +12,27 @@ WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
id
2
DROP TABLE t1;
+create table t1 (p point default "qwer");
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+create table t1 (p point default 0);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+create table t1 (p point not null default st_geometryfromtext('point 0)'));
+ERROR 42000: Invalid default value for 'p'
+create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
+insert into t1 values(default);
+select st_astext(p) from t1;
+st_astext(p)
+POINT(0 0)
+drop table t1;
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
+set timestamp=10;
+insert into t1 values(default);
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
+drop table t1;
+SET timestamp=default;
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
+set timestamp=10;
+alter table t1 add column i int;
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
+drop table t1;
+SET timestamp=default;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 01a7099e307..1c073881a9d 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -2140,3 +2140,35 @@ drop database db1;
connection default;
disconnect con1;
set global sql_mode=default;
+USE test;
+#
+# End of 10.0 tests
+#
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-13242 Wrong results for queries with row constructors and information_schema
+#
+CREATE TABLE tt1(c1 INT);
+CREATE TABLE tt2(c2 INT);
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1', 'c1'));
+count(*)
+1
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt2', 'c2'));
+count(*)
+1
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2'));
+count(*)
+2
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (SELECT 'tt1','c1' FROM dual UNION SELECT 'tt2', 'c2' FROM dual);
+count(*)
+2
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name='tt1' AND column_name='c1') OR (table_name='tt2' AND column_name='c2');
+count(*)
+2
+SELECT column_name FROM information_schema.columns WHERE (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2')) ORDER BY column_name;
+column_name
+c1
+c2
+DROP TABLE tt1, tt2;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 9a92ff21e9f..57cdd1561df 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -772,5 +772,31 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table if exists t1;
#
+# MDEV-11586 UNION of FLOAT type results in erroneous precision
+#
+CREATE TABLE t1 (f FLOAT);
+INSERT INTO t1 VALUES (1.1);
+SELECT f FROM t1 UNION SELECT 1;
+f
+1.100000023841858
+1
+SELECT 1 UNION SELECT f FROM t1;
+1
+1
+1.100000023841858
+SELECT f FROM t1 UNION SELECT 2147483647;
+f
+1.100000023841858
+2147483647
+SELECT 2147483647 UNION SELECT f FROM t1;
+2147483647
+2147483647
+1.100000023841858
+SELECT CASE WHEN 0 THEN (SELECT f FROM t1) ELSE 2147483647 END AS c1,
+CASE WHEN 1 THEN 2147483647 ELSE (SELECT f FROM t1) END AS c2;
+c1 c2
+2147483647 2147483647
+DROP TABLE t1;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def
index 9a92e99df2e..c435de278b9 100644
--- a/mysql-test/suite/innodb/disabled.def
+++ b/mysql-test/suite/innodb/disabled.def
@@ -10,14 +10,5 @@
#
##############################################################################
-innodb_defragment_fill_factor : MDEV-11336 Fix and enable innodb_defragment
-innodb.defrag_mdl-9155 : MDEV-11336 Fix and enable innodb_defragment
-innodb.innodb_defrag_concurrent : MDEV-11336 Fix and enable innodb_defragment
-innodb.innodb_defrag_stats : MDEV-11336 Fix and enable innodb_defragment
-innodb.innodb_defrag_stats_many_tables : MDEV-11336 Fix and enable innodb_defragment
-innodb.innodb_defragment : MDEV-11336 Fix and enable innodb_defragment
-innodb.innodb_defragment_fill_factor : MDEV-11336 Fix and enable innodb_defragment
-innodb.innodb_defragment_small : MDEV-11336 Fix and enable innodb_defragment
-innodb.innodb_defrag_binlog : MDEV-11336 Fix and enable innodb_defragment
innodb-wl5980-alter : MDEV-9469 / MDEV-13668 extra crash in 10.2
create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails
diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result
index aa78f55c78f..b06c6060375 100644
--- a/mysql-test/suite/innodb/r/innodb-alter.result
+++ b/mysql-test/suite/innodb/r/innodb-alter.result
@@ -857,3 +857,33 @@ DROP TABLE dest_db.t1;
DROP TABLE source_db.t1;
DROP DATABASE source_db;
DROP DATABASE dest_db;
+USE test;
+#
+# MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
+#
+CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
+iNSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ADD b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0);
+ERROR 22003: Out of range value for column 'b' at row 1
+SELECT * FROM t1;
+a
+10
+DROP TABLE t1;
+CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
+iNSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ADD b DATE NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+SELECT * FROM t1;
+a b
+10 2001-01-01
+DROP TABLE t1;
+CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
+iNSERT INTO t1 VALUES (10);
+ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+SELECT * FROM t1;
+a b
+10 10:20:30
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
index c7daac48e48..79c0f2386aa 100644
--- a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
+++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
@@ -37,3 +37,13 @@ Level Code Message
show errors;
Level Code Message
drop table t1;
+#
+# MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
+ERROR 22007: Incorrect LINESTRING value: 'POINT' for column 'b' at row 1
+DESCRIBE t1;
+Field Type Null Key Default Extra
+a int(11) YES NULL
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result b/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result
index ff32bf694cb..d10727b95b4 100644
--- a/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result
+++ b/mysql-test/suite/innodb/r/innodb_defrag_concurrent.result
@@ -3,7 +3,15 @@ select @@global.innodb_stats_persistent;
@@global.innodb_stats_persistent
0
set global innodb_defragment_stats_accuracy = 80;
-CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c INT, KEY second(a, b),KEY third(c)) ENGINE=INNODB;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b VARCHAR(256),
+c INT,
+g GEOMETRY NOT NULL,
+t VARCHAR(256),
+KEY second(a, b),
+KEY third(c),
+SPATIAL gk(g),
+FULLTEXT INDEX fti(t)) ENGINE=INNODB;
connect con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connect con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connect con3,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
@@ -40,9 +48,9 @@ count(stat_value) > 0
connection con1;
optimize table t1;;
connection default;
-INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000);;
+INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000, Point(1,1),'More like a test but different.');;
connection con2;
-INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000);;
+INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000, Point(1,1),'Totally different text book.');;
connection con3;
DELETE FROM t1 where a between 1 and 100;;
connection con4;
@@ -59,6 +67,9 @@ disconnect con4;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
+check table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 check status OK
select count(*) from t1;
count(*)
15723
diff --git a/mysql-test/suite/innodb/r/log_file_size.result b/mysql-test/suite/innodb/r/log_file_size.result
index b576061e74b..e049b34ad81 100644
--- a/mysql-test/suite/innodb/r/log_file_size.result
+++ b/mysql-test/suite/innodb/r/log_file_size.result
@@ -1,4 +1,12 @@
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+FOUND 1 /InnoDB: Log file .*ib_logfile0 size 0 is too small/ in mysqld.1.err
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
BEGIN;
INSERT INTO t1 VALUES (42);
SELECT * FROM t1;
diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test
index 5e681f96b4a..d936dcad15c 100644
--- a/mysql-test/suite/innodb/t/innodb-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-alter.test
@@ -494,6 +494,34 @@ eval ALTER TABLE $source_db.t1 DROP INDEX index2, algorithm=inplace;
eval DROP TABLE $source_db.t1;
eval DROP DATABASE $source_db;
eval DROP DATABASE $dest_db;
+USE test;
+--echo #
+--echo # MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
+--echo #
+CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
+iNSERT INTO t1 VALUES (10);
+--error ER_WARN_DATA_OUT_OF_RANGE
+ALTER TABLE t1 ADD b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# DATETIME-to-DATE truncation is OK
+CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
+iNSERT INTO t1 VALUES (10);
+--enable_info
+ALTER TABLE t1 ADD b DATE NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# DATETIME-to-TIME truncation is OK
+CREATE TABLE t1 (a INT NOT NULL DEFAULT 0) ENGINE=InnoDB;
+iNSERT INTO t1 VALUES (10);
+--enable_info
+ALTER TABLE t1 ADD b TIME NOT NULL DEFAULT if(unix_timestamp()>1,TIMESTAMP'2001-01-01 10:20:30',0);
+--disable_info
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-online-alter-gis.test b/mysql-test/suite/innodb/t/innodb-online-alter-gis.test
index 64d07ba23aa..2cb88d398bb 100644
--- a/mysql-test/suite/innodb/t/innodb-online-alter-gis.test
+++ b/mysql-test/suite/innodb/t/innodb-online-alter-gis.test
@@ -19,3 +19,13 @@ ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED;
show warnings;
show errors;
drop table t1;
+
+--echo #
+--echo # MDEV-14038 ALTER TABLE does not exit on error with InnoDB + bad default function
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
+DESCRIBE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test b/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test
index f596fab2a15..bbcd72f1a3a 100644
--- a/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test
+++ b/mysql-test/suite/innodb/t/innodb_defrag_concurrent.test
@@ -16,7 +16,26 @@ select @@global.innodb_stats_persistent;
set global innodb_defragment_stats_accuracy = 80;
# Create table.
-CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), c INT, KEY second(a, b),KEY third(c)) ENGINE=INNODB;
+#
+# TODO: Currently we do not defragment spatial indexes,
+# because doing it properly would require
+# appropriate logic around the SSN (split
+# sequence number).
+#
+# Also do not defragment auxiliary tables related to FULLTEXT INDEX.
+#
+# Both types added to this test to make sure they do not cause
+# problems.
+#
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b VARCHAR(256),
+c INT,
+g GEOMETRY NOT NULL,
+t VARCHAR(256),
+KEY second(a, b),
+KEY third(c),
+SPATIAL gk(g),
+FULLTEXT INDEX fti(t)) ENGINE=INNODB;
connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connect (con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
@@ -36,7 +55,7 @@ let $i = $data_size;
while ($i)
{
eval
- INSERT INTO t1 VALUES ($data_size + 1 - $i, REPEAT('A', 256), $i);
+ INSERT INTO t1 VALUES ($data_size + 1 - $i, REPEAT('A', 256), $i, Point($i,$i), 'This is a test message.');
dec $i;
}
--enable_query_log
@@ -69,10 +88,10 @@ connection con1;
--send optimize table t1;
connection default;
---send INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000);
+--send INSERT INTO t1 VALUES (400000, REPEAT('A', 256),300000, Point(1,1),'More like a test but different.');
connection con2;
---send INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000);
+--send INSERT INTO t1 VALUES (500000, REPEAT('A', 256),400000, Point(1,1),'Totally different text book.');
connection con3;
--send DELETE FROM t1 where a between 1 and 100;
@@ -103,6 +122,7 @@ disconnect con3;
disconnect con4;
optimize table t1;
+check table t1 extended;
select count(*) from t1;
select count(*) from t1 force index (second);
diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test
index 206444115fc..140198de4ab 100644
--- a/mysql-test/suite/innodb/t/log_file_size.test
+++ b/mysql-test/suite/innodb/t/log_file_size.test
@@ -23,14 +23,33 @@ call mtr.add_suppression("InnoDB: Log file .*ib_logfile[01].* size");
call mtr.add_suppression("InnoDB: Unable to open .*ib_logfile0. to check native AIO read support");
FLUSH TABLES;
--enable_query_log
+let MYSQLD_DATADIR= `select @@datadir`;
+CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
+
+--source include/shutdown_mysqld.inc
+--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile.old
+write_file $MYSQLD_DATADIR/ib_logfile0;
+EOF
+let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
--let $restart_parameters= --innodb-thread-concurrency=1 --innodb-log-file-size=1m --innodb-log-files-in-group=2
---source include/restart_mysqld.inc
+--source include/start_mysqld.inc
+
+eval $check_no_innodb;
+--remove_file $MYSQLD_DATADIR/ib_logfile0
+--move_file $MYSQLD_DATADIR/ib_logfile.old $MYSQLD_DATADIR/ib_logfile.0
+--source include/shutdown_mysqld.inc
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 0 is too small;
+--source include/search_pattern_in_file.inc
+--source include/start_mysqld.inc
+CHECK TABLE t1;
--let $restart_parameters= --innodb-thread-concurrency=100 --innodb-log-file-size=10M --innodb-log-files-in-group=2
--source include/restart_mysqld.inc
-CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES (42);
@@ -52,9 +71,7 @@ SELECT * FROM t1;
INSERT INTO t1 VALUES (0),(123);
-let MYSQLD_DATADIR= `select @@datadir`;
let SEARCH_ABORT = NOT FOUND;
-let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
BEGIN;
DELETE FROM t1 WHERE a>0;
diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
index 17f1f7e1b06..a945e68aeb1 100644
--- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
@@ -743,3 +743,19 @@ ALTER TABLE t1 ADD SPATIAL INDEX(p);
ALTER TABLE t1 FORCE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
DROP TABLE t1;
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
+set timestamp=10;
+insert into t1 values(default);
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
+drop table t1;
+SET timestamp=default;
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
+set timestamp=10;
+alter table t1 add column i int;
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1
+drop table t1;
+SET timestamp=default;
+CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
+ALTER TABLE t1 ADD COLUMN b POINT DEFAULT '0';
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_gis/t/alter_spatial_index.test b/mysql-test/suite/innodb_gis/t/alter_spatial_index.test
index 2b834ac69a6..703a89b4065 100644
--- a/mysql-test/suite/innodb_gis/t/alter_spatial_index.test
+++ b/mysql-test/suite/innodb_gis/t/alter_spatial_index.test
@@ -743,3 +743,23 @@ ALTER TABLE t1 ADD SPATIAL INDEX(p);
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 FORCE, LOCK=NONE;
DROP TABLE t1;
+
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
+set timestamp=10;
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+insert into t1 values(default);
+drop table t1;
+SET timestamp=default;
+
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
+set timestamp=10;
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+alter table t1 add column i int;
+drop table t1;
+SET timestamp=default;
+
+CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+ALTER TABLE t1 ADD COLUMN b POINT DEFAULT '0';
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/mariabackup/xb_file_key_management.result b/mysql-test/suite/mariabackup/xb_file_key_management.result
index 8972da32f8b..721d10a9d91 100644
--- a/mysql-test/suite/mariabackup/xb_file_key_management.result
+++ b/mysql-test/suite/mariabackup/xb_file_key_management.result
@@ -9,6 +9,7 @@ INSERT INTO t VALUES('foobar2');
# remove datadir
# xtrabackup move back
# restart server
+ib_logfile0
SELECT * FROM t;
c
foobar1
diff --git a/mysql-test/suite/mariabackup/xb_file_key_management.test b/mysql-test/suite/mariabackup/xb_file_key_management.test
index 3887a889aaa..2a176952053 100644
--- a/mysql-test/suite/mariabackup/xb_file_key_management.test
+++ b/mysql-test/suite/mariabackup/xb_file_key_management.test
@@ -24,6 +24,7 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
--enable_result_log
--list_files $targetdir ib_logfile*
+--cat_file $targetdir/ib_logfile0
SELECT * FROM t;
DROP TABLE t;
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index 980bff01694..57b7ae1658f 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -724,3 +724,22 @@ deallocate prepare stmt2;
drop view v1,v2;
drop table t1,t2;
+
+--echo #
+--echo # MDEV-13796: UNION of two materialized CTEs
+--echo #
+
+CREATE TABLE t1 (id int, k int);
+CREATE TABLE t2 (id int);
+INSERT INTO t1 VALUES (3,5), (1,7), (4,3);
+INSERT INTO t2 VALUES (4), (3), (2);
+
+let $q=
+WITH d1 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id),
+ d2 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id)
+SELECT * FROM d1 UNION SELECT * FROM d2;
+
+eval $q;
+eval explain $q;
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test
index a34cede537c..47ed0c3ca75 100644
--- a/mysql-test/t/func_json.test
+++ b/mysql-test/t/func_json.test
@@ -56,6 +56,7 @@ select json_contains('[1, {"a":1}]', '{}');
select json_contains('[1, {"a":1}]', '{"a":1}');
select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
+select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
@@ -163,6 +164,14 @@ drop table t1;
select json_unquote('"abc"');
select json_unquote('abc');
+#
+# MDEV-13703 Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument.
+#
+create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1;
+insert into t1 values ('abc'),('def');
+
+select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1;
+drop table t1;
select json_object("a", json_object("b", "abcd"));
select json_object("a", '{"b": "abcd"}');
@@ -179,6 +188,7 @@ select json_length('{}');
select json_length('[1, 2, {"a": 3}]');
select json_length('{"a": 1, "b": {"c": 30}}', '$.b');
select json_length('{"a": 1, "b": {"c": 30}}');
+select json_length('{}{');
create table json (j INT);
show create table json;
@@ -361,6 +371,12 @@ select json_array(5,json_query('[1,2]','$'));
SELECT JSON_ARRAY('1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú') AS json_data;
SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
+#
+# MDEV-12312 JSON_CONTAINS_PATH does not detect invalid path and returns TRUE.
+#
+
+select json_contains_path('{"foo":"bar"}', 'one', '$[]');
+
--echo #
--echo # Start of 10.3 tests
--echo #
diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test
index 1f8259bb828..07fabae6025 100644
--- a/mysql-test/t/gis-precise.test
+++ b/mysql-test/t/gis-precise.test
@@ -363,5 +363,24 @@ select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT
select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
+# MDEV-12705 10.1.18-MariaDB-1~jessie - mysqld got signal 11.
+SELECT ST_RELATE(
+ ST_DIFFERENCE(
+ GEOMETRYFROMTEXT('
+ MULTILINESTRING(
+ ( 12841 36140, 8005 31007, 26555 31075, 52765 41191,
+ 28978 6548, 45720 32057, 53345 3221 ),
+ ( 8304 59107, 25233 31592, 40502 25303, 8205 42940 ),
+ ( 7829 7305, 58841 56759, 64115 8512, 37562 54145, 2210 14701 ),
+ ( 20379 2805, 40807 27770, 28147 14883, 26439 29383, 55663 5086 ),
+ ( 35944 64702, 14433 23728, 49317 26241, 790 16941 )
+ )
+ '),
+ GEOMETRYFROMTEXT('POINT(46061 13545)')
+ ),
+ GEOMETRYFROMTEXT('POINT(4599 60359)'),
+ 'F*FFFF**F'
+ ) as relate_res;
+
--source include/gis_debug.inc
diff --git a/mysql-test/t/gis2.test b/mysql-test/t/gis2.test
index b734ab19ecd..9731e2a91d0 100644
--- a/mysql-test/t/gis2.test
+++ b/mysql-test/t/gis2.test
@@ -15,3 +15,31 @@ SELECT id FROM t1
WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
DROP TABLE t1;
+#
+# MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field
+#
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+create table t1 (p point default "qwer");
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+create table t1 (p point default 0);
+--error ER_INVALID_DEFAULT
+create table t1 (p point not null default st_geometryfromtext('point 0)'));
+create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
+insert into t1 values(default);
+select st_astext(p) from t1;
+drop table t1;
+
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
+set timestamp=10;
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+insert into t1 values(default);
+drop table t1;
+SET timestamp=default;
+
+create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
+set timestamp=10;
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+alter table t1 add column i int;
+drop table t1;
+SET timestamp=default;
+
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 157b4c69508..417390dcafe 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1861,3 +1861,29 @@ disconnect con1;
--source include/wait_until_count_sessions.inc
set global sql_mode=default;
+
+USE test;
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
+
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+
+--echo #
+--echo # MDEV-13242 Wrong results for queries with row constructors and information_schema
+--echo #
+
+CREATE TABLE tt1(c1 INT);
+CREATE TABLE tt2(c2 INT);
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1', 'c1'));
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt2', 'c2'));
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2'));
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (SELECT 'tt1','c1' FROM dual UNION SELECT 'tt2', 'c2' FROM dual);
+SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name='tt1' AND column_name='c1') OR (table_name='tt2' AND column_name='c2');
+SELECT column_name FROM information_schema.columns WHERE (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2')) ORDER BY column_name;
+DROP TABLE tt1, tt2;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 4e8cee75d63..2d7c4428507 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -534,5 +534,20 @@ show create table t1;
drop table if exists t1;
--echo #
+--echo # MDEV-11586 UNION of FLOAT type results in erroneous precision
+--echo #
+
+CREATE TABLE t1 (f FLOAT);
+INSERT INTO t1 VALUES (1.1);
+SELECT f FROM t1 UNION SELECT 1;
+SELECT 1 UNION SELECT f FROM t1;
+SELECT f FROM t1 UNION SELECT 2147483647;
+SELECT 2147483647 UNION SELECT f FROM t1;
+SELECT CASE WHEN 0 THEN (SELECT f FROM t1) ELSE 2147483647 END AS c1,
+ CASE WHEN 1 THEN 2147483647 ELSE (SELECT f FROM t1) END AS c2;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.2 tests
--echo #