mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge 10.4 into 10.5
This commit is contained in:
@@ -3042,6 +3042,122 @@ a
|
||||
3
|
||||
2
|
||||
drop table t1,t2,t3;
|
||||
#
|
||||
# MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of
|
||||
# IN/ALL/ANY/EXISTS subquery
|
||||
#
|
||||
create table t1 (a int);
|
||||
create table t2 (b int);
|
||||
create table t3 (c int);
|
||||
create table t4 (d int);
|
||||
insert into t1 values (3), (1);
|
||||
insert into t2 values (3), (2);
|
||||
insert into t3 values (4), (2);
|
||||
insert into t4 values (1), (7);
|
||||
explain extended select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) in (select d from t4));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
|
||||
select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) in (select d from t4));
|
||||
b
|
||||
3
|
||||
2
|
||||
prepare stmt from "select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) in (select d from t4))";
|
||||
execute stmt;
|
||||
b
|
||||
3
|
||||
2
|
||||
execute stmt;
|
||||
b
|
||||
3
|
||||
2
|
||||
deallocate prepare stmt;
|
||||
explain extended select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) >=
|
||||
any (select d from t4));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
|
||||
select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) >=
|
||||
any (select d from t4));
|
||||
b
|
||||
3
|
||||
2
|
||||
explain extended select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) <
|
||||
all (select d from t4));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where 1
|
||||
select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) <
|
||||
all (select d from t4));
|
||||
b
|
||||
3
|
||||
2
|
||||
explain extended select b from t2
|
||||
where b in (select c from t3
|
||||
group by (select a from t1 where a = 1) in (select d from t4));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
|
||||
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`b` AS `b` from `test`.`t2` semi join (`test`.`t3`) where 1
|
||||
select b from t2
|
||||
where b in (select c from t3
|
||||
group by (select a from t1 where a = 1) in (select d from t4));
|
||||
b
|
||||
2
|
||||
explain extended select b from t2
|
||||
where b >= any (select c from t3
|
||||
group by (select a from t1 where a = 1) in
|
||||
(select d from t4));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <nop>(<in_optimizer>(`test`.`t2`.`b`,(/* select#2 */ select min(`test`.`t3`.`c`) from `test`.`t3`) <= <cache>(`test`.`t2`.`b`)))
|
||||
select b from t2
|
||||
where b >= any (select c from t3
|
||||
group by (select a from t1 where a = 1) in
|
||||
(select d from t4));
|
||||
b
|
||||
3
|
||||
2
|
||||
explain extended select b from t2
|
||||
where b <= all (select c from t3
|
||||
group by (select a from t1 where a = 1) in
|
||||
(select d from t4));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` where <not>(<in_optimizer>(`test`.`t2`.`b`,<min>(/* select#2 */ select `test`.`t3`.`c` from `test`.`t3`) < <cache>(`test`.`t2`.`b`)))
|
||||
select b from t2
|
||||
where b <= all (select c from t3
|
||||
group by (select a from t1 where a = 1) in
|
||||
(select d from t4));
|
||||
b
|
||||
2
|
||||
drop table t1,t2,t3,t4;
|
||||
# End of 10.3 tests
|
||||
#
|
||||
# MDEV-19134: EXISTS() slower if ORDER BY is defined
|
||||
|
@@ -2479,6 +2479,80 @@ eval $q3;
|
||||
|
||||
drop table t1,t2,t3;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29139: Redundant IN/ALL/ANY predicand in GROUP BY clause of
|
||||
--echo # IN/ALL/ANY/EXISTS subquery
|
||||
--echo #
|
||||
|
||||
create table t1 (a int);
|
||||
create table t2 (b int);
|
||||
create table t3 (c int);
|
||||
create table t4 (d int);
|
||||
|
||||
insert into t1 values (3), (1);
|
||||
insert into t2 values (3), (2);
|
||||
insert into t3 values (4), (2);
|
||||
insert into t4 values (1), (7);
|
||||
|
||||
let $q1=
|
||||
select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) in (select d from t4));
|
||||
|
||||
eval explain extended $q1;
|
||||
eval $q1;
|
||||
|
||||
eval prepare stmt from "$q1";
|
||||
execute stmt;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
|
||||
let $q2=
|
||||
select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) >=
|
||||
any (select d from t4));
|
||||
|
||||
eval explain extended $q2;
|
||||
eval $q2;
|
||||
|
||||
let $q3=
|
||||
select b from t2
|
||||
where exists (select c from t3
|
||||
group by (select a from t1 where a = 1) <
|
||||
all (select d from t4));
|
||||
|
||||
eval explain extended $q3;
|
||||
eval $q3;
|
||||
|
||||
let $q4=
|
||||
select b from t2
|
||||
where b in (select c from t3
|
||||
group by (select a from t1 where a = 1) in (select d from t4));
|
||||
|
||||
eval explain extended $q4;
|
||||
eval $q4;
|
||||
|
||||
let $q5=
|
||||
select b from t2
|
||||
where b >= any (select c from t3
|
||||
group by (select a from t1 where a = 1) in
|
||||
(select d from t4));
|
||||
|
||||
eval explain extended $q5;
|
||||
eval $q5;
|
||||
|
||||
let $q6=
|
||||
select b from t2
|
||||
where b <= all (select c from t3
|
||||
group by (select a from t1 where a = 1) in
|
||||
(select d from t4));
|
||||
|
||||
eval explain extended $q6;
|
||||
eval $q6;
|
||||
|
||||
drop table t1,t2,t3,t4;
|
||||
|
||||
--echo # End of 10.3 tests
|
||||
|
||||
--echo #
|
||||
|
@@ -11,6 +11,21 @@ CREATE TABLE `d255`.`_##################################################`
|
||||
ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023/_@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023
|
||||
CREATE TABLE `d255`.`##################################################`
|
||||
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;
|
||||
#
|
||||
# MDEV-29258 Failing assertion for name length on RENAME TABLE
|
||||
#
|
||||
CREATE TABLE `d255`.`d245` (x INT) ENGINE=InnoDB;
|
||||
DROP TABLE `d255`.`d250`;
|
||||
RENAME TABLE `d250#`.`d245` TO `d250#`.`d250`;
|
||||
RENAME TABLE `d255`.`d250` TO a;
|
||||
DROP TABLE a,t;
|
||||
#
|
||||
# MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE
|
||||
#
|
||||
CREATE TABLE `d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB;
|
||||
CREATE TABLE `d255`.u(a INT PRIMARY KEY,
|
||||
CONSTRAINT `d320` FOREIGN KEY (a) REFERENCES `d255`.t (a)) ENGINE=InnoDB;
|
||||
RENAME TABLE `d255`.u TO u;
|
||||
DROP TABLE u;
|
||||
DROP DATABASE `d255`;
|
||||
DROP TABLE t;
|
||||
# End of 10.3 tests
|
||||
|
@@ -38,8 +38,40 @@ eval CREATE TABLE `$d255`.`_$d250`
|
||||
--replace_result $d255 d255
|
||||
eval CREATE TABLE `$d255`.`$d250`
|
||||
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29258 Failing assertion for name length on RENAME TABLE
|
||||
--echo #
|
||||
|
||||
let $d245=-------------------------------------------------;
|
||||
--replace_result $d245 d245 $d255 d255
|
||||
eval CREATE TABLE `$d255`.`$d245` (x INT) ENGINE=InnoDB;
|
||||
--replace_result $d250 d250 $d255 d255
|
||||
eval DROP TABLE `$d255`.`$d250`;
|
||||
|
||||
--replace_result $d245 d245 $d250 d250 d255 d255
|
||||
eval RENAME TABLE `$d255`.`$d245` TO `$d255`.`$d250`;
|
||||
--replace_result $d250 d250 $d255 d255
|
||||
eval RENAME TABLE `$d255`.`$d250` TO a;
|
||||
--replace_result $d255 d255
|
||||
DROP TABLE a,t;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE
|
||||
--echo #
|
||||
|
||||
let $d225=#############################################;
|
||||
let $d320=################################################################;
|
||||
|
||||
--replace_result $d255 d255
|
||||
eval CREATE TABLE `$d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB;
|
||||
--replace_result $d255 d255 $d320 d320
|
||||
eval CREATE TABLE `$d255`.u(a INT PRIMARY KEY,
|
||||
CONSTRAINT `$d320` FOREIGN KEY (a) REFERENCES `$d255`.t (a)) ENGINE=InnoDB;
|
||||
--replace_result $d255 d255
|
||||
eval RENAME TABLE `$d255`.u TO u;
|
||||
DROP TABLE u;
|
||||
--replace_result $d255 d255
|
||||
eval DROP DATABASE `$d255`;
|
||||
DROP TABLE t;
|
||||
|
||||
--echo # End of 10.3 tests
|
||||
|
@@ -78,10 +78,10 @@ let $counter= 80;
|
||||
let $mysql_errno= 0;
|
||||
while (!$mysql_errno)
|
||||
{
|
||||
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013
|
||||
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014
|
||||
show status;
|
||||
|
||||
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013
|
||||
--error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014
|
||||
select * from information_schema.innodb_sys_semaphore_waits;
|
||||
|
||||
dec $counter;
|
||||
|
@@ -1,4 +1,5 @@
|
||||
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
|
||||
FLUSH TABLES;
|
||||
# Test Part 1: Grammar Test
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
@@ -31,7 +32,7 @@ INSERT INTO articles (title, body) VALUES
|
||||
('1001 MySQL Tricks','How to use full-text search engine'),
|
||||
('Go MySQL Tricks','How to use full text search engine');
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('mysql');
|
||||
MATCH(title, body) AGAINST('mysql') ORDER BY id;
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
@@ -68,7 +69,7 @@ INSERT INTO articles (title, body) VALUES
|
||||
('Go MySQL Tricks','How to use full text search engine');
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('mysql');
|
||||
MATCH(title, body) AGAINST('mysql') ORDER BY id;
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
@@ -88,21 +89,23 @@ MATCH(title, body) AGAINST('full text');
|
||||
id title body
|
||||
5 Go MySQL Tricks How to use full text search engine
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION);
|
||||
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION)
|
||||
ORDER BY id;
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks How to use full-text search engine
|
||||
5 Go MySQL Tricks How to use full text search engine
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION);
|
||||
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION)
|
||||
ORDER BY id;
|
||||
id title body
|
||||
5 Go MySQL Tricks How to use full text search engine
|
||||
4 1001 MySQL Tricks How to use full-text search engine
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks How to use full-text search engine
|
||||
5 Go MySQL Tricks How to use full text search engine
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
|
||||
id title body
|
||||
@@ -137,27 +140,27 @@ INSERT INTO articles (title, body) VALUES
|
||||
('Go MariaDB Tricks','How to use full text search engine');
|
||||
# restart
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('MySQL');
|
||||
MATCH(title, body) AGAINST('MySQL') ORDER BY id;
|
||||
id title body
|
||||
6 MySQL Tutorial DBMS stands for MySQL DataBase ...
|
||||
7 How To Use MySQL Well After you went through a ...
|
||||
8 Optimizing MySQL In this tutorial we will show ...
|
||||
9 1001 MySQL Tricks How to use full-text search engine
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('tutorial');
|
||||
MATCH(title, body) AGAINST('tutorial') ORDER BY id;
|
||||
id title body
|
||||
6 MySQL Tutorial DBMS stands for MySQL DataBase ...
|
||||
8 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('Tricks');
|
||||
MATCH(title, body) AGAINST('Tricks') ORDER BY id;
|
||||
id title body
|
||||
9 1001 MySQL Tricks How to use full-text search engine
|
||||
10 Go MariaDB Tricks How to use full text search engine
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('full text search');
|
||||
MATCH(title, body) AGAINST('full text search') ORDER BY id;
|
||||
id title body
|
||||
10 Go MariaDB Tricks How to use full text search engine
|
||||
9 1001 MySQL Tricks How to use full-text search engine
|
||||
10 Go MariaDB Tricks How to use full text search engine
|
||||
SELECT COUNT(*) FROM articles;
|
||||
COUNT(*)
|
||||
5
|
||||
@@ -185,7 +188,8 @@ UNINSTALL PLUGIN simple_parser;
|
||||
Warnings:
|
||||
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('mysql');
|
||||
MATCH(title, body) AGAINST('mysql')
|
||||
ORDER BY id;
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
|
@@ -6,6 +6,9 @@
|
||||
# Install fts parser plugin
|
||||
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
|
||||
|
||||
# Flush the table mysql.plugin in case the server shutdown would time out.
|
||||
FLUSH TABLES;
|
||||
|
||||
-- echo # Test Part 1: Grammar Test
|
||||
# Create a myisam table and alter it to innodb table
|
||||
CREATE TABLE articles (
|
||||
@@ -52,7 +55,7 @@ INSERT INTO articles (title, body) VALUES
|
||||
|
||||
# Simple term search
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('mysql');
|
||||
MATCH(title, body) AGAINST('mysql') ORDER BY id;
|
||||
|
||||
# Test stopword and word len less than fts_min_token_size
|
||||
SELECT * FROM articles WHERE
|
||||
@@ -90,7 +93,7 @@ ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
|
||||
|
||||
# Simple term search
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('mysql');
|
||||
MATCH(title, body) AGAINST('mysql') ORDER BY id;
|
||||
|
||||
# Test stopword and word len less than fts_min_token_size
|
||||
SELECT * FROM articles WHERE
|
||||
@@ -105,10 +108,12 @@ SELECT * FROM articles WHERE
|
||||
|
||||
# Test query expansion
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION);
|
||||
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION)
|
||||
ORDER BY id;
|
||||
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION);
|
||||
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION)
|
||||
ORDER BY id;
|
||||
|
||||
# No result here, we get '"mysql' 'database"' by simple parser
|
||||
SELECT * FROM articles WHERE
|
||||
@@ -150,13 +155,13 @@ INSERT INTO articles (title, body) VALUES
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('MySQL');
|
||||
MATCH(title, body) AGAINST('MySQL') ORDER BY id;
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('tutorial');
|
||||
MATCH(title, body) AGAINST('tutorial') ORDER BY id;
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('Tricks');
|
||||
MATCH(title, body) AGAINST('Tricks') ORDER BY id;
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('full text search');
|
||||
MATCH(title, body) AGAINST('full text search') ORDER BY id;
|
||||
SELECT COUNT(*) FROM articles;
|
||||
|
||||
INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234');
|
||||
@@ -193,7 +198,8 @@ UNINSTALL PLUGIN simple_parser;
|
||||
|
||||
# Simple term search
|
||||
SELECT * FROM articles WHERE
|
||||
MATCH(title, body) AGAINST('mysql');
|
||||
MATCH(title, body) AGAINST('mysql')
|
||||
ORDER BY id;
|
||||
|
||||
# Test stopword and word len less than fts_min_token_size
|
||||
SELECT * FROM articles WHERE
|
||||
|
@@ -191,6 +191,20 @@ ERROR 23000: Duplicate entry '1-2020-03-01-2020-03-02' for key 'PRIMARY'
|
||||
alter table t1 add system versioning;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-18873 Server crashes in Compare_identifiers::operator or in
|
||||
# my_strcasecmp_utf8 upon ADD PERIOD IF NOT EXISTS with empty name
|
||||
#
|
||||
alter table t add period if not exists for `` (s,e);
|
||||
ERROR 42000: Incorrect column name ''
|
||||
create table t(s DATE, e DATE);
|
||||
alter table t add period if not exists for `` (s,e);
|
||||
ERROR 42000: Incorrect column name ''
|
||||
alter table t add period if not exists for ` ` (s,e);
|
||||
ERROR 42000: Incorrect column name ' '
|
||||
create table t2 (period for `` (s,e)) select * from t;
|
||||
ERROR 42000: Incorrect column name ''
|
||||
drop table t;
|
||||
#
|
||||
# MDEV-21941 RENAME doesn't work for system time or period fields
|
||||
#
|
||||
create or replace table t1 (
|
||||
|
@@ -152,6 +152,29 @@ alter table t1 add system versioning;
|
||||
# cleanup
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18873 Server crashes in Compare_identifiers::operator or in
|
||||
--echo # my_strcasecmp_utf8 upon ADD PERIOD IF NOT EXISTS with empty name
|
||||
--echo #
|
||||
|
||||
# When there is no table defined.
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
alter table t add period if not exists for `` (s,e);
|
||||
|
||||
# When there is an actual table.
|
||||
create table t(s DATE, e DATE);
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
alter table t add period if not exists for `` (s,e);
|
||||
|
||||
# When the last character is space
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
alter table t add period if not exists for ` ` (s,e);
|
||||
|
||||
# Create table with an empty period name
|
||||
--error ER_WRONG_COLUMN_NAME
|
||||
create table t2 (period for `` (s,e)) select * from t;
|
||||
drop table t;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-21941 RENAME doesn't work for system time or period fields
|
||||
--echo #
|
||||
|
@@ -388,7 +388,8 @@ bool Item_subselect::mark_as_eliminated_processor(void *arg)
|
||||
bool Item_subselect::eliminate_subselect_processor(void *arg)
|
||||
{
|
||||
unit->item= NULL;
|
||||
unit->exclude();
|
||||
if (!unit->is_excluded())
|
||||
unit->exclude();
|
||||
eliminated= TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "item.h"
|
||||
#include "sql_limit.h" // Select_limit_counters
|
||||
#include "sql_schema.h"
|
||||
#include "table.h"
|
||||
|
||||
/* Used for flags of nesting constructs */
|
||||
#define SELECT_NESTING_MAP_SIZE 64
|
||||
@@ -4545,6 +4546,11 @@ public:
|
||||
|
||||
int add_period(Lex_ident name, Lex_ident_sys_st start, Lex_ident_sys_st end)
|
||||
{
|
||||
if (check_period_name(name.str)) {
|
||||
my_error(ER_WRONG_COLUMN_NAME, MYF(0), name.str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (lex_string_cmp(system_charset_info, &start, &end) == 0)
|
||||
{
|
||||
my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), start.str);
|
||||
|
@@ -4836,7 +4836,8 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
|
||||
int
|
||||
rename_file_ext(const char * from,const char * to,const char * ext)
|
||||
{
|
||||
char from_b[FN_REFLEN],to_b[FN_REFLEN];
|
||||
/* Reserve space for ./databasename/tablename.frm + NUL byte */
|
||||
char from_b[2 + FN_REFLEN + 4 + 1], to_b[2 + FN_REFLEN + 4 + 1];
|
||||
(void) strxmov(from_b,from,ext,NullS);
|
||||
(void) strxmov(to_b,to,ext,NullS);
|
||||
return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0));
|
||||
@@ -5091,6 +5092,12 @@ bool check_column_name(const char *name)
|
||||
}
|
||||
|
||||
|
||||
bool check_period_name(const char *name)
|
||||
{
|
||||
return check_column_name(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Checks whether a table is intact. Should be done *just* after the table has
|
||||
been opened.
|
||||
|
@@ -3187,6 +3187,7 @@ void open_table_error(TABLE_SHARE *share, enum open_frm_error error,
|
||||
void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
|
||||
bool check_db_name(LEX_STRING *db);
|
||||
bool check_column_name(const char *name);
|
||||
bool check_period_name(const char *name);
|
||||
bool check_table_name(const char *name, size_t length, bool check_for_path_chars);
|
||||
int rename_file_ext(const char * from,const char * to,const char * ext);
|
||||
char *get_field(MEM_ROOT *mem, Field *field);
|
||||
|
@@ -40,6 +40,8 @@ struct Compare_identifiers
|
||||
{
|
||||
int operator()(const LEX_CSTRING& a, const LEX_CSTRING& b) const
|
||||
{
|
||||
DBUG_ASSERT(a.str != NULL);
|
||||
DBUG_ASSERT(b.str != NULL);
|
||||
DBUG_ASSERT(a.str[a.length] == 0);
|
||||
DBUG_ASSERT(b.str[b.length] == 0);
|
||||
return my_strcasecmp(system_charset_info, a.str, b.str);
|
||||
|
@@ -1682,7 +1682,7 @@ dict_table_rename_in_cache(
|
||||
in UTF-8 charset. The variable fkid here is used
|
||||
to store foreign key constraint name in charset
|
||||
my_charset_filename for comparison further below. */
|
||||
char fkid[MAX_TABLE_NAME_LEN+20];
|
||||
char fkid[MAX_TABLE_NAME_LEN * 2 + 20];
|
||||
ibool on_tmp = FALSE;
|
||||
|
||||
/* The old table name in my_charset_filename is stored
|
||||
@@ -1716,7 +1716,8 @@ dict_table_rename_in_cache(
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(fkid, foreign->id, MAX_TABLE_NAME_LEN);
|
||||
strncpy(fkid, foreign->id, (sizeof fkid) - 1);
|
||||
fkid[(sizeof fkid) - 1] = '\0';
|
||||
|
||||
if (strstr(fkid, TEMP_TABLE_PATH_PREFIX) == NULL) {
|
||||
innobase_convert_to_filename_charset(
|
||||
@@ -3555,10 +3556,11 @@ dict_table_get_highest_foreign_id(
|
||||
for (dict_foreign_set::iterator it = table->foreign_set.begin();
|
||||
it != table->foreign_set.end();
|
||||
++it) {
|
||||
char fkid[MAX_TABLE_NAME_LEN+20];
|
||||
char fkid[MAX_TABLE_NAME_LEN * 2 + 20];
|
||||
foreign = *it;
|
||||
|
||||
strcpy(fkid, foreign->id);
|
||||
strncpy(fkid, foreign->id, (sizeof fkid) - 1);
|
||||
fkid[(sizeof fkid) - 1] = '\0';
|
||||
/* Convert foreign key identifier on dictionary memory
|
||||
cache to filename charset. */
|
||||
innobase_convert_to_filename_charset(
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2019, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2021, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2022, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@@ -1862,9 +1862,9 @@ trx_undo_page_report_rename(trx_t* trx, const dict_table_t* table,
|
||||
byte* const start = block->frame + first_free;
|
||||
size_t len = strlen(table->name.m_name);
|
||||
const size_t fixed = 2 + 1 + 11 + 11 + 2;
|
||||
ut_ad(len <= NAME_LEN * 2 + 1);
|
||||
ut_ad(len <= NAME_CHAR_LEN * 5 * 2 + 1);
|
||||
/* The -10 is used in trx_undo_left() */
|
||||
compile_time_assert((NAME_LEN * 1) * 2 + fixed
|
||||
compile_time_assert(NAME_CHAR_LEN * 5 * 2 + fixed
|
||||
+ TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE
|
||||
< UNIV_PAGE_SIZE_MIN - 10 - FIL_PAGE_DATA_END);
|
||||
|
||||
|
Reference in New Issue
Block a user