From d1a1ad4c28f3e608901406d13db96e1ec1672458 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Wed, 2 Feb 2022 19:44:43 +0700 Subject: MDEV-27021 Add support of FORMAT=JSON for SHOW ANALYZE --- sql/sql_yacc.yy | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'sql/sql_yacc.yy') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b81a4ad606c..8f4f7ccefc3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -13944,16 +13944,17 @@ show_param: { Lex->sql_command= SQLCOM_SHOW_EXPLAIN; if (unlikely(prepare_schema_table(thd, Lex, 0, - Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR))) + Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR))) MYSQL_YYABORT; add_value_to_list(thd, $4); } - | ANALYZE_SYM FOR_SYM expr + | ANALYZE_SYM opt_format_json FOR_SYM expr { Lex->sql_command= SQLCOM_SHOW_ANALYZE; - if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_ANALYZE))) + if (unlikely(prepare_schema_table(thd, Lex, 0, + Lex->explain_json ? SCH_ANALYZE_JSON : SCH_ANALYZE_TABULAR))) MYSQL_YYABORT; - add_value_to_list(thd, $3); + add_value_to_list(thd, $4); } | IDENT_sys remember_tok_start wild_and_where { @@ -14107,8 +14108,8 @@ opt_format_json: else if (lex_string_eq(&$3, STRING_WITH_LEN("TRADITIONAL"))) DBUG_ASSERT(Lex->explain_json==false); else - my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), "EXPLAIN", - $3.str)); + my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), + "EXPLAIN/ANALYZE", $3.str)); } ; -- cgit v1.2.1