1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.7' into 10.8

This commit is contained in:
Oleksandr Byelkin
2022-02-04 14:50:25 +01:00
907 changed files with 20182 additions and 6211 deletions

View File

@@ -958,5 +958,32 @@ Warnings:
Warning 1264 Out of range value for column 'converted' at row 2
Warning 1366 Incorrect integer value: 'foo' for column ``.`(temporary)`.`converted` at row 3
#
# MDEV-27696 Json table columns accept redundant COLLATE syntax
#
SELECT * FROM json_table('[{"name":"str"}]', '$[*]'
COLUMNS (
name BLOB COLLATE `binary` PATH '$.name'
)
) AS jt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLLATE `binary` PATH '$.name'
)
) AS jt' at line 3
SELECT * FROM json_table('[{"name":"str"}]', '$[*]'
COLUMNS (
name VARCHAR(10) COLLATE latin1_bin COLLATE latin1_swedish_ci PATH '$.name'
)
) AS jt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLLATE latin1_swedish_ci PATH '$.name'
)
) AS jt' at line 3
SELECT * FROM json_table('[{"name":"str"}]', '$[*]'
COLUMNS (
name VARCHAR(10) BINARY COLLATE utf8_czech_ci path '$.name'
)
) AS jt;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLLATE utf8_czech_ci path '$.name'
)
) AS jt' at line 3
#
# End of 10.6 tests
#

View File

@@ -0,0 +1,22 @@
include/master-slave.inc
[connection master]
#
# Start of 10.5 tests
#
#
# MDEV-27018 IF and COALESCE lose "json" property
#
CREATE TABLE t1 (a CHAR(100) CHECK(JSON_VALID(a)));
connection slave;
connection master;
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
connection slave;
SELECT * FROM t1 ORDER BY a;
a
{"a": "b"}
connection master;
DROP TABLE t1;
#
# End of 10.5 tests
#
include/rpl_end.inc

View File

@@ -0,0 +1,22 @@
include/master-slave.inc
[connection master]
#
# Start of 10.5 tests
#
#
# MDEV-27018 IF and COALESCE lose "json" property
#
CREATE TABLE t1 (a LONGTEXT CHECK(JSON_VALID(a)));
connection slave;
connection master;
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
connection slave;
SELECT * FROM t1 ORDER BY a;
a
{"a": "b"}
connection master;
DROP TABLE t1;
#
# End of 10.5 tests
#
include/rpl_end.inc

View File

@@ -0,0 +1,22 @@
include/master-slave.inc
[connection master]
#
# Start of 10.5 tests
#
#
# MDEV-27018 IF and COALESCE lose "json" property
#
CREATE TABLE t1 (a MEDIUMTEXT CHECK(JSON_VALID(a)));
connection slave;
connection master;
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
connection slave;
SELECT * FROM t1 ORDER BY a;
a
{"a": "b"}
connection master;
DROP TABLE t1;
#
# End of 10.5 tests
#
include/rpl_end.inc

View File

@@ -0,0 +1,22 @@
include/master-slave.inc
[connection master]
#
# Start of 10.5 tests
#
#
# MDEV-27018 IF and COALESCE lose "json" property
#
CREATE TABLE t1 (a TEXT CHECK(JSON_VALID(a)));
connection slave;
connection master;
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
connection slave;
SELECT * FROM t1 ORDER BY a;
a
{"a": "b"}
connection master;
DROP TABLE t1;
#
# End of 10.5 tests
#
include/rpl_end.inc

View File

@@ -0,0 +1,22 @@
include/master-slave.inc
[connection master]
#
# Start of 10.5 tests
#
#
# MDEV-27018 IF and COALESCE lose "json" property
#
CREATE TABLE t1 (a TINYTEXT CHECK(JSON_VALID(a)));
connection slave;
connection master;
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
connection slave;
SELECT * FROM t1 ORDER BY a;
a
{"a": "b"}
connection master;
DROP TABLE t1;
#
# End of 10.5 tests
#
include/rpl_end.inc

View File

@@ -0,0 +1,22 @@
include/master-slave.inc
[connection master]
#
# Start of 10.5 tests
#
#
# MDEV-27018 IF and COALESCE lose "json" property
#
CREATE TABLE t1 (a VARCHAR(100) CHECK(JSON_VALID(a)));
connection slave;
connection master;
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
connection slave;
SELECT * FROM t1 ORDER BY a;
a
{"a": "b"}
connection master;
DROP TABLE t1;
#
# End of 10.5 tests
#
include/rpl_end.inc

