Skip to content

Commit

Permalink
MDEV-27691: make working view-protocol
Browse files Browse the repository at this point in the history
Update tests for version 10.6
  • Loading branch information
mariadb-lenastartseva committed Sep 27, 2022
1 parent f8f25b4 commit a996258
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 5 deletions.
3 changes: 3 additions & 0 deletions mysql-test/main/binary.test
Expand Up @@ -18,9 +18,12 @@ select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) f
select * from t2 order by name;
select concat("*",name,"*") from t2 order by 1;
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
#check after fix MDEV-29601
--disable_service_connection
select name from t1 where name between '�' and '�';
select name from t2 where name between '�' and '�';
select name from t2 where name between '�' and '�';
--enable_service_connection

drop table t1,t2;

Expand Down
11 changes: 9 additions & 2 deletions mysql-test/main/fetch_first.test
Expand Up @@ -16,6 +16,8 @@ insert into t_keyword values (1), (1), (2), (3), (2);
--echo # Make sure the FETCH clause addition didn't introduce problems with
--echo # the offset keyword.
--echo #
#enable after fix MDEV-29645
--disable_view_protocol
select * from t1
order by a
offset 2 rows;
Expand All @@ -24,7 +26,7 @@ offset 2 rows;
--sorted_result
select * from t1
offset 2 rows;

--enable_view_protocol

--echo #
--echo # Offset is now a reserved keyword. Column names can not have that name
Expand Down Expand Up @@ -682,7 +684,8 @@ order by first_name
offset 1 rows
fetch first 2 rows with ties;


#enable after fix MDEV-29645
--disable_view_protocol
select first_name, row_number() over () rn
from t1
order by rn
Expand All @@ -694,6 +697,7 @@ from t1
order by rn desc
offset 1 rows
fetch first 2 rows with ties;
--enable_view_protocol

select first_name, score, rank() over (ORDER BY score)
from t1
Expand Down Expand Up @@ -811,6 +815,8 @@ drop table t2;
create table t1 (a int, b int, index (a,b));
insert into t1 values (1,1), (1,2), (1,3), (2,1), (2,2), (3,1);

#enable after fix MDEV-29645
--disable_view_protocol
select SQL_CALC_FOUND_ROWS a, b, count(*)
from t1
group by a, b
Expand All @@ -824,6 +830,7 @@ from t1
order by a
fetch first 1 rows with ties;
SELECT FOUND_ROWS();
--enable_view_protocol

--echo #
--echo # Test index read optimization with ORDER BY as sub part of GROUP BY
Expand Down
4 changes: 3 additions & 1 deletion mysql-test/main/flush.test
Expand Up @@ -672,7 +672,7 @@ UNLOCK TABLES;

DROP VIEW v1;
DROP TABLE t1;
--enable_service_connection

--echo #
--echo # MDEV-15888 Implement FLUSH TABLES tbl_name [, tbl_name] ... WITH READ LOCK for views.
--echo #
Expand Down Expand Up @@ -787,3 +787,5 @@ DROP VIEW v2, v1, v0;
--echo #
--echo # End of 10.6 tests
--echo #

--enable_service_connection
2 changes: 2 additions & 0 deletions mysql-test/main/fulltext.test
Expand Up @@ -347,7 +347,9 @@ drop table t1, t2;
CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
SET NAMES latin1;
INSERT INTO t1 VALUES('Mit freundlichem Gr�� aus Osnabr�ck');
--disable_service_connection
SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabr�ck"' IN BOOLEAN MODE);
--enable_service_connection
DROP TABLE t1;

#
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/main/func_str.test
Expand Up @@ -53,11 +53,14 @@ select substring_index('aaaaaaaaa1','aaaa',1);
select substring_index('aaaaaaaaa1','aaaa',2);
select substring_index('aaaaaaaaa1','1',1);
select substring_index('aaaaaaaaa1','a',-1);
#enable after fix MDEV-29601
--disable_service_connection
select substring_index('aaaaaaaaa1','aa',-1);
select substring_index('aaaaaaaaa1','aa',-2);
select substring_index('aaaaaaaaa1','aa',-3);
select substring_index('aaaaaaaaa1','aa',-4);
select substring_index('aaaaaaaaa1','aa',-5);
--enable_service_connection
select substring_index('aaaaaaaaa1','aaa',-1);
select substring_index('aaaaaaaaa1','aaa',-2);
select substring_index('aaaaaaaaa1','aaa',-3);
Expand Down Expand Up @@ -321,10 +324,13 @@ select FIELD('b','A','B');
select FIELD('B','A','B');
select FIELD('b' COLLATE latin1_bin,'A','B');
select FIELD('b','A' COLLATE latin1_bin,'B');
#enable after fix MDEV-29601
--disable_service_connection
--error 1270
select FIELD(_latin2'b','A','B');
--error 1270
select FIELD('b',_latin2'A','B');
--enable_service_connection
select FIELD('1',_latin2'3','2',1);

select POSITION(_latin1'B' IN _latin1'abcd');
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/func_test.test
Expand Up @@ -14,7 +14,10 @@ select "abc" like "a%", "abc" not like "%d%", "a%" like "a\%","abc%" like "a%\%"
select "a" like "%%b","a" like "%%ab","ab" like "a\%", "ab" like "_", "ab" like "ab_", "abc" like "%_d", "abc" like "abc%d";
select '?' like '|%', '?' like '|%' ESCAPE '|', '%' like '|%', '%' like '|%' ESCAPE '|', '%' like '%';
select 'abc' like '%c','abcabc' like '%c', "ab" like "", "ab" like "a", "ab" like "ab";
#enable after fix MDEV-29601
--disable_service_connection
select "Det h�r �r svenska" regexp "h[[:alpha:]]+r", "aba" regexp "^(a|b)*$";
--enable_service_connection
select "aba" regexp concat("^","a");
select !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 or 1=1 and 1=0;
select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between "max" and "my" and 3=3;
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/main/func_weight_string.test
Expand Up @@ -2,6 +2,9 @@
drop table if exists t1;
--enable_warnings

#check after fix MDEV-29601
--disable_service_connection

set @save_max_allowed_packet=@@max_allowed_packet;
set global max_allowed_packet=1048576;
connect (conn1,localhost,root,,);
Expand Down Expand Up @@ -120,6 +123,8 @@ disconnect conn1;
connection default;
set global max_allowed_packet=@save_max_allowed_packet;

--enable_service_connection

--echo #
--echo # Start of 10.1 tests
--echo #
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/locking_clause.test
Expand Up @@ -115,6 +115,7 @@ DROP TABLE t1, t2;
--echo #
--echo # Bug#25972285: UNCLEAR ERROR MESSAGE FOR NOWAIT
--echo #
--disable_view_protocol
CREATE USER test@localhost;
GRANT CREATE, SELECT, UPDATE on *.* to test@localhost;

Expand Down Expand Up @@ -144,6 +145,7 @@ disconnect con2;
DROP TABLE t1;
DROP USER test@localhost;
DROP USER test2@localhost;
--enable_view_protocol

--echo #
--echo # Bug#30237291: "SELECT ... INTO VAR_NAME FOR UPDATE" NOT WORKING IN
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/long_host.test
@@ -1,6 +1,8 @@

--source include/have_debug_sync.inc
--source include/not_embedded.inc
#enable view protocol after fix MDEV-29542
--source include/no_view_protocol.inc

--echo # check user

Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/olap.test
Expand Up @@ -55,7 +55,10 @@ select product, country_id , year, sum(profit) from t1 group by product, country
select concat(product,':',country_id) as 'prod', concat(":",year,":") as 'year',1+1, sum(profit)/count(*) from t1 group by 1,2 with rollup;
select product, sum(profit)/count(*) from t1 group by product with rollup;
select left(product,4) as prod, sum(profit)/count(*) from t1 group by prod with rollup;
#check after fix MDEV-29601
--disable_service_connection
select concat(product,':',country_id), 1+1, sum(profit)/count(*) from t1 group by concat(product,':',country_id) with rollup;
--enable_service_connection

# Joins
select product, country , year, sum(profit) from t1,t2 where t1.country_id=t2.country_id group by product, country, year with rollup;
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/main/opt_trace.test
Expand Up @@ -831,10 +831,12 @@ from t1 left join (t2,t3) on t2.a=t1.a and t3.a=t2.a and t3.a + t2.a <1000
where
t1.b > 5555;

--disable_view_protocol
select
json_detailed(json_extract(trace, '$**.substitute_best_equal'))
from
information_schema.optimizer_trace;
--enable_view_protocol

--echo # The next query is test for:
--echo # MDEV-23646: Optimizer trace: optimize_cond() should show ON expression processing
Expand Down Expand Up @@ -881,10 +883,12 @@ where t1.b < 3;
# Just show that choose_best_splitting function has coverage in the
# optimizer trace and re-optmization of child select inside it is distinct
# from the rest of join optimization.
--disable_view_protocol
select
json_detailed(json_extract(trace, '$**.choose_best_splitting'))
from
information_schema.optimizer_trace;
--enable_view_protocol

# Same as above. just to show that splitting plan has some coverage in the
# trace.
Expand All @@ -903,9 +907,11 @@ CREATE TABLE t1(id INT, f1 JSON);
INSERT INTO t1 VALUES (1, '{\"1\": 1}'), (2, '{\"1\": 2}'), (3, '{\"1\": 3}'),
(4, '{\"1\": 4}'), (5, '{\"1\": 5}'), (6, '{\"1\": 6}');

--disable_view_protocol
SELECT * FROM t1 WHERE id IN
(SELECT id FROM t1 as tt2,
JSON_TABLE(f1, "$" COLUMNS (jf FOR ORDINALITY)) AS tbl);
--enable_view_protocol

