summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/ps.result8
-rw-r--r--mysql-test/main/ps.test8
-rw-r--r--mysql-test/main/statement-expr.result16
-rw-r--r--mysql-test/main/statement-expr.test16
-rw-r--r--mysql-test/main/subselect.result4
-rw-r--r--mysql-test/main/subselect.test4
-rw-r--r--mysql-test/main/subselect_no_exists_to_in.result4
-rw-r--r--mysql-test/main/subselect_no_mat.result4
-rw-r--r--mysql-test/main/subselect_no_opts.result4
-rw-r--r--mysql-test/main/subselect_no_scache.result4
-rw-r--r--mysql-test/main/subselect_no_semijoin.result4
-rw-r--r--mysql-test/main/subselect_notembedded.result2
-rw-r--r--mysql-test/main/subselect_notembedded.test2
-rw-r--r--mysql-test/suite/compat/oracle/r/ps.result8
-rw-r--r--mysql-test/suite/compat/oracle/r/statement-expr.result16
-rw-r--r--mysql-test/suite/compat/oracle/t/ps.test8
-rw-r--r--mysql-test/suite/compat/oracle/t/statement-expr.test16
-rw-r--r--sql/sql_lex.cc15
-rw-r--r--sql/sql_lex.h12
-rw-r--r--sql/sql_yacc.yy57
-rw-r--r--sql/sql_yacc_ora.yy57
21 files changed, 133 insertions, 136 deletions
diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result
index b3b295842cd..1fdd1bef0cc 100644
--- a/mysql-test/main/ps.result
+++ b/mysql-test/main/ps.result
@@ -4547,7 +4547,7 @@ DEALLOCATE PREPARE stmt;
#
PREPARE stmt FROM 'SELECT ? FROM DUAL';
EXECUTE stmt USING (SELECT 1);
-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 'SELECT 1)' at line 1
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
DEALLOCATE PREPARE stmt;
CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test';
PREPARE stmt FROM 'SELECT ? FROM DUAL';
@@ -4746,7 +4746,7 @@ ERROR 21000: Operand should contain 1 column(s)
# Testing disallowed expressions in USING
#
EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING (SELECT 1);
-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 'SELECT 1)' at line 1
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test';
EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING f1();
ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
@@ -4932,9 +4932,9 @@ ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2
PREPARE stmt FROM CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL');
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat'
EXECUTE IMMEDIATE (SELECT 'SELECT 1');
-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 'SELECT 'SELECT 1')' at line 1
+ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
PREPARE stmt FROM (SELECT 'SELECT 1');
-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 'SELECT 'SELECT 1')' at line 1
+ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
EXECUTE IMMEDIATE a;
ERROR 42S22: Unknown column 'a' in 'field list'
PREPARE stmt FROM a;
diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test
index b13cf667aef..a3c9f12e582 100644
--- a/mysql-test/main/ps.test
+++ b/mysql-test/main/ps.test
@@ -4042,7 +4042,7 @@ DEALLOCATE PREPARE stmt;
--echo #
PREPARE stmt FROM 'SELECT ? FROM DUAL';
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE stmt USING (SELECT 1);
DEALLOCATE PREPARE stmt;
@@ -4221,7 +4221,7 @@ EXECUTE IMMEDIATE 'SELECT ?' USING ROW(1,2);
--echo # Testing disallowed expressions in USING
--echo #
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING (SELECT 1);
CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test';
@@ -4394,9 +4394,9 @@ EXECUTE IMMEDIATE CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL');
--error ER_CANT_AGGREGATE_2COLLATIONS
PREPARE stmt FROM CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL');
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE (SELECT 'SELECT 1');
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PREPARE stmt FROM (SELECT 'SELECT 1');
--error ER_BAD_FIELD_ERROR
diff --git a/mysql-test/main/statement-expr.result b/mysql-test/main/statement-expr.result
index c73ed2825ec..56b90e4a4cc 100644
--- a/mysql-test/main/statement-expr.result
+++ b/mysql-test/main/statement-expr.result
@@ -12,9 +12,9 @@ ROW(1, 7) IN (SELECT id, id1 FROM t1 WHERE id1= 8)
0
DROP TABLE t1;
EXECUTE IMMEDIATE 'SELECT ?' USING (1 IN (SELECT * FROM t1));
-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 'SELECT * FROM t1))' at line 1
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
EXECUTE IMMEDIATE 'SELECT ?' USING (SELECT * FROM t1);
-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 'SELECT * FROM t1)' at line 1
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (10);
CREATE PROCEDURE p1(a INT) BEGIN END;
@@ -45,21 +45,21 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SIGNAL SQLSTATE '01000';
END' at line 3
PREPARE stmt FROM (1 IN (SELECT * FROM t1));
-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 'SELECT * FROM t1))' at line 1
+ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
PREPARE stmt FROM EXISTS (SELECT * FROM t1);
-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 '(SELECT * FROM t1)' at line 1
+ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
EXECUTE IMMEDIATE (1 IN (SELECT * FROM t1));
-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 'SELECT * FROM t1))' at line 1
+ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
EXECUTE IMMEDIATE EXISTS (SELECT * FROM t1);
-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 '(SELECT * FROM t1)' at line 1
+ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
GET DIAGNOSTICS CONDITION (1 IN (SELECT * FROM t1)) @errno=MYSQL_ERRNO;
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 '(1 IN (SELECT * FROM t1)) @errno=MYSQL_ERRNO' at line 1
GET DIAGNOSTICS CONDITION EXISTS (SELECT * FROM t1) @errno=MYSQL_ERRNO;
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 'EXISTS (SELECT * FROM t1) @errno=MYSQL_ERRNO' at line 1
PURGE BINARY LOGS BEFORE (1 IN (SELECT * FROM t1));
-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 'SELECT * FROM t1))' at line 1
+ERROR 42000: PURGE..BEFORE does not support subqueries or stored functions
PURGE BINARY LOGS BEFORE EXISTS (SELECT * FROM t1);
-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 '(SELECT * FROM t1)' at line 1
+ERROR 42000: PURGE..BEFORE does not support subqueries or stored functions
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
DO 1 IN (SELECT * FROM t1);
diff --git a/mysql-test/main/statement-expr.test b/mysql-test/main/statement-expr.test
index 7e968d4fb66..aab14963c54 100644
--- a/mysql-test/main/statement-expr.test
+++ b/mysql-test/main/statement-expr.test
@@ -15,9 +15,9 @@ SELECT ROW(1,7) IN (SELECT id, id1 FROM t1 WHERE id1= 8);
EXECUTE IMMEDIATE 'SELECT ROW(1, 7) IN (SELECT id, id1 FROM t1 WHERE id1= 8)';
DROP TABLE t1;
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE 'SELECT ?' USING (1 IN (SELECT * FROM t1));
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE 'SELECT ?' USING (SELECT * FROM t1);
@@ -52,14 +52,14 @@ $$
DELIMITER ;$$
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PREPARE stmt FROM (1 IN (SELECT * FROM t1));
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PREPARE stmt FROM EXISTS (SELECT * FROM t1);
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE (1 IN (SELECT * FROM t1));
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE EXISTS (SELECT * FROM t1);
--error ER_PARSE_ERROR
@@ -67,9 +67,9 @@ GET DIAGNOSTICS CONDITION (1 IN (SELECT * FROM t1)) @errno=MYSQL_ERRNO;
--error ER_PARSE_ERROR
GET DIAGNOSTICS CONDITION EXISTS (SELECT * FROM t1) @errno=MYSQL_ERRNO;
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PURGE BINARY LOGS BEFORE (1 IN (SELECT * FROM t1));
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PURGE BINARY LOGS BEFORE EXISTS (SELECT * FROM t1);
CREATE TABLE t1 (a INT);
diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result
index ae75f5f354e..f2836d36c80 100644
--- a/mysql-test/main/subselect.result
+++ b/mysql-test/main/subselect.result
@@ -83,7 +83,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
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 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -1133,7 +1133,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: HANDLER..READ does not support subqueries or stored functions
HANDLER t1 CLOSE;
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test
index 5389e5da5cd..53773eb5e1e 100644
--- a/mysql-test/main/subselect.test
+++ b/mysql-test/main/subselect.test
@@ -56,7 +56,7 @@ SELECT 1 IN (SELECT 1);
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
-- error ER_PARSE_ERROR
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
--- error ER_PARSE_ERROR
+-- error ER_SUBQUERIES_NOT_SUPPORTED
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-- error ER_BAD_FIELD_ERROR
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
@@ -623,7 +623,7 @@ set @a:=(SELECT a from t1);
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
--- error ER_PARSE_ERROR
+-- error ER_SUBQUERIES_NOT_SUPPORTED
HANDLER t1 READ a=((SELECT 1));
HANDLER t1 CLOSE;
drop table t1;
diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result
index d1f3c7a64e4..1cf1a3373a3 100644
--- a/mysql-test/main/subselect_no_exists_to_in.result
+++ b/mysql-test/main/subselect_no_exists_to_in.result
@@ -87,7 +87,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
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 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -1137,7 +1137,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: HANDLER..READ does not support subqueries or stored functions
HANDLER t1 CLOSE;
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result
index cf165182073..92ddbe34b6f 100644
--- a/mysql-test/main/subselect_no_mat.result
+++ b/mysql-test/main/subselect_no_mat.result
@@ -90,7 +90,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
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 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -1140,7 +1140,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: HANDLER..READ does not support subqueries or stored functions
HANDLER t1 CLOSE;
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result
index 202ba61d0e5..a2788715194 100644
--- a/mysql-test/main/subselect_no_opts.result
+++ b/mysql-test/main/subselect_no_opts.result
@@ -86,7 +86,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
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 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -1136,7 +1136,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: HANDLER..READ does not support subqueries or stored functions
HANDLER t1 CLOSE;
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result
index 2019555e237..f5c5a1dead6 100644
--- a/mysql-test/main/subselect_no_scache.result
+++ b/mysql-test/main/subselect_no_scache.result
@@ -89,7 +89,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
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 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -1139,7 +1139,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: HANDLER..READ does not support subqueries or stored functions
HANDLER t1 CLOSE;
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index 2f84f7cd5b0..bef256f789f 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -86,7 +86,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
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 'PROCEDURE ANALYSE(1))' at line 1
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: PROCEDURE does not support subqueries or stored functions
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
ERROR 42S22: Unknown column 'a' in 'field list'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
@@ -1136,7 +1136,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));
-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 'SELECT 1))' at line 1
+ERROR 42000: HANDLER..READ does not support subqueries or stored functions
HANDLER t1 CLOSE;
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/main/subselect_notembedded.result b/mysql-test/main/subselect_notembedded.result
index 9153706fc27..23a35a28bf4 100644
--- a/mysql-test/main/subselect_notembedded.result
+++ b/mysql-test/main/subselect_notembedded.result
@@ -1,5 +1,5 @@
purge master logs before (select adddate(current_timestamp(), interval -4 day));
-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 'select adddate(current_timestamp(), interval -4 day))' at line 1
+ERROR 42000: PURGE..BEFORE does not support subqueries or stored functions
purge master logs before adddate(current_timestamp(), interval -4 day);
drop table if exists t1;
create table t1(a int,b int,key(a),key(b));
diff --git a/mysql-test/main/subselect_notembedded.test b/mysql-test/main/subselect_notembedded.test
index dcda71c767f..f6e383592bc 100644
--- a/mysql-test/main/subselect_notembedded.test
+++ b/mysql-test/main/subselect_notembedded.test
@@ -4,7 +4,7 @@
# BUG#10308: purge log with subselect
# Bug#28553: mysqld crash in "purge master log before(select time from information_schema)"
#
---error 1064
+--error ER_SUBQUERIES_NOT_SUPPORTED
purge master logs before (select adddate(current_timestamp(), interval -4 day));
purge master logs before adddate(current_timestamp(), interval -4 day);
diff --git a/mysql-test/suite/compat/oracle/r/ps.result b/mysql-test/suite/compat/oracle/r/ps.result
index 73aa04b972c..818c97b06ab 100644
--- a/mysql-test/suite/compat/oracle/r/ps.result
+++ b/mysql-test/suite/compat/oracle/r/ps.result
@@ -47,7 +47,7 @@ EXECUTE stmt USING @a, @b;
#
PREPARE stmt FROM 'SELECT :1 FROM DUAL';
EXECUTE stmt USING (SELECT 1);
-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 'SELECT 1)' at line 1
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
DEALLOCATE PREPARE stmt;
CREATE FUNCTION f1() RETURN VARCHAR
AS
@@ -155,7 +155,7 @@ DROP TABLE t1;
# Testing disallowed expressions in USING
#
EXECUTE IMMEDIATE 'SELECT :1 FROM DUAL' USING (SELECT 1);
-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 'SELECT 1)' at line 1
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
CREATE FUNCTION f1() RETURN VARCHAR
AS
BEGIN
@@ -182,9 +182,9 @@ ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2
PREPARE stmt FROM _latin1'SELECT 1 AS c FROM ' || _latin2 'DUAL';
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat_operator_oracle'
EXECUTE IMMEDIATE (SELECT 'SELECT 1');
-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 'SELECT 'SELECT 1')' at line 1
+ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
PREPARE stmt FROM (SELECT 'SELECT 1');
-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 'SELECT 'SELECT 1')' at line 1
+ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
EXECUTE IMMEDIATE a;
ERROR 42S22: Unknown column 'a' in 'field list'
PREPARE stmt FROM a;
diff --git a/mysql-test/suite/compat/oracle/r/statement-expr.result b/mysql-test/suite/compat/oracle/r/statement-expr.result
index ea3bd5232d3..ab4dce9ad74 100644
--- a/mysql-test/suite/compat/oracle/r/statement-expr.result
+++ b/mysql-test/suite/compat/oracle/r/statement-expr.result
@@ -13,9 +13,9 @@ ROW(1, 7) IN (SELECT id, id1 FROM t1 WHERE id1= 8)
0
DROP TABLE t1;
EXECUTE IMMEDIATE 'SELECT ?' USING (1 IN (SELECT * FROM t1));
-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 'SELECT * FROM t1))' at line 1
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
EXECUTE IMMEDIATE 'SELECT ?' USING (SELECT * FROM t1);
-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 'SELECT * FROM t1)' at line 1
+ERROR 42000: EXECUTE..USING does not support subqueries or stored functions
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (10);
CREATE PROCEDURE p1(a INT) AS BEGIN NULL; END;
@@ -47,21 +47,21 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SIGNAL SQLSTATE '01000';
END' at line 3
PREPARE stmt FROM (1 IN (SELECT * FROM t1));
-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 'SELECT * FROM t1))' at line 1
+ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
PREPARE stmt FROM EXISTS (SELECT * FROM t1);
-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 '(SELECT * FROM t1)' at line 1
+ERROR 42000: PREPARE..FROM does not support subqueries or stored functions
EXECUTE IMMEDIATE (1 IN (SELECT * FROM t1));
-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 'SELECT * FROM t1))' at line 1
+ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
EXECUTE IMMEDIATE EXISTS (SELECT * FROM t1);
-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 '(SELECT * FROM t1)' at line 1
+ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions
GET DIAGNOSTICS CONDITION (1 IN (SELECT * FROM t1)) @errno=MYSQL_ERRNO;
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 '(1 IN (SELECT * FROM t1)) @errno=MYSQL_ERRNO' at line 1
GET DIAGNOSTICS CONDITION EXISTS (SELECT * FROM t1) @errno=MYSQL_ERRNO;
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 'EXISTS (SELECT * FROM t1) @errno=MYSQL_ERRNO' at line 1
PURGE BINARY LOGS BEFORE (1 IN (SELECT * FROM t1));
-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 'SELECT * FROM t1))' at line 1
+ERROR 42000: PURGE..BEFORE does not support subqueries or stored functions
PURGE BINARY LOGS BEFORE EXISTS (SELECT * FROM t1);
-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 '(SELECT * FROM t1)' at line 1
+ERROR 42000: PURGE..BEFORE does not support subqueries or stored functions
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
DO 1 IN (SELECT * FROM t1);
diff --git a/mysql-test/suite/compat/oracle/t/ps.test b/mysql-test/suite/compat/oracle/t/ps.test
index 357b50e0eab..39770b48ded 100644
--- a/mysql-test/suite/compat/oracle/t/ps.test
+++ b/mysql-test/suite/compat/oracle/t/ps.test
@@ -33,7 +33,7 @@ EXECUTE stmt USING @a, @b;
--echo #
PREPARE stmt FROM 'SELECT :1 FROM DUAL';
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE stmt USING (SELECT 1);
DEALLOCATE PREPARE stmt;
@@ -153,7 +153,7 @@ DROP TABLE t1;
--echo # Testing disallowed expressions in USING
--echo #
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE 'SELECT :1 FROM DUAL' USING (SELECT 1);
DELIMITER $$;
@@ -189,9 +189,9 @@ EXECUTE IMMEDIATE _latin1'SELECT 1 AS c FROM ' || _latin2 'DUAL';
--error ER_CANT_AGGREGATE_2COLLATIONS
PREPARE stmt FROM _latin1'SELECT 1 AS c FROM ' || _latin2 'DUAL';
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE (SELECT 'SELECT 1');
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PREPARE stmt FROM (SELECT 'SELECT 1');
--error ER_BAD_FIELD_ERROR
diff --git a/mysql-test/suite/compat/oracle/t/statement-expr.test b/mysql-test/suite/compat/oracle/t/statement-expr.test
index f4a6a25eff3..1caab623524 100644
--- a/mysql-test/suite/compat/oracle/t/statement-expr.test
+++ b/mysql-test/suite/compat/oracle/t/statement-expr.test
@@ -17,9 +17,9 @@ SELECT ROW(1,7) IN (SELECT id, id1 FROM t1 WHERE id1= 8);
EXECUTE IMMEDIATE 'SELECT ROW(1, 7) IN (SELECT id, id1 FROM t1 WHERE id1= 8)';
DROP TABLE t1;
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE 'SELECT ?' USING (1 IN (SELECT * FROM t1));
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE 'SELECT ?' USING (SELECT * FROM t1);
@@ -57,14 +57,14 @@ $$
DELIMITER ;$$
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PREPARE stmt FROM (1 IN (SELECT * FROM t1));
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PREPARE stmt FROM EXISTS (SELECT * FROM t1);
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE (1 IN (SELECT * FROM t1));
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
EXECUTE IMMEDIATE EXISTS (SELECT * FROM t1);
--error ER_PARSE_ERROR
@@ -72,9 +72,9 @@ GET DIAGNOSTICS CONDITION (1 IN (SELECT * FROM t1)) @errno=MYSQL_ERRNO;
--error ER_PARSE_ERROR
GET DIAGNOSTICS CONDITION EXISTS (SELECT * FROM t1) @errno=MYSQL_ERRNO;
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PURGE BINARY LOGS BEFORE (1 IN (SELECT * FROM t1));
---error ER_PARSE_ERROR
+--error ER_SUBQUERIES_NOT_SUPPORTED
PURGE BINARY LOGS BEFORE EXISTS (SELECT * FROM t1);
CREATE TABLE t1 (a INT);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 91e55127cd1..7952b2a267e 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -733,7 +733,7 @@ void LEX::start(THD *thd_arg)
default_used= FALSE;
query_tables= 0;
reset_query_tables_list(FALSE);
- expr_allows_subselect= TRUE;
+ clause_that_disallows_subselect= NULL;
selects_allow_into= FALSE;
selects_allow_procedure= FALSE;
use_only_table_context= FALSE;
@@ -9049,12 +9049,12 @@ bool LEX::insert_select_hack(SELECT_LEX *sel)
Create an Item_singlerow_subselect for a query expression.
*/
Item *LEX::create_item_query_expression(THD *thd,
- const char *tok_start,
st_select_lex_unit *unit)
{
- if (!expr_allows_subselect)
+ if (clause_that_disallows_subselect)
{
- thd->parse_error(ER_SYNTAX_ERROR, tok_start);
+ my_error(ER_SUBQUERIES_NOT_SUPPORTED, MYF(0),
+ clause_that_disallows_subselect);
return NULL;
}
@@ -9323,11 +9323,12 @@ SELECT_LEX_UNIT *LEX::parsed_body_unit_tail(SELECT_LEX_UNIT *unit,
Process subselect parsing
*/
-SELECT_LEX *LEX::parsed_subselect(SELECT_LEX_UNIT *unit, char *place)
+SELECT_LEX *LEX::parsed_subselect(SELECT_LEX_UNIT *unit)
{
- if (!expr_allows_subselect)
+ if (clause_that_disallows_subselect)
{
- thd->parse_error(ER_SYNTAX_ERROR, place);
+ my_error(ER_SUBQUERIES_NOT_SUPPORTED, MYF(0),
+ clause_that_disallows_subselect);
return NULL;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index d351378a9a6..8296f9e2dec 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -3267,10 +3267,10 @@ public:
/*
Usually `expr` rule of yacc is quite reused but some commands better
not support subqueries which comes standard with this rule, like
- KILL, HA_READ, CREATE/ALTER EVENT etc. Set this to `false` to get
- syntax error back.
+ KILL, HA_READ, CREATE/ALTER EVENT etc. Set this to a non-NULL
+ clause name to get an error.
*/
- bool expr_allows_subselect;
+ const char *clause_that_disallows_subselect;
bool selects_allow_into;
bool selects_allow_procedure;
/*
@@ -3988,9 +3988,7 @@ public:
const Lex_ident_cli_st *var_name,
const Lex_ident_cli_st *field_name);
- Item *create_item_query_expression(THD *thd,
- const char *tok_start,
- st_select_lex_unit *unit);
+ Item *create_item_query_expression(THD *thd, st_select_lex_unit *unit);
Item *make_item_func_replace(THD *thd, Item *org, Item *find, Item *replace);
Item *make_item_func_substr(THD *thd, Item *a, Item *b, Item *c);
@@ -4460,7 +4458,7 @@ public:
bool parsed_body_unit(SELECT_LEX_UNIT *unit);
SELECT_LEX_UNIT *parsed_body_unit_tail(SELECT_LEX_UNIT *unit,
Lex_order_limit_lock * l);
- SELECT_LEX *parsed_subselect(SELECT_LEX_UNIT *unit, char *place);
+ SELECT_LEX *parsed_subselect(SELECT_LEX_UNIT *unit);
bool parsed_insert_select(SELECT_LEX *firs_select);
bool parsed_TVC_start();
SELECT_LEX *parsed_TVC_end();
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 3756982b384..a9da6f9836d 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1873,7 +1873,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <item>
literal insert_ident order_ident temporal_literal
- simple_ident expr expr_no_subselect sum_expr in_sum_expr
+ simple_ident expr sum_expr in_sum_expr
variable variable_aux bool_pri
predicate bit_expr parenthesized_expr
table_wild simple_expr column_default_non_parenthesized_expr udf_expr
@@ -2340,19 +2340,13 @@ deallocate_or_drop:
;
prepare:
- PREPARE_SYM ident FROM expr_no_subselect
- {
- if (Lex->stmt_prepare($2, $4))
- MYSQL_YYABORT;
- }
- ;
-
-expr_no_subselect:
- { Lex->expr_allows_subselect= false; }
+ PREPARE_SYM ident FROM
+ { Lex->clause_that_disallows_subselect= "PREPARE..FROM"; }
expr
{
- Lex->expr_allows_subselect= true;
- $$= $2;
+ Lex->clause_that_disallows_subselect= NULL;
+ if (Lex->stmt_prepare($2, $5))
+ MYSQL_YYABORT;
}
;
@@ -2362,20 +2356,25 @@ execute:
if (Lex->stmt_execute($2, $3))
MYSQL_YYABORT;
}
- | EXECUTE_SYM IMMEDIATE_SYM expr_no_subselect execute_using
+ | EXECUTE_SYM IMMEDIATE_SYM
+ { Lex->clause_that_disallows_subselect= "EXECUTE IMMEDIATE"; }
+ expr
+ { Lex->clause_that_disallows_subselect= NULL; }
+ execute_using
{
- if (Lex->stmt_execute_immediate($3, $4))
+ if (Lex->stmt_execute_immediate($4, $6))
MYSQL_YYABORT;
}
;
execute_using:
/* nothing */ { $$= NULL; }
- | USING { Lex->expr_allows_subselect= false; }
+ | USING
+ { Lex->clause_that_disallows_subselect= "EXECUTE..USING"; }
execute_params
{
$$= $3;
- Lex->expr_allows_subselect= true;
+ Lex->clause_that_disallows_subselect= NULL;
}
;
@@ -6776,10 +6775,9 @@ parse_vcol_expr:
;
parenthesized_expr:
- remember_tok_start
query_expression
{
- if (!($$= Lex->create_item_query_expression(thd, $1, $2)))
+ if (!($$= Lex->create_item_query_expression(thd, $1)))
MYSQL_YYABORT;
}
| expr
@@ -9358,10 +9356,9 @@ query_expression:
;
subselect:
- remember_tok_start
query_expression
{
- if (!($$= Lex->parsed_subselect($2, $1)))
+ if (!($$= Lex->parsed_subselect($1)))
YYABORT;
}
;
@@ -12944,17 +12941,16 @@ procedure_clause:
/*
PROCEDURE CLAUSE cannot handle subquery as one of its parameter,
- so set expr_allows_subselect as false to disallow any subqueries
- further. Reset expr_allows_subselect back to true once the
- parameters are reduced.
+ so disallow any subqueries further.
+ Alow subqueries back once the parameters are reduced.
*/
- Lex->expr_allows_subselect= false;
+ Lex->clause_that_disallows_subselect= "PROCEDURE";
Select->options|= OPTION_PROCEDURE_CLAUSE;
}
'(' procedure_list ')'
{
/* Subqueries are allowed from now.*/
- Lex->expr_allows_subselect= true;
+ Lex->clause_that_disallows_subselect= NULL;
}
;
@@ -14701,9 +14697,12 @@ purge:
{
Lex->stmt_purge_to($5);
}
- | PURGE master_or_binary LOGS_SYM BEFORE_SYM expr_no_subselect
+ | PURGE master_or_binary LOGS_SYM BEFORE_SYM
+ { Lex->clause_that_disallows_subselect= "PURGE..BEFORE"; }
+ expr
{
- if (Lex->stmt_purge_before($5))
+ Lex->clause_that_disallows_subselect= NULL;
+ if (Lex->stmt_purge_before($6))
MYSQL_YYABORT;
}
;
@@ -16797,7 +16796,7 @@ handler_tail:
LEX *lex=Lex;
if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
- lex->expr_allows_subselect= FALSE;
+ lex->clause_that_disallows_subselect= "HANDLER..READ";
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
Item *one= new (thd->mem_root) Item_int(thd, (int32) 1);
@@ -16812,7 +16811,7 @@ handler_tail:
handler_read_or_scan opt_where_clause opt_global_limit_clause
{
LEX *lex=Lex;
- lex->expr_allows_subselect= TRUE;
+ lex->clause_that_disallows_subselect= NULL;
if (!lex->current_select->explicit_limit)
{
Item *one= new (thd->mem_root) Item_int(thd, (int32) 1);
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index eda8834ff6a..67bcfbaa616 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -1358,7 +1358,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <item>
literal insert_ident order_ident temporal_literal
- simple_ident expr expr_no_subselect sum_expr in_sum_expr
+ simple_ident expr sum_expr in_sum_expr
variable variable_aux bool_pri
predicate bit_expr parenthesized_expr
table_wild simple_expr column_default_non_parenthesized_expr udf_expr
@@ -1844,19 +1844,13 @@ deallocate_or_drop:
;
prepare:
- PREPARE_SYM ident FROM expr_no_subselect
- {
- if (Lex->stmt_prepare($2, $4))
- MYSQL_YYABORT;
- }
- ;
-
-expr_no_subselect:
- { Lex->expr_allows_subselect= false; }
+ PREPARE_SYM ident FROM
+ { Lex->clause_that_disallows_subselect= "PREPARE..FROM"; }
expr
{
- Lex->expr_allows_subselect= true;
- $$= $2;
+ Lex->clause_that_disallows_subselect= NULL;
+ if (Lex->stmt_prepare($2, $5))
+ MYSQL_YYABORT;
}
;
@@ -1866,20 +1860,25 @@ execute:
if (Lex->stmt_execute($2, $3))
MYSQL_YYABORT;
}
- | EXECUTE_SYM IMMEDIATE_SYM expr_no_subselect execute_using
+ | EXECUTE_SYM IMMEDIATE_SYM
+ { Lex->clause_that_disallows_subselect= "EXECUTE IMMEDIATE"; }
+ expr
+ { Lex->clause_that_disallows_subselect= NULL; }
+ execute_using
{
- if (Lex->stmt_execute_immediate($3, $4))
+ if (Lex->stmt_execute_immediate($4, $6))
MYSQL_YYABORT;
}
;
execute_using:
/* nothing */ { $$= NULL; }
- | USING { Lex->expr_allows_subselect= false; }
+ | USING
+ { Lex->clause_that_disallows_subselect= "EXECUTE..USING"; }
execute_params
{
$$= $3;
- Lex->expr_allows_subselect= true;
+ Lex->clause_that_disallows_subselect= NULL;
}
;
@@ -6785,10 +6784,9 @@ parse_vcol_expr:
;
parenthesized_expr:
- remember_tok_start
query_expression
{
- if (!($$= Lex->create_item_query_expression(thd, $1, $2)))
+ if (!($$= Lex->create_item_query_expression(thd, $1)))
MYSQL_YYABORT;
}
| expr
@@ -9459,10 +9457,9 @@ query_expression:
;
subselect:
- remember_tok_start
query_expression
{
- if (!($$= Lex->parsed_subselect($2, $1)))
+ if (!($$= Lex->parsed_subselect($1)))
YYABORT;
}
;
@@ -13054,17 +13051,16 @@ procedure_clause:
/*
PROCEDURE CLAUSE cannot handle subquery as one of its parameter,
- so set expr_allows_subselect as false to disallow any subqueries
- further. Reset expr_allows_subselect back to true once the
- parameters are reduced.
+ so disallow any subqueries further.
+ Alow subqueries back once the parameters are reduced.
*/
- Lex->expr_allows_subselect= false;
+ Lex->clause_that_disallows_subselect= "PROCEDURE";
Select->options|= OPTION_PROCEDURE_CLAUSE;
}
'(' procedure_list ')'
{
/* Subqueries are allowed from now.*/
- Lex->expr_allows_subselect= true;
+ Lex->clause_that_disallows_subselect= NULL;
}
;
@@ -14834,9 +14830,12 @@ purge:
{
Lex->stmt_purge_to($5);
}
- | PURGE master_or_binary LOGS_SYM BEFORE_SYM expr_no_subselect
+ | PURGE master_or_binary LOGS_SYM BEFORE_SYM
+ { Lex->clause_that_disallows_subselect= "PURGE..BEFORE"; }
+ expr
{
- if (Lex->stmt_purge_before($5))
+ Lex->clause_that_disallows_subselect= NULL;
+ if (Lex->stmt_purge_before($6))
MYSQL_YYABORT;
}
;
@@ -17016,7 +17015,7 @@ handler_tail:
LEX *lex=Lex;
if (unlikely(lex->sphead))
my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
- lex->expr_allows_subselect= FALSE;
+ lex->clause_that_disallows_subselect= "HANDLER..READ";
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
Item *one= new (thd->mem_root) Item_int(thd, (int32) 1);
@@ -17031,7 +17030,7 @@ handler_tail:
handler_read_or_scan opt_where_clause opt_global_limit_clause
{
LEX *lex=Lex;
- lex->expr_allows_subselect= TRUE;
+ lex->clause_that_disallows_subselect= NULL;
if (!lex->current_select->explicit_limit)
{
Item *one= new (thd->mem_root) Item_int(thd, (int32) 1);