File diff suppressed because it is too large Load Diff

View File

@@ -814,6 +814,34 @@ select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted
select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by original;
--echo #
--echo # MDEV-27696 Json table columns accept redundant COLLATE syntax
--echo #
--error ER_PARSE_ERROR
SELECT * FROM json_table('[{"name":"str"}]', '$[*]'
COLUMNS (
name BLOB COLLATE `binary` PATH '$.name'
)
) AS jt;
--error ER_PARSE_ERROR
SELECT * FROM json_table('[{"name":"str"}]', '$[*]'
COLUMNS (
name VARCHAR(10) COLLATE latin1_bin COLLATE latin1_swedish_ci PATH '$.name'
)
) AS jt;
--error ER_PARSE_ERROR
SELECT * FROM json_table('[{"name":"str"}]', '$[*]'
COLUMNS (
name VARCHAR(10) BINARY COLLATE utf8_czech_ci path '$.name'
)
) AS jt;
--echo #
--echo # End of 10.6 tests
--echo #

View File

@@ -0,0 +1,27 @@
--source include/master-slave.inc
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-27018 IF and COALESCE lose "json" property
--echo #
CREATE TABLE t1 (a CHAR(100) CHECK(JSON_VALID(a)));
--sync_slave_with_master
--connection master
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
--sync_slave_with_master
SELECT * FROM t1 ORDER BY a;
--connection master
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #
--source include/rpl_end.inc

View File

@@ -0,0 +1,27 @@
--source include/master-slave.inc
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-27018 IF and COALESCE lose "json" property
--echo #
CREATE TABLE t1 (a LONGTEXT CHECK(JSON_VALID(a)));
--sync_slave_with_master
--connection master
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
--sync_slave_with_master
SELECT * FROM t1 ORDER BY a;
--connection master
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #
--source include/rpl_end.inc

View File

@@ -0,0 +1,27 @@
--source include/master-slave.inc
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-27018 IF and COALESCE lose "json" property
--echo #
CREATE TABLE t1 (a MEDIUMTEXT CHECK(JSON_VALID(a)));
--sync_slave_with_master
--connection master
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
--sync_slave_with_master
SELECT * FROM t1 ORDER BY a;
--connection master
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #
--source include/rpl_end.inc

View File

@@ -0,0 +1,27 @@
--source include/master-slave.inc
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-27018 IF and COALESCE lose "json" property
--echo #
CREATE TABLE t1 (a TEXT CHECK(JSON_VALID(a)));
--sync_slave_with_master
--connection master
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
--sync_slave_with_master
SELECT * FROM t1 ORDER BY a;
--connection master
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #
--source include/rpl_end.inc

View File

@@ -0,0 +1,27 @@
--source include/master-slave.inc
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-27018 IF and COALESCE lose "json" property
--echo #
CREATE TABLE t1 (a TINYTEXT CHECK(JSON_VALID(a)));
--sync_slave_with_master
--connection master
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
--sync_slave_with_master
SELECT * FROM t1 ORDER BY a;
--connection master
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #
--source include/rpl_end.inc

View File

@@ -0,0 +1,27 @@
--source include/master-slave.inc
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-27018 IF and COALESCE lose "json" property
--echo #
CREATE TABLE t1 (a VARCHAR(100) CHECK(JSON_VALID(a)));
--sync_slave_with_master
--connection master
INSERT INTO t1 VALUES (JSON_OBJECT('a','b'));
--sync_slave_with_master
SELECT * FROM t1 ORDER BY a;
--connection master
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #
--source include/rpl_end.inc

View File

