summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index d1da36dfa5b..9c75c08c62a 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4363,8 +4363,12 @@ select_option:
}
| SQL_CACHE_SYM
{
- /* Honor this flag only if SQL_NO_CACHE wasn't specified. */
- if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE)
+ /*
+ Honor this flag only if SQL_NO_CACHE wasn't specified AND
+ we are parsing the outermost SELECT in the query.
+ */
+ if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE &&
+ Lex->current_select == &Lex->select_lex)
{
Lex->safe_to_cache_query=1;
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;