Commit 5a9fff80 authored by Oleg Smirnov's avatar Oleg Smirnov

MDEV-33281 Fix code review comments

parent 189c8eb9
......@@ -208,3 +208,30 @@ DROP PACKAGE test.pkg;
#
# End of 11.4 tests
#
#
# Start of 11.7 tests
#
#
# MDEV-33281 Implement optimizer hints like in MySQL
#
SET NAMES utf8mb4;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
SELECT /*+BKA(a) BKA(å)*/ a.a FROM t1 a, t1 å;
a
1
2
1
2
SELECT a.a, A.a FROM t1 a, t1 A;
ERROR 42000: Not unique table/alias: 'A'
SELECT /*+BKA(a) BKA(A)*/ a.a FROM t1 a;
a
1
2
Warnings:
Warning 4202 Hint BKA("A") is ignored as conflicting/duplicated
DROP TABLE t1;
#
# End of 11.7 tests
#
......@@ -205,3 +205,33 @@ DROP PACKAGE test.pkg;
--echo #
--echo # End of 11.4 tests
--echo #
--echo #
--echo # Start of 11.7 tests
--echo #
--echo #
--echo # MDEV-33281 Implement optimizer hints like in MySQL
--echo #
SET NAMES utf8mb4;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
# Test that aliases are accent sensitive with lowercase-table-names=1
# Test that table names in hints are also accent sensitive
SELECT /*+BKA(a) BKA(å)*/ a.a FROM t1 a, t1 å;
# Test that aliases are case insensitive with lowercase-table-names=1
--error ER_NONUNIQ_TABLE
SELECT a.a, A.a FROM t1 a, t1 A;
# Test that table names in hints are also case insensitive
SELECT /*+BKA(a) BKA(A)*/ a.a FROM t1 a;
DROP TABLE t1;
--echo #
--echo # End of 11.7 tests
--echo #
......@@ -189,3 +189,28 @@ DROP DATABASE MYSQL;
#
# End of 10.5 tests
#
#
# Start of 11.7 tests
#
#
# MDEV-33281 Implement optimizer hints like in MySQL
#
SET NAMES utf8mb4;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
SELECT /*+BKA(a) BKA(å)*/ a.a, å.a FROM t1 a, t1 å;
a a
1 1
2 1
1 2
2 2
SELECT /*+BKA(a) BKA(A)*/ a.a, A.a FROM t1 a, t1 A;
a a
1 1
2 1
1 2
2 2
DROP TABLE t1;
#
# End of 11.7 tests
#
......@@ -187,3 +187,30 @@ DROP DATABASE MYSQL;
--echo #
--echo # End of 10.5 tests
--echo #
--echo #
--echo # Start of 11.7 tests
--echo #
--echo #
--echo # MDEV-33281 Implement optimizer hints like in MySQL
--echo #
SET NAMES utf8mb4;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
# Test that table aliases are accent sensitive with lowercase-table-names=0
# Test that table names in hints are also accent sensitive
SELECT /*+BKA(a) BKA(å)*/ a.a, å.a FROM t1 a, t1 å;
# Test that table aliases are case sensitive with lowercase-table-names=0
# Test that table names in hints are also case sensitive
SELECT /*+BKA(a) BKA(A)*/ a.a, A.a FROM t1 a, t1 A;
DROP TABLE t1;
--echo #
--echo # End of 11.7 tests
--echo #
This diff is collapsed.
--echo # WL#8017 Infrastructure for Optimizer Hints
--enable_prepare_warnings
SET NAMES utf8mb4;
--echo # Testing that index names in hints are accent sensitive case insensitive
CREATE TABLE t1 (a INT, ä INT, INDEX idx_a(a), INDEX idx_ä(ä));
INSERT INTO t1 VALUES (1,1),(2,2);
SELECT /*+ NO_MRR(t1 idx_a) */ a FROM t1;
SELECT /*+ NO_MRR(t1 idx_A) */ a FROM t1;
SELECT /*+ NO_MRR(t1 idx_å) */ a FROM t1;
SELECT /*+ NO_MRR(t1 idx_a, idx_å, idx_A) */ a FROM t1;
DROP TABLE t1;
--echo # Testing that query block names are accent sensitive case insensitive
CREATE TABLE t1 (a INT);
SELECT /*+ QB_NAME(a) BKA(t1@a) BKA(t1@A) */ * FROM t1;
SELECT /*+ QB_NAME(a) BKA(t1@a) BKA(t1@å) */ * FROM t1;
DROP TABLE t1;
CREATE TABLE t1(f1 INT, f2 INT);
INSERT INTO t1 VALUES
(1,1),(2,2),(3,3);
......@@ -31,7 +47,6 @@ ANALYZE TABLE t1;
ANALYZE TABLE t2;
ANALYZE TABLE t3;
--echo # NO_RANGE_OPTIMIZATION hint testing
set optimizer_switch=default;
......@@ -50,16 +65,44 @@ SHOW STATUS LIKE 'handler_read%';
EXPLAIN EXTENDED SELECT f1 FROM t3 WHERE f1 > 30 AND f1 < 33;
--echo # Turn off range access for PRIMARY key
--echo # Should use range access by f2_idx key
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(t3 PRIMARY) */ f1 FROM t3 WHERE f1 > 30 AND f1 < 33;
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(t3 PRIMARY) */ f1
FROM t3 WHERE f1 > 30 AND f1 < 33;
--echo # Turn off range access for PRIMARY & f2_idx keys
--echo # Should use index access
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(t3 PRIMARY, f2_idx) */ f1 FROM t3 WHERE f1 > 30 AND f1 < 33;
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(t3 PRIMARY, f2_idx) */ f1
FROM t3 WHERE f1 > 30 AND f1 < 33;
--echo # Turn off range access for all keys
--echo # Should use index access
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(t3) */ f1 FROM t3 WHERE f1 > 30 AND f1 < 33;
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(t3) */ f1
FROM t3 WHERE f1 > 30 AND f1 < 33;
--echo # Turn off range access for PRIMARY & f2_idx keys
--echo # Should use index access
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(t3 PRIMARY) NO_RANGE_OPTIMIZATION(t3 f2_idx) */ f1 FROM t3 WHERE f1 > 30 AND f1 < 33;
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(t3 PRIMARY) NO_RANGE_OPTIMIZATION(t3 f2_idx) */ f1
FROM t3 WHERE f1 > 30 AND f1 < 33;
--echo # Create a clone of t3 with cyrillic names
CREATE TABLE таблица (f1 INT NOT NULL, поле2 INT, поле3 VARCHAR(32),
PRIMARY KEY(f1), KEY f2_индекс(f1), KEY f3_индекс(поле3))
AS SELECT * FROM t3;
ANALYZE TABLE таблица;
--echo # Turn off range access for PRIMARY key
--echo # Should use range access by f2_индекс key
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(таблица PRIMARY) */ f1
FROM таблица WHERE f1 > 30 AND f1 < 33;
--echo # Turn off range access for PRIMARY & f2_индекс keys
--echo # Should use index access
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(таблица PRIMARY, f2_индекс) */ f1
FROM таблица WHERE f1 > 30 AND f1 < 33;
--echo # Turn off range access for all keys
--echo # Should use index access
EXPLAIN EXTENDED SELECT /*+ NO_RANGE_OPTIMIZATION(таблица) */ f1
FROM таблица WHERE f1 > 30 AND f1 < 33;
--echo # Turn off range access for PRIMARY & f2_индекс keys
--echo # Should use index access
EXPLAIN EXTENDED
SELECT /*+ NO_RANGE_OPTIMIZATION(таблица PRIMARY) NO_RANGE_OPTIMIZATION(таблица f2_индекс) */ f1
FROM таблица WHERE f1 > 30 AND f1 < 33;
DROP TABLE таблица;
--echo # NO_ICP hint testing
set optimizer_switch='index_condition_pushdown=on';
......@@ -79,6 +122,12 @@ EXPLAIN EXTENDED SELECT /*+ NO_ICP(t5@qb1 x_idx) */ * FROM
(SELECT /*+ QB_NAME(QB1) */ t4.x, t5.y FROM t4, t4 t5
WHERE t4.y = 8 AND t5.x BETWEEN 7 AND t4.y+0) AS TD;
--echo # Cyrillic query block name
EXPLAIN EXTENDED SELECT /*+ NO_ICP(t5@блок1 x_idx) */ * FROM
(SELECT /*+ QB_NAME(блок1) */ t4.x, t5.y FROM t4, t4 t5
WHERE t4.y = 8 AND t5.x BETWEEN 7 AND t4.y+0) AS TD;
--echo # Expected warning for z_idx key, unresolved name.
EXPLAIN EXTENDED SELECT * FROM
(SELECT /*+ NO_ICP(t5 y_idx, x_idx, z_idx) */ t4.x, t5.y FROM t4, t4 t5
......@@ -157,7 +206,7 @@ EXPLAIN EXTENDED SELECT /*+ NO_BKA(t12) */ * FROM t12, t13
EXPLAIN EXTENDED SELECT /*+ QB_NAME(QB1) NO_BKA(t13@QB1) */ * FROM t12, t13
WHERE t12.a=t13.a AND (t13.b+1 <= t13.b+1);
--echo # UPDATE|DELETE|INSERT hint testing
--echo # UPDATE|DELETE|INSERT|REPLACE hint testing
EXPLAIN EXTENDED UPDATE t3
SET f3 = 'mnbv' WHERE f1 > 30 AND f1 < 33 AND (t3.f1, t3.f2, t3.f3) IN
(SELECT t2.f1, t2.f2, t2.f3 FROM t1,t2 WHERE t1.f1=t2.f1 AND
......@@ -207,6 +256,25 @@ EXPLAIN EXTENDED INSERT /*+ NO_ICP(t5@QB1 x_idx) */ INTO t3(f1, f2, f3)
(SELECT /*+ QB_NAME(qb1) */ t4.x, t5.y, 'filler' FROM t4, t4 t5
WHERE t4.y = 8 AND t5.x BETWEEN 7 AND t4.y+0);
--echo # Make sure ICP is expected to be used when there are no hints
EXPLAIN EXTENDED REPLACE INTO t3(f1, f2, f3)
(SELECT t4.x, t5.y, 'filler' FROM t4, t4 t5 WHERE t4.y = 8 AND t5.x BETWEEN 7 AND t4.y+0);
--echo # Turn off ICP. ICP should not be used.
EXPLAIN EXTENDED REPLACE INTO t3(f1, f2, f3)
(SELECT /*+ NO_ICP(t5) */t4.x, t5.y, 'filler' FROM t4, t4 t5
WHERE t4.y = 8 AND t5.x BETWEEN 7 AND t4.y+0);
--echo # Turn off ICP for a particular table
EXPLAIN EXTENDED REPLACE /*+ NO_ICP(t5@QB1) */ INTO t3(f1, f2, f3)
(SELECT /*+ QB_NAME(qb1) */ t4.x, t5.y, 'filler' FROM t4, t4 t5
WHERE t4.y = 8 AND t5.x BETWEEN 7 AND t4.y+0);
--echo # Turn off ICP for a particular table and a key
EXPLAIN EXTENDED REPLACE /*+ NO_ICP(t5@QB1 x_idx) */ INTO t3(f1, f2, f3)
(SELECT /*+ QB_NAME(qb1) */ t4.x, t5.y, 'filler' FROM t4, t4 t5
WHERE t4.y = 8 AND t5.x BETWEEN 7 AND t4.y+0);
--echo # Misc tests
--echo # Should issue warning
......@@ -475,7 +543,6 @@ SELECT /*+ NO_ICP ( ) */ 1;
SELECT /*+ NO_ICP() */ 1 UNION SELECT 1;
(SELECT /*+ NO_ICP() */ 1) UNION (SELECT 1);
--echo # OLEGS: this one does not issue a warning although should:
((SELECT /* + NO_ICP() */ 1));
UPDATE /*+ NO_ICP() */ t1 SET i = 10;
......
......@@ -895,7 +895,7 @@ CREATE TABLE t (
INSERT INTO t(a,b) VALUES(1,'cccc');
let $query=
SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
SELECT 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
WHERE b.b>c.a;
eval EXPLAIN $query;
eval $query;
......@@ -1022,13 +1022,12 @@ VALUES (1, 'j'), (2, 'c'), (0, 'a');
ANALYZE TABLE t1, t2, t3, t4;
# Hint is added to avoid materialization of the subquery
let query=
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1049,13 +1048,12 @@ if ($support_virtual_index)
ALTER TABLE t3 ADD INDEX v_idx2 (i2_key, i1);
}
# Hint is added to avoid materialization of the subquery
let query=
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1079,11 +1077,11 @@ ALTER TABLE t3 DROP INDEX v_idx;
# Hint is added to avoid materialization of the subquery
let query=
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1117,11 +1115,11 @@ VALUES (10,1), (11,1), (12,1), (13,1), (14,1),(15,1), (16,1),(17,1), (18,1),
--echo # non-covering.
# Hint is added to avoid materialization of the subquery
let query=
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1
SELECT t1.c1, t2.i1, t3.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1154,11 +1152,11 @@ eval $query;
# an extra query condition is added to the subquery.
# Hint is added to avoid materialization of the subquery
let query=
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1)
)
......
......@@ -444,7 +444,7 @@ Note 1265 Data truncated for column 'c13' at row 1
Note 1265 Data truncated for column 'c11' at row 2
Note 1265 Data truncated for column 'c13' at row 2
CREATE VIEW view_C AS SELECT * FROM C;
SELECT /*+ NO_BNL(t1) */ t1.c13 FROM C AS t2 STRAIGHT_JOIN C AS t1 FORCE INDEX(c13);
SELECT t1.c13 FROM C AS t2 STRAIGHT_JOIN C AS t1 FORCE INDEX(c13);
c13
00:00:00
00:00:00
......
......@@ -555,12 +555,12 @@ c BLOB GENERATED ALWAYS AS (a+b) VIRTUAL,
UNIQUE KEY i0008 (a)
);
INSERT INTO t(a,b) VALUES(1,'cccc');
EXPLAIN SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
EXPLAIN SELECT 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
WHERE b.b>c.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE b ALL i0008 NULL NULL NULL 1
1 SIMPLE c ALL i0008 NULL NULL NULL 1 Range checked for each record (index map: 0x1)
SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
SELECT 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
WHERE b.b>c.a;
c
Warnings:
......@@ -689,11 +689,11 @@ test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
EXPLAIN SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -704,11 +704,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -743,11 +743,11 @@ t 9
#
# Test 2: Two alternative covering indexes for the range scan
#
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
EXPLAIN SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -758,11 +758,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -798,11 +798,11 @@ t 9
# Test 3: One covering index including the base column for the virtual
# column
#
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
EXPLAIN SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -813,11 +813,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -861,11 +861,11 @@ VALUES (10,1), (11,1), (12,1), (13,1), (14,1),(15,1), (16,1),(17,1), (18,1),
(28,1), (29,1);
# Change the query to read an extra column (t3.i1) making the index
# non-covering.
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1
EXPLAIN SELECT t1.c1, t2.i1, t3.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -876,11 +876,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1
SELECT t1.c1, t2.i1, t3.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -916,11 +916,11 @@ t 9 48
# Test 5: Test where the added primary key to secondary indexes is
# used after it has been included in the join buffer
#
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
EXPLAIN SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1)
)
......@@ -931,11 +931,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where; End temporary; Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1)
)
......
......@@ -1174,14 +1174,14 @@ c BLOB GENERATED ALWAYS AS (a+b) VIRTUAL,
UNIQUE KEY i0008 (a)
);
INSERT INTO t(a,b) VALUES(1,'cccc');
EXPLAIN SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
EXPLAIN SELECT 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
WHERE b.b>c.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'cccc'
Warning 1292 Truncated incorrect DECIMAL value: 'cccc'
SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
SELECT 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c
WHERE b.b>c.a;
c
Warnings:
......@@ -1315,11 +1315,11 @@ test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
test.t4 analyze status Engine-independent statistics collected
test.t4 analyze status OK
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
EXPLAIN SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1330,11 +1330,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1370,11 +1370,11 @@ t 9
# Test 2: Two alternative covering indexes for the range scan
#
ALTER TABLE t3 ADD INDEX v_idx2 (i2_key, i1);
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
EXPLAIN SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1385,11 +1385,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY,v_idx,v_idx2 PRIMARY 4 test.t4.i1 1 Using where; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1427,11 +1427,11 @@ t 9
#
# Drop the index with only the virtual column
ALTER TABLE t3 DROP INDEX v_idx;
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
EXPLAIN SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1442,11 +1442,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY,v_idx2 PRIMARY 4 test.t4.i1 1 Using where; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1493,11 +1493,11 @@ VALUES (10,1), (11,1), (12,1), (13,1), (14,1),(15,1), (16,1),(17,1), (18,1),
(28,1), (29,1);
# Change the query to read an extra column (t3.i1) making the index
# non-covering.
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1
EXPLAIN SELECT t1.c1, t2.i1, t3.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1508,11 +1508,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where; End temporary
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1
SELECT t1.c1, t2.i1, t3.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o'
)
......@@ -1548,11 +1548,11 @@ t 9 48
# Test 5: Test where the added primary key to secondary indexes is
# used after it has been included in the join buffer
#
EXPLAIN SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
EXPLAIN SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1)
)
......@@ -1563,11 +1563,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 Using where; End temporary; Using join buffer (flat, BNL join)
SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1
SELECT t1.c1, t2.i1
FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2
WHERE ( t3.pk IN
(
SELECT /*+ QB_NAME(subq1) */ t4.i1
SELECT t4.i1
FROM t4
WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1)
)
......
......@@ -429,7 +429,7 @@ INSERT INTO C (c8,c9) VALUES('1970-01-01',0),('1970-01-01',1);
CREATE VIEW view_C AS SELECT * FROM C;
SELECT /*+ NO_BNL(t1) */ t1.c13 FROM C AS t2 STRAIGHT_JOIN C AS t1 FORCE INDEX(c13);
SELECT t1.c13 FROM C AS t2 STRAIGHT_JOIN C AS t1 FORCE INDEX(c13);
SELECT DISTINCT t1.c13 FROM C AS t1, view_C AS t2;
DROP TABLE C;
......
......@@ -469,7 +469,7 @@ id jid val
2 1 2
2 2 4
2 3 6
SELECT /*+ JOIN_ORDER(jt, t1) */ id, jt.*
SELECT id, jt.*
FROM t1,
JSON_TABLE(jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt;
......@@ -480,14 +480,14 @@ id jid val
2 1 2
2 2 4
2 3 6
EXPLAIN SELECT /*+ JOIN_ORDER(jt, t1) */ id, jt.*
EXPLAIN SELECT id, jt.*
FROM t1,
JSON_TABLE(jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE jt ALL NULL NULL NULL NULL 40 Table function: json_table
SELECT /*+ JOIN_ORDER(t2,jt) */ t1.id, t2.id, jt.*
SELECT t1.id, t2.id, jt.*
FROM t1,
JSON_TABLE(t1.jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt,
......@@ -514,7 +514,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
1 SIMPLE jt ALL NULL NULL NULL NULL 40 Table function: json_table
EXPLAIN SELECT /*+ JOIN_ORDER(t2,jt) */ t1.id, t2.id, jt.*
EXPLAIN SELECT t1.id, t2.id, jt.*
FROM t1,
JSON_TABLE(t1.jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt,
......
......@@ -379,18 +379,18 @@ INSERT INTO t1 values (1, '[1,3,5]'),(2,'[2,4,6]');
SELECT id, jt.* FROM t1,
JSON_TABLE(jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt;
SELECT /*+ JOIN_ORDER(jt, t1) */ id, jt.*
SELECT id, jt.*
FROM t1,
JSON_TABLE(jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt;
EXPLAIN SELECT /*+ JOIN_ORDER(jt, t1) */ id, jt.*
EXPLAIN SELECT id, jt.*
FROM t1,
JSON_TABLE(jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt;
--sorted_result
SELECT /*+ JOIN_ORDER(t2,jt) */ t1.id, t2.id, jt.*
SELECT t1.id, t2.id, jt.*
FROM t1,
JSON_TABLE(t1.jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt,
......@@ -402,7 +402,7 @@ EXPLAIN SELECT t1.id, t2.id, jt.*
val INT PATH '$')) AS jt,
t1 AS t2;
EXPLAIN SELECT /*+ JOIN_ORDER(t2,jt) */ t1.id, t2.id, jt.*
EXPLAIN SELECT t1.id, t2.id, jt.*
FROM t1,
JSON_TABLE(t1.jd, '$[*]' COLUMNS (jid FOR ORDINALITY,
val INT PATH '$')) AS jt,
......
This diff is collapsed.
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2024, MariaDB plc.
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
......@@ -53,7 +54,7 @@ enum opt_hints_enum
struct st_opt_hint_info
{
const char* hint_name; // Hint name.
LEX_CSTRING hint_name; // Hint name.
bool check_upper_lvl; // true if upper level hint check is needed (for hints
// which can be specified on more than one level).
bool switch_hint; // true if hint is not complex.
......@@ -118,8 +119,6 @@ class Opt_hints_map : public Sql_alloc
};
class PT_hint;
class PT_hint_max_execution_time;
class Opt_hints_key;
......@@ -138,6 +137,7 @@ class Opt_hints_key;
class Opt_hints : public Sql_alloc
{
protected:
/*
Name of object referred by the hint.
This name is empty for global level,
......@@ -146,6 +146,7 @@ class Opt_hints : public Sql_alloc
for key level.
*/
Lex_ident_sys name;
private:
/*
Parent object. There is no parent for global level,
for query block level parent is Opt_hints_global object,
......@@ -209,9 +210,14 @@ class Opt_hints : public Sql_alloc
*/
bool get_switch(opt_hints_enum type_arg) const;
virtual const LEX_CSTRING *get_name() const
virtual CHARSET_INFO *charset_info() const
{
return Lex_ident_column::charset_info();
}
const LEX_CSTRING get_name() const
{
return name.str ? &name : nullptr;
return name;
}
void set_name(const Lex_ident_sys &name_arg) { name= name_arg; }
Opt_hints *get_parent() const { return parent; }
......@@ -230,20 +236,6 @@ class Opt_hints : public Sql_alloc
child_array.push_back(hint_arg);
}
// OLEGS: remove it if not used
/**
Returns pointer to complex hint for a given type
@param type hint type
@return pointer to complex hint for a given type.
*/
// virtual PT_hint *get_complex_hints(uint type)
// {
// DBUG_ASSERT(0);
// return NULL; /* error C4716: must return a value*/
// };
/**
Find hint among lower-level hint objects.
......@@ -303,16 +295,11 @@ class Opt_hints_global : public Opt_hints
{
public:
PT_hint_max_execution_time *max_exec_time;
Opt_hints_global(MEM_ROOT *mem_root_arg)
: Opt_hints(Lex_ident_sys(), NULL, mem_root_arg)
{
max_exec_time= NULL;
}
{}
virtual void append_name(THD *thd, String *str) {}
virtual PT_hint *get_complex_hints(uint type);
virtual void append_name(THD *thd, String *str) override {}
};
......@@ -334,10 +321,9 @@ class Opt_hints_qb : public Opt_hints
MEM_ROOT *mem_root_arg,
uint select_number_arg);
const LEX_CSTRING *get_print_name()
const LEX_CSTRING get_print_name()
{
const LEX_CSTRING *str= Opt_hints::get_name();
return str ? str : &sys_name;
return name.str ? name : sys_name;
}
/**
......@@ -348,10 +334,10 @@ class Opt_hints_qb : public Opt_hints
*/
void append_qb_hint(THD *thd, String *str)
{
if (get_name())
if (name.str)
{
str->append(STRING_WITH_LEN("QB_NAME("));
append_identifier(thd, str, get_name()->str, get_name()->length);
append_identifier(thd, str, &name);
str->append(STRING_WITH_LEN(") "));
}
}
......@@ -361,10 +347,11 @@ class Opt_hints_qb : public Opt_hints
@param thd pointer to THD object
@param str pointer to String object
*/
virtual void append_name(THD *thd, String *str)
virtual void append_name(THD *thd, String *str) override
{
str->append(STRING_WITH_LEN("@"));
append_identifier(thd, str, get_print_name()->str, get_print_name()->length);
const LEX_CSTRING print_name= get_print_name();
append_identifier(thd, str, &print_name);
}
/**
......@@ -399,15 +386,21 @@ class Opt_hints_table : public Opt_hints
keyinfo_array(mem_root_arg)
{ }
CHARSET_INFO *charset_info() const override
{
return Lex_ident_table::charset_info();
}
/**
Append table name.
@param thd pointer to THD object
@param str pointer to String object
*/
virtual void append_name(THD *thd, String *str)
virtual void append_name(THD *thd, String *str) override
{
append_identifier(thd, str, get_name()->str, get_name()->length);
append_identifier(thd, str, &name);
get_parent()->append_name(thd, str);
}
/**
......@@ -445,11 +438,11 @@ class Opt_hints_key : public Opt_hints
@param thd pointer to THD object
@param str pointer to String object
*/
virtual void append_name(THD *thd, String *str)
virtual void append_name(THD *thd, String *str) override
{
get_parent()->append_name(thd, str);
str->append(' ');
append_identifier(thd, str, get_name()->str, get_name()->length);
append_identifier(thd, str, &name);
}
virtual uint get_warn_unresolved_code() const override
......@@ -507,5 +500,4 @@ bool hint_table_state(const THD *thd, const TABLE *table,
bool hint_table_state_or_fallback(const THD *thd, const TABLE *table,
opt_hints_enum type_arg,
bool fallback_value);
#endif /* OPT_HINTS_INCLUDED */
......@@ -21,6 +21,7 @@
#include "sql_error.h"
#include "mysqld_error.h"
#include "sql_class.h"
#include "sql_show.h"
extern struct st_opt_hint_info opt_hint_info[];
......
......@@ -21,6 +21,7 @@
#include "lex_ident_sys.h"
#include "simple_tokenizer.h"
#include "sql_list.h"
#include "sql_string.h"
#include "simple_parser.h"
class st_select_lex;
......@@ -565,7 +566,6 @@ class Optimizer_hint_parser: public Optimizer_hint_tokenizer,
{
public:
using OR3::OR3;
};
......@@ -579,8 +579,6 @@ class Optimizer_hint_parser: public Optimizer_hint_tokenizer,
size_t count() const { return elements; }
};
public:
class Hint_list: public LIST<PARSER, Hint_list_container,
Hint, TokenID::tNULL/*not separated list*/, 1>
{
......@@ -590,6 +588,7 @@ class Optimizer_hint_parser: public Optimizer_hint_tokenizer,
bool resolve(Parse_context *pc);
};
public:
/*
The main rule:
hints ::= hint_list EOF
......@@ -608,10 +607,10 @@ class Optimizer_hint_parser: public Optimizer_hint_tokenizer,
instead of including the entire opt_hints_parser.h.
(forward declarations of qualified nested classes are not possible in C++)
*/
class Optimizer_hint_parser_output: public Optimizer_hint_parser::Hint_list
class Optimizer_hint_parser_output: public Optimizer_hint_parser::Hints
{
public:
using Hint_list::Hint_list;
using Hints::Hints;
};
......
......@@ -17,7 +17,7 @@
#define SIMPLE_TOKENIZER_INCLUDED
#include "lex_ident.h"
#include "lex_string.h"
#include "scan_char.h"
/**
......
......@@ -3111,7 +3111,7 @@ void st_select_lex::init_query()
pushdown_select= 0;
orig_names_of_item_list_elems= 0;
opt_hints_qb= 0;
parsed_optimizer_hints= 0; // OLEGS: remove if not used
parsed_optimizer_hints= 0;
}
void st_select_lex::init_select()
......@@ -3166,7 +3166,7 @@ void st_select_lex::init_select()
orig_names_of_item_list_elems= 0;
item_list_usage= MARK_COLUMNS_READ;
opt_hints_qb= 0;
parsed_optimizer_hints= 0; // OLEGS: remove if not used
parsed_optimizer_hints= 0;
}
/*
......@@ -10684,6 +10684,7 @@ bool LEX::parsed_insert_select(SELECT_LEX *first_select)
return true;
// fix "main" select
resolve_optimizer_hints();
SELECT_LEX *blt __attribute__((unused))= pop_select();
DBUG_ASSERT(blt == &builtin_select);
push_select(first_select);
......
......@@ -1380,6 +1380,7 @@ class st_select_lex: public st_select_lex_node
bool setup_ref_array(THD *thd, uint order_group_num);
uint get_cardinality_of_ref_ptrs_slice(uint order_group_num_arg);
void print(THD *thd, String *str, enum_query_type query_type);
void print_hints(THD *thd, String *hint_str);
void print_item_list(THD *thd, String *str, enum_query_type query_type);
void print_set_clause(THD *thd, String *str, enum_query_type query_type);
void print_on_duplicate_key_clause(THD *thd, String *str,
......
......@@ -31452,35 +31452,10 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
return;
}
char buff[NAME_LEN];
String hint_str(buff, sizeof(buff), system_charset_info);
hint_str.length(0);
if (thd->lex->opt_hints_global)
{
char tmp_buff[NAME_LEN];
String hints_tmp(tmp_buff, sizeof(tmp_buff), system_charset_info);
hints_tmp.length(0);
if (select_number == 1)
{
if (opt_hints_qb)
opt_hints_qb->append_qb_hint(thd, &hints_tmp);
thd->lex->opt_hints_global->print(thd, &hints_tmp);
}
else if (opt_hints_qb)
opt_hints_qb->append_qb_hint(thd, &hints_tmp);
if (hints_tmp.length() > 0)
{
hint_str.append(STRING_WITH_LEN("/*+ "));
hint_str.append(hints_tmp);
hint_str.append(STRING_WITH_LEN("*/ "));
}
}
if (hint_str.length() > 0 && (sel_type == SELECT_CMD ||
if (sel_type == SELECT_CMD ||
sel_type == INSERT_CMD ||
sel_type == REPLACE_CMD))
str->append(hint_str);
sel_type == REPLACE_CMD)
print_hints(thd, str);
/* First add options */
if (options & SELECT_STRAIGHT_JOIN)
......@@ -31537,8 +31512,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
if (sel_type == UPDATE_CMD || sel_type == DELETE_CMD)
{
str->append(get_explainable_cmd_name(sel_type));
if (hint_str.length() > 0)
str->append(hint_str);
print_hints(thd, str);
}
if (sel_type == DELETE_CMD)
{
......@@ -31668,6 +31642,36 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
}
void st_select_lex::print_hints(THD *thd,
String *str)
{
if (!thd->lex->opt_hints_global)
return;
constexpr LEX_CSTRING header={STRING_WITH_LEN("/*+ ")};
str->append(header);
uint32 len_before_hints= str->length();
if (select_number == 1)
{
if (opt_hints_qb)
opt_hints_qb->append_qb_hint(thd, str);
thd->lex->opt_hints_global->print(thd, str);
}
else if (opt_hints_qb)
opt_hints_qb->append_qb_hint(thd, str);
if (str->length() > len_before_hints)
{
// Some hints were printed, close the hint string
str->append(STRING_WITH_LEN("*/ "));
}
else
{
// No hints were added, rollback the previouly added header
str->length(len_before_hints - header.length);
}
}
/**
Change the select_result object of the JOIN.
......@@ -1011,10 +1011,6 @@ class String: public Charset, public Binary_string
{
return Binary_string::append(s);
}
bool append(const char *s)
{
return append(s, (uint) strlen(s));
}
inline bool append(char chr)
{
return Binary_string::append_char(chr);
......
......@@ -8765,6 +8765,7 @@ query_specification:
opt_having_clause
opt_window_clause
{
Lex->resolve_optimizer_hints();
$$= Lex->pop_select();
}
;
......@@ -8778,6 +8779,7 @@ select_into_query_specification:
opt_having_clause
opt_window_clause
{
Lex->resolve_optimizer_hints();
$$= Lex->pop_select();
}
;
......@@ -8917,7 +8919,6 @@ query_expression_body:
query_simple
{
Lex->push_select($1);
Lex->resolve_optimizer_hints();
if (!($$= Lex->create_unit($1)))
MYSQL_YYABORT;
}
......@@ -13358,8 +13359,9 @@ replace:
Select->set_lock_for_tables($5, true, false);
}
insert_field_spec opt_returning
stmt_end
insert_stmt_end
{
Lex->resolve_optimizer_hints();
Lex->mark_first_table_as_inserting();
thd->get_stmt_da()->reset_current_row_for_warning(0);
}
......
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