Commit 090cecd5 authored by Lena Startseva's avatar Lena Startseva

MDEV-31933: Make working view-protocol + ps-protocol (running two protocols together)

Fix for v. 10.5
parent d046b13e
......@@ -6,6 +6,8 @@
--echo # MDEV-30660 COUNT DISTINCT seems unnecessarily slow when run on a PK
--echo #
#Enable after fix MDEV-32034
--disable_view_protocol
set @save_optimizer_trace = @@optimizer_trace;
SET optimizer_trace='enabled=on';
let $trace=
......@@ -104,6 +106,8 @@ eval $trace;
DROP TABLE t1, t2, t3;
DROP VIEW v1;
SET optimizer_trace = @save_optimizer_trace;
--enable_view_protocol
--echo #
--echo # end of 10.5 tests
--echo #
......@@ -23,10 +23,13 @@ SET
SELECT DISTINCT * FROM t1 WHERE a IN (1, 2);
#Enable after fix MDEV-32034
--disable_view_protocol
select
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100 as ACCESS_METHOD_COST_IS_FINITE
from information_schema.optimizer_trace;
--enable_view_protocol
set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
drop table t1;
......
......@@ -258,6 +258,8 @@ where t1.col2 in
# the having column is resolved in the FROM clause of the outer query -
# works in ANSI
#Enable after fix MDEV-31937
--disable_ps2_protocol
select t1.col1 from t1
where t1.col2 in
(select t2.col2 from t2
......@@ -284,6 +286,7 @@ where t1.col2 in
group by t2.col1, t2.col2 having col_t1 <= 10)
group by col_t1
having col_t1 <= 20;
--enable_ps2_protocol
#
# nested HAVING clauses
......@@ -412,11 +415,14 @@ INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale');
INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna');
INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale');
#Enable after fix MDEV-31937
--disable_ps2_protocol
SELECT EMPNUM, GRADE*1000
FROM HU.STAFF WHERE GRADE * 1000 >
ANY (SELECT SUM(BUDGET) FROM HU.PROJ
GROUP BY CITY, PTYPE
HAVING HU.PROJ.CITY = HU.STAFF.CITY);
--enable_ps2_protocol
DROP SCHEMA HU;
USE test;
......@@ -956,6 +962,8 @@ DROP TABLE t;
--echo # MDEV-29731 Crash when HAVING in a correlated subquery references
--echo # columns in the outer query
--echo #
#Enable after fix MDEV-29731
--disable_view_protocol
CREATE TABLE t (a INT, b INT);
SELECT 1 FROM t
WHERE b = (SELECT 1 FROM t GROUP BY a HAVING b = a+1);
......@@ -998,6 +1006,7 @@ UPDATE t SET a = ''
WHERE (0, a) IN ((0,-1),(+1,0))
ORDER BY 1+AVG(a) OVER (ORDER BY a)) ORDER BY a;
DROP TABLE t;
--enable_view_protocol
--echo #
--echo # End of 10.4 tests
......
This diff is collapsed.
......@@ -15,7 +15,9 @@ from t0 A, t0 B, t0 C;
--echo This should use union:
explain select * from t1 where a=1 or b=1;
--disable_view_protocol
select * from information_schema.OPTIMIZER_TRACE;
--enable_view_protocol
drop table t0,t1;
set optimizer_trace="enabled=off";
set @@optimizer_switch= @tmp_opt_switch;
......
......@@ -33,7 +33,9 @@ set optimizer_trace="enabled=on";
set @tmp_index_merge_ror_cpk=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
explain select * from t1 where pk1 != 0 and key1 = 1;
--disable_view_protocol
select * from information_schema.OPTIMIZER_TRACE;
--enable_view_protocol
drop table t1;
set @@optimizer_switch= @tmp_index_merge_ror_cpk;
......
......@@ -6,5 +6,8 @@ insert into t1 values ('a', 'a');
insert into t1 values ('a', 'a');
set optimizer_trace=1;
explain format=json select * from t1 force index(col1) where col1 >='a';
# Enable after fix MDEV-31408
--disable_view_protocol
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.analyzing_range_alternatives')) AS JS from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
--enable_view_protocol
drop table t1;
......@@ -26,8 +26,11 @@ explain select * from t2 where key1 in (1,2,3) and pk not in (1,2,3);
--echo # This should show only ranges in form "(1) <= (key1) <= (1)"
--echo # ranges over "pk" should not be constructed.
# Enable after fix MDEV-31408
--disable_view_protocol
select json_detailed(JSON_EXTRACT(trace, '$**.ranges'))
from information_schema.optimizer_trace;
--enable_view_protocol
set optimizer_trace=@tmp_21958;
drop table t2;
......
......@@ -98,9 +98,12 @@ set @tmp=@@optimizer_trace;
set optimizer_trace=1;
explain select * from t10 where a in (91303);
#Enable after fix MDEV-32034
--disable_view_protocol
--echo # Must have selectivity_from_histogram <= 1.0:
select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel
from information_schema.optimizer_trace;
--enable_view_protocol
set optimizer_trace=@tmp;
drop table t0,t1,t10;
......@@ -169,17 +172,23 @@ while ($i < $N_CONDS) {
#echo $query_tbl;
evalp $query_tbl;
#Enable after fix MDEV-32034
--disable_view_protocol
select
json_detailed(json_extract(trace,'$**.selectivity_for_columns[0]')) as JS
from
information_schema.optimizer_trace;
--enable_view_protocol
evalp $query_tbl;
#Enable after fix MDEV-32034
--disable_view_protocol
eval select
json_detailed(json_extract(trace,'\$**.selectivity_for_columns[$N_LAST_COND]')) as JS
from
information_schema.optimizer_trace;
--enable_view_protocol
--echo #
--echo # Check if not being able to infer anything for the first MAX_KEY
......@@ -200,10 +209,13 @@ let $query_tbl= $query_tbl) and col$N_LAST_COND>1;
#echo $query_tbl;
evalp $query_tbl;
#Enable after fix MDEV-32034
--disable_view_protocol
select
json_detailed(json_extract(trace,'$**.selectivity_for_columns')) as JS
from
information_schema.optimizer_trace;
--enable_view_protocol
set optimizer_trace=@trace_tmp;
drop table t1;
......
......@@ -338,7 +338,10 @@ CREATE TABLE `t1` (
SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
-- error ER_BAD_FIELD_ERROR
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
#Enable after fix MDEV-31937
--disable_ps2_protocol
SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
--enable_ps2_protocol
INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
-- error ER_SUBQUERY_NO_1_ROW
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
......@@ -2998,10 +3001,13 @@ SELECT a, AVG(b),
(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test
FROM t1 WHERE t1.d=0 GROUP BY a;
# Enable after fix MDEV-32038
--disable_ps2_protocol
SELECT tt.a,
(SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
FROM t1 as tt;
--enable_ps2_protocol
SELECT tt.a,
(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
......
......@@ -23,8 +23,10 @@ error 1,1030;
create temporary table t2 (a int);
error 1,1030;
create temporary table t3 (a int) engine=Aria;
--disable_view_protocol
error 1,1030;
select * from information_schema.columns where table_schema='test';
--enable_view_protocol
flush tables;
select * from d1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment