Subqueries are not allowed in a number of clauses, e.g.:
- EXECUTE IMMEDIATE expr
- EXECUTE .. USING expr
- PREPARE stmt FROM expr
- SELECT .. PROCEDURE ANALYSE(expr, expr)
- PURGE BINARY LOGS BEFORE expr
- HANDLER t1 READ a=expr
If a subquery appears in a disallowed context, a syntax error is reported:
The grammar uses remember_tok_start to remember the start position of a subquery, to use this position for error reporting:
Under terms of
MDEV-19956 the grammar will be changed significantly. The remember_tok_start has to be removed to avoid shift/reduce and reduce/reduce conflicts.
Let's change the error message from ER_SYNTAX_ERROR to ER_SUBQUERIES_NOT_SUPPORTED.
So it will look as follows:
- Preserving the old messages is challenging
- The proposed error message is more informative