select json_detailed(json_extract(trace, '$**.best_join_order'))
from information_schema.OPTIMIZER_TRACE;
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/plugin_auth.test
Expand Up @@ -3,6 +3,9 @@
--source include/mysql_upgrade_preparation.inc
--source include/have_innodb.inc

#enable view protocol after fix MDEV-29542
--source include/no_view_protocol.inc

SET GLOBAL SQL_MODE="";
SET LOCAL SQL_MODE="";

Expand Down
6 changes: 4 additions & 2 deletions mysql-test/main/ps_missed_cmds.test
Expand Up @@ -72,7 +72,7 @@ DROP TABLE t1;

--echo # Test case 3: Check that the 'USE' statement is supported by
--echo # prepared statements

--disable_service_connection
CREATE DATABASE mdev_16708_db;
PREPARE stmt_1 FROM 'USE mdev_16708_db';
EXECUTE stmt_1;
Expand All @@ -88,7 +88,7 @@ SELECT DATABASE();
DEALLOCATE PREPARE stmt_1;
USE test;
DROP DATABASE mdev_16708_db;

--enable_service_connection
--echo # Test case 4: Check that the 'ALTER DATABASE' statement is supported
--echo # by prepared statements
CREATE DATABASE mdev_16708_db;
Expand Down Expand Up @@ -151,6 +151,7 @@ DROP TABLE t1;
--echo # Test case 7: Check that the BEGIN/SAVEPOINT/RELEASE SAVEPOINT
--echo # statements are supported by prepared statements

--disable_view_protocol
--echo # Set up environmentr for the test case
CREATE TABLE t1 (a INT);

Expand Down Expand Up @@ -195,6 +196,7 @@ DEALLOCATE PREPARE stmt_1;
DEALLOCATE PREPARE stmt_2;
DEALLOCATE PREPARE stmt_3;
DROP TABLE t1;
--enable_view_protocol

--echo # Test case 8: Check that the 'PURGE BINARY LOGS BEFORE' statement
--echo # is supported by prepared statements
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/range.test
Expand Up @@ -1671,6 +1671,8 @@ INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
INSERT INTO t1 (fd) SELECT fd FROM t1;
#check after fix MDEV-29601
--disable_service_connection
--echo # The following should show "Impossible WHERE" :
explain
SELECT * FROM t1 WHERE fd='😁';
Expand All @@ -1681,6 +1683,7 @@ SELECT * FROM t1 WHERE fd='😁';
explain select count(*) from t1 where fd <'😁';
select count(*) from t1 where fd <'😁';
select count(*) from t1 ignore index (ix_fd) where fd <'😁';
--enable_service_connection

drop table t1;
set names default;
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/main/rownum.test
Expand Up @@ -97,7 +97,10 @@ CREATE TABLE t3 (
b varchar(1024) DEFAULT NULL
);
insert into t3 select mod(seq*3,20)+1, repeat(char(33+mod(seq,90)),mod(seq,10)*100) from seq_1_to_23;
#chack after fix MDEV-28571
--disable_view_protocol
SELECT sq.a,length(sq.f) FROM (SELECT a, GROUP_CONCAT(b,b) AS f FROM t3 GROUP BY a ORDER BY a desc) as sq WHERE ROWNUM() <= 10;
--enable_view_protocol
drop table t3;

--echo #
Expand Down Expand Up @@ -433,6 +436,7 @@ drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5);

--disable_view_protocol
let $query=
select * from (select a from t1 where a < 1000) as tt where rownum() <= 2;
flush status;
Expand Down Expand Up @@ -481,6 +485,7 @@ eval prepare stmt from "$query";
execute stmt;
execute stmt;
deallocate prepare stmt;
--enable_view_protocol

--echo # Other limit

Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/select.test
Expand Up @@ -2611,7 +2611,10 @@ SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
# this should work when sql_mode is not NO_BACKSLASH_ESCAPES
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan%' ESCAPE '';
#enable after fix MDEV-29601
--disable_service_connection
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%' ESCAPE '';
--enable_service_connection
SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE 0x5c;
SELECT * FROM BUG_12595 WHERE a LIKE 'ha%%an' ESCAPE '%';
SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE '\\';
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/main/stat_tables_par.inc
@@ -1,6 +1,8 @@
# Note that this test requires a fresh restart to not have problems with the
# old status values

--disable_service_connection

set @save_use_stat_tables=@@use_stat_tables;

set use_stat_tables='preferably';
Expand Down Expand Up @@ -241,6 +243,8 @@ DROP DATABASE dbt3_s001;

use test;

--enable_service_connection

#
# Bug mdev-4019: crash when executing in parallel ANALYZE and
# SELECT * FROM information_schema.statistics
Expand Down

0 comments on commit a996258

Please sign in to comment.