@@ -0,0 +1,143 @@
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-27361 Hybrid functions with JSON arguments do not send format metadata
--echo #
# Mix all columns in the given table tbl to each other and calculate expr.
DELIMITER $$;
CREATE PROCEDURE p1(tbl TEXT, expr TEXT)
BEGIN
DECLARE t1cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME=tbl AND TABLE_SCHEMA='test');
FOR a IN 0..(t1cols-1) DO
FOR b IN 0..(t1cols-1) DO
BEGIN
DECLARE query TEXT DEFAULT CONCAT('SELECT ', expr, ' FROM ', tbl);
SET query= REPLACE(query, 'olt1', a);
SET query= REPLACE(query, 'olt2', b);
EXECUTE IMMEDIATE query;
END;
END FOR;
END FOR;
END;
$$
DELIMITER ;$$
# Mix all columns in table t1 to all columns in table t2 and calculate expr
DELIMITER $$;
CREATE PROCEDURE p2(expr TEXT)
BEGIN
DECLARE t1cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
DECLARE t2cols INT DEFAULT (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='t2' AND TABLE_SCHEMA='test');
FOR a IN 0..(t1cols-1) DO
FOR b IN 0..(t2cols-1) DO
BEGIN
DECLARE query TEXT DEFAULT CONCAT('SELECT ', expr, ' FROM t1, t2');
SET query= REPLACE(query, 'olt1', a);
SET query= REPLACE(query, 'olt2', b);
EXECUTE IMMEDIATE query;
END;
END FOR;
END FOR;
END;
$$
DELIMITER ;$$
CREATE TABLE t1
(
c0 CHAR(30) DEFAULT '1' CHECK(JSON_VALID(c0)),
c1 VARCHAR(30) DEFAULT '1' CHECK(JSON_VALID(c1)),
c2 TINYTEXT DEFAULT '1' CHECK(JSON_VALID(c2)),
c3 TEXT DEFAULT '1' CHECK(JSON_VALID(c3)),
c4 MEDIUMTEXT DEFAULT '1' CHECK(JSON_VALID(c4)),
c5 LONGTEXT DEFAULT '1' CHECK(JSON_VALID(c5)),
# The below data types do not have any special JSON properties.
# Just checking CHECK(JSON_VALID()) does not give any unexpected surprises.
c6 INT DEFAULT '1' CHECK(JSON_VALID(c6)),
c7 ENUM('1') DEFAULT '1' CHECK(JSON_VALID(c7))
);
INSERT INTO t1 VALUES ();
CREATE TABLE t1c
(
c0 CHAR(30) DEFAULT '1' CHECK(JSON_VALID(c0)),
c1 VARCHAR(30) COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c1)),
c2 TINYTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c2)),
c3 TEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c3)),
c4 MEDIUMTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c4)),
c5 LONGTEXT COMPRESSED DEFAULT '1' CHECK(JSON_VALID(c5)),
# The below data types do not have any special JSON properties.
# Just checking CHECK(JSON_VALID()) does not give any unexpected surprises.
c6 INT DEFAULT '1' CHECK(JSON_VALID(c6)),
c7 ENUM('1') DEFAULT '1' CHECK(JSON_VALID(c7))
);
INSERT INTO t1c VALUES ();
CREATE TABLE t2
(
c0 CHAR(30) DEFAULT '1',
c1 VARCHAR(30) DEFAULT '1',
c2 TINYTEXT DEFAULT '1',
c3 TEXT DEFAULT '1',
c4 MEDIUMTEXT DEFAULT '1',
c5 LONGTEXT DEFAULT '1',
c6 INT DEFAULT 1,
c7 DOUBLE DEFAULT 1,
c8 DECIMAL(10,2) DEFAULT 1.23,
c9 TIME DEFAULT '10:20:30',
c10 DATE DEFAULT '2001-01-01',
c11 DATETIME DEFAULT '2001-01-01 10:20:30',
c12 ENUM('1','2') DEFAULT '1'
);
INSERT INTO t2 VALUES ();
--disable_ps_protocol
--enable_metadata
CALL p1('t1', 'COALESCE(colt1, colt2)');
CALL p1('t1', 'LEAST(colt1, colt2)');
CALL p1('t1', 'colt1+colt2');
--disable_metadata
--disable_ps_protocol
--disable_ps_protocol
--enable_metadata
CALL p1('t1c', 'COALESCE(colt1, colt2)');
CALL p1('t1c', 'LEAST(colt1, colt2)');
CALL p1('t1c', 'colt1+colt2');
--disable_metadata
--disable_ps_protocol
--disable_ps_protocol
--enable_metadata
CALL p2('COALESCE(t1.colt1, t2.colt2)');
CALL p2('LEAST(t1.colt1, t2.colt2)');
CALL p2('t1.colt1+t2.colt2');
--disable_metadata
--disable_ps_protocol
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP TABLE t1, t1c, t2;
--echo #
--echo # End of 10.5 tests
--echo #