summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2016-08-30 16:14:51 -0700
committerIgor Babaev <igor@askmonty.org>2016-08-30 16:14:51 -0700
commit2250e9ea261f661cb73c147a28f4d30655d7483d (patch)
tree04673b47943fdb137f8fe5bafdb64a24887f8c0f /sql/sql_yacc.yy
parentcb1e44219b9beae92e104cfe5e67aab3073dd8aa (diff)
parent4ca7b226c05ae883accec64b1afe6d60daf1b323 (diff)
downloadmariadb-git-2250e9ea261f661cb73c147a28f4d30655d7483d.tar.gz
Merge 10.2 into 10.2-mdev9864.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy1518
1 files changed, 592 insertions, 926 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index e6b0c8e353a..8a263ae23f7 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2010, 2015, MariaDB
+ Copyright (c) 2010, 2016, MariaDB
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
@@ -102,6 +102,9 @@ int yylex(void *yylval, void *yythd);
MYSQL_YYABORT; \
}
+#define my_yyabort_error(A) \
+ do { my_error A; MYSQL_YYABORT; } while(0)
+
#ifndef DBUG_OFF
#define YYDEBUG 1
#else
@@ -737,13 +740,6 @@ bool setup_select_in_parentheses(LEX *lex)
my_parse_error(lex->thd, ER_SYNTAX_ERROR);
return TRUE;
}
- if (sel->linkage == UNION_TYPE &&
- sel->olap != UNSPECIFIED_OLAP_TYPE &&
- sel->master_unit()->fake_select_lex)
- {
- my_error(ER_WRONG_USAGE, MYF(0), "CUBE/ROLLUP", "ORDER BY");
- return TRUE;
- }
return FALSE;
}
@@ -943,6 +939,32 @@ bool LEX::set_bincmp(CHARSET_INFO *cs, bool bin)
MYSQL_YYABORT; \
} while(0)
+Virtual_column_info *add_virtual_expression(THD *thd, const char *txt,
+ size_t size, Item *expr)
+{
+ CHARSET_INFO *cs= thd->charset();
+ Virtual_column_info *v= new (thd->mem_root) Virtual_column_info();
+ if (!v)
+ {
+ mem_alloc_error(sizeof(Virtual_column_info));
+ return 0;
+ }
+ /*
+ We have to remove white space as remember_cur_pos may have pointed to end
+ of previous expression.
+ */
+ while (cs->state_map[*(uchar*)txt] == MY_LEX_SKIP)
+ {
+ txt++;
+ size--;
+ }
+ v->expr_str.str= (char* ) thd->strmake(txt, size);
+ v->expr_str.length= size;
+ v->expr_item= expr;
+ v->utf8= 0; /* connection charset */
+ return v;
+}
+
%}
%union {
int num;
@@ -993,6 +1015,7 @@ bool LEX::set_bincmp(CHARSET_INFO *cs, bool bin)
class sp_name *spname;
class sp_variable *spvar;
class With_clause *with_clause;
+ class Virtual_column_info *virtual_column;
handlerton *db_type;
st_select_lex *select_lex;
@@ -1038,10 +1061,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 102 shift/reduce conflicts.
+ Currently there are 103 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 102
+%expect 103
/*
Comments for TOKENS.
@@ -1226,7 +1249,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ENGINES_SYM
%token ENGINE_SYM
%token ENUM
-%token EQ /* OPERATOR */
%token EQUAL_SYM /* OPERATOR */
%token ERROR_SYM
%token ERRORS
@@ -1278,7 +1300,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token GRANTS
%token GROUP_SYM /* SQL-2003-R */
%token GROUP_CONCAT_SYM
-%token GT_SYM /* OPERATOR */
%token HANDLER_SYM
%token HARD_SYM
%token HASH_SYM
@@ -1358,7 +1379,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token LONG_SYM
%token LOOP_SYM
%token LOW_PRIORITY
-%token LT /* OPERATOR */
%token MASTER_CONNECT_RETRY_SYM
%token MASTER_GTID_POS_SYM
%token MASTER_HOST_SYM
@@ -1613,6 +1633,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token STD_SYM
%token STOP_SYM
%token STORAGE_SYM
+%token STORED_SYM
%token STRAIGHT_JOIN
%token STRING_SYM
%token SUBCLASS_ORIGIN_SYM /* SQL-2003-N */
@@ -1729,7 +1750,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%left XOR
%left AND_SYM AND_AND_SYM
%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
-%left EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP IN_SYM
+%left '=' EQUAL_SYM GE '>' LE '<' NE IS LIKE REGEXP IN_SYM
%left '|'
%left '&'
%left SHIFT_LEFT SHIFT_RIGHT
@@ -1758,7 +1779,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
table_ident_opt_wild create_like
%type <simple_string>
- remember_name remember_end opt_db remember_tok_start
+ remember_name remember_end opt_db remember_tok_start remember_cur_pos
wild_and_where
field_length opt_field_length opt_field_length_default_1
@@ -1833,11 +1854,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
literal text_literal insert_ident order_ident temporal_literal
simple_ident expr opt_expr opt_else sum_expr in_sum_expr
variable variable_aux bool_pri
- predicate bit_expr
- table_wild simple_expr udf_expr
+ predicate bit_expr parenthesized_expr
+ table_wild simple_expr column_default_non_parenthesized_expr udf_expr
expr_or_default set_expr_or_default
- geometry_function
- signed_literal now_or_signed_literal opt_escape
+ geometry_function signed_literal expr_or_literal
+ opt_escape
sp_opt_default
simple_ident_nospvar simple_ident_q
field_or_var limit_option
@@ -1936,6 +1957,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <myvar> select_outvar
+%type <virtual_column> opt_check_constraint check_constraint virtual_column_func
+ column_default_expr
+
%type <NONE>
analyze_stmt_command
query verb_clause create change select do drop insert replace insert2
@@ -1949,7 +1973,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
persistent_column_stat_spec persistent_index_stat_spec
table_column_list table_index_list table_index_name
check start checksum
- field_list field_list_item kill key_def
+ field_list field_list_item kill key_def constraint_def
keycache_list keycache_list_or_parts assign_to_keycache
assign_to_keycache_parts
preload_list preload_list_or_parts preload_keys preload_keys_parts
@@ -1999,7 +2023,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
definer_opt no_definer definer get_diagnostics
parse_vcol_expr vcol_opt_specifier vcol_opt_attribute
vcol_opt_attribute_list vcol_attribute
- explainable_command
+ explainable_command opt_impossible_action
END_OF_INPUT
%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
@@ -2089,10 +2113,8 @@ query:
{
if (!thd->bootstrap &&
(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
- {
- my_message(ER_EMPTY_QUERY, ER_THD(thd, ER_EMPTY_QUERY), MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_EMPTY_QUERY, MYF(0)));
+
thd->lex->sql_command= SQLCOM_EMPTY_QUERY;
YYLIP->found_semicolon= NULL;
}
@@ -2275,10 +2297,7 @@ help:
HELP_SYM
{
if (Lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "HELP");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HELP"));
}
ident_or_text
{
@@ -2305,77 +2324,73 @@ master_defs:
;
master_def:
- MASTER_HOST_SYM EQ TEXT_STRING_sys
+ MASTER_HOST_SYM '=' TEXT_STRING_sys
{
Lex->mi.host = $3.str;
}
- | MASTER_USER_SYM EQ TEXT_STRING_sys
+ | MASTER_USER_SYM '=' TEXT_STRING_sys
{
Lex->mi.user = $3.str;
}
- | MASTER_PASSWORD_SYM EQ TEXT_STRING_sys
+ | MASTER_PASSWORD_SYM '=' TEXT_STRING_sys
{
Lex->mi.password = $3.str;
}
- | MASTER_PORT_SYM EQ ulong_num
+ | MASTER_PORT_SYM '=' ulong_num
{
Lex->mi.port = $3;
}
- | MASTER_CONNECT_RETRY_SYM EQ ulong_num
+ | MASTER_CONNECT_RETRY_SYM '=' ulong_num
{
Lex->mi.connect_retry = $3;
}
- | MASTER_SSL_SYM EQ ulong_num
+ | MASTER_SSL_SYM '=' ulong_num
{
Lex->mi.ssl= $3 ?
LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
}
- | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CA_SYM '=' TEXT_STRING_sys
{
Lex->mi.ssl_ca= $3.str;
}
- | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CAPATH_SYM '=' TEXT_STRING_sys
{
Lex->mi.ssl_capath= $3.str;
}
- | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CERT_SYM '=' TEXT_STRING_sys
{
Lex->mi.ssl_cert= $3.str;
}
- | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CIPHER_SYM '=' TEXT_STRING_sys
{
Lex->mi.ssl_cipher= $3.str;
}
- | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_KEY_SYM '=' TEXT_STRING_sys
{
Lex->mi.ssl_key= $3.str;
}
- | MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
+ | MASTER_SSL_VERIFY_SERVER_CERT_SYM '=' ulong_num
{
Lex->mi.ssl_verify_server_cert= $3 ?
LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
}
- | MASTER_SSL_CRL_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CRL_SYM '=' TEXT_STRING_sys
{
Lex->mi.ssl_crl= $3.str;
}
- | MASTER_SSL_CRLPATH_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CRLPATH_SYM '=' TEXT_STRING_sys
{
Lex->mi.ssl_crlpath= $3.str;
}
- | MASTER_HEARTBEAT_PERIOD_SYM EQ NUM_literal
+ | MASTER_HEARTBEAT_PERIOD_SYM '=' NUM_literal
{
Lex->mi.heartbeat_period= (float) $3->val_real();
if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
Lex->mi.heartbeat_period < 0.0)
- {
- const char format[]= "%d";
- char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)];
- sprintf(buf, format, SLAVE_MAX_HEARTBEAT_PERIOD);
- my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0), buf);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0),
+ SLAVE_MAX_HEARTBEAT_PERIOD));
+
if (Lex->mi.heartbeat_period > slave_net_timeout)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -2395,15 +2410,15 @@ master_def:
}
Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
}
- | IGNORE_SERVER_IDS_SYM EQ '(' ignore_server_id_list ')'
+ | IGNORE_SERVER_IDS_SYM '=' '(' ignore_server_id_list ')'
{
Lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
}
- | DO_DOMAIN_IDS_SYM EQ '(' do_domain_id_list ')'
+ | DO_DOMAIN_IDS_SYM '=' '(' do_domain_id_list ')'
{
Lex->mi.repl_do_domain_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
}
- | IGNORE_DOMAIN_IDS_SYM EQ '(' ignore_domain_id_list ')'
+ | IGNORE_DOMAIN_IDS_SYM '=' '(' ignore_domain_id_list ')'
{
Lex->mi.repl_ignore_domain_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
}
@@ -2451,60 +2466,51 @@ ignore_domain_id:
;
master_file_def:
- MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
+ MASTER_LOG_FILE_SYM '=' TEXT_STRING_sys
{
Lex->mi.log_file_name = $3.str;
}
- | MASTER_LOG_POS_SYM EQ ulonglong_num
+ | MASTER_LOG_POS_SYM '=' ulonglong_num
{
/*
If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
instead of causing subsequent errors.
We need to do it in this file, because only there we know that
- MASTER_LOG_POS has been explicitely specified. On the contrary
+ MASTER_LOG_POS has been explicitly specified. On the contrary
in change_master() (sql_repl.cc) we cannot distinguish between 0
- (MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified),
+ (MASTER_LOG_POS explicitly specified as 0) and 0 (unspecified),
whereas we want to distinguish (specified 0 means "read the binlog
from 0" (4 in fact), unspecified means "don't change the position
(keep the preceding value)").
*/
Lex->mi.pos= MY_MAX(BIN_LOG_HEADER_SIZE, $3);
}
- | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
+ | RELAY_LOG_FILE_SYM '=' TEXT_STRING_sys
{
Lex->mi.relay_log_name = $3.str;
}
- | RELAY_LOG_POS_SYM EQ ulong_num
+ | RELAY_LOG_POS_SYM '=' ulong_num
{
Lex->mi.relay_log_pos = $3;
/* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
Lex->mi.relay_log_pos= MY_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
}
- | MASTER_USE_GTID_SYM EQ CURRENT_POS_SYM
+ | MASTER_USE_GTID_SYM '=' CURRENT_POS_SYM
{
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
- {
- my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS;
}
- | MASTER_USE_GTID_SYM EQ SLAVE_POS_SYM
+ | MASTER_USE_GTID_SYM '=' SLAVE_POS_SYM
{
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
- {
- my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS;
}
- | MASTER_USE_GTID_SYM EQ NO_SYM
+ | MASTER_USE_GTID_SYM '=' NO_SYM
{
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
- {
- my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_NO;
}
;
@@ -2524,10 +2530,7 @@ connection_name:
Lex->mi.connection_name= $1;
#ifdef HAVE_REPLICATION
if (check_master_connection_name(&$1))
- {
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "MASTER_CONNECTION_NAME");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_ARGUMENTS, MYF(0), "MASTER_CONNECTION_NAME"));
#endif
}
;
@@ -2838,10 +2841,7 @@ ev_sql_stmt:
- CREATE PROCEDURE ... BEGIN DROP EVENT ... END|
*/
if (lex->sphead)
- {
- my_error(ER_EVENT_RECURSION_FORBIDDEN, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_EVENT_RECURSION_FORBIDDEN, MYF(0)));
if (!make_sp_head(thd, lex->event_parse_data->identifier, TYPE_ENUM_PROCEDURE))
MYSQL_YYABORT;
@@ -2880,14 +2880,9 @@ sp_name:
ident '.' ident
{
if (!$1.str || check_db_name(&$1))
- {
- my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
if (check_routine_name(&$3))
- {
MYSQL_YYABORT;
- }
$$= new (thd->mem_root) sp_name($1, $3, true);
if ($$ == NULL)
MYSQL_YYABORT;
@@ -2903,7 +2898,7 @@ sp_name:
}
if (lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
- $$= new (lex->thd->mem_root) sp_name(db, $1, false);
+ $$= new (thd->mem_root) sp_name(db, $1, false);
if ($$ == NULL)
MYSQL_YYABORT;
$$->init_qname(thd);
@@ -3008,10 +3003,7 @@ sp_param_name_and_type:
sp_pcontext *spc= lex->spcont;
if (spc->find_variable($1, TRUE))
- {
- my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_DUP_PARAM, MYF(0), $1.str));
sp_variable *spvar= spc->add_variable(thd, $1);
@@ -3079,17 +3071,9 @@ sp_decls:
shift/reduce conflicts with the wrong result. (And we get
better error handling this way.) */
if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
- { /* Variable or condition following cursor or handler */
- my_message(ER_SP_VARCOND_AFTER_CURSHNDLR,
- ER_THD(thd, ER_SP_VARCOND_AFTER_CURSHNDLR), MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0)));
if ($2.curs && $1.hndlrs)
- { /* Cursor following handler */
- my_message(ER_SP_CURSOR_AFTER_HANDLER,
- ER_THD(thd, ER_SP_CURSOR_AFTER_HANDLER), MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_CURSOR_AFTER_HANDLER, MYF(0)));
$$.vars= $1.vars + $2.vars;
$$.conds= $1.conds + $2.conds;
$$.hndlrs= $1.hndlrs + $2.hndlrs;
@@ -3154,16 +3138,11 @@ sp_decl:
/* The last instruction is responsible for freeing LEX. */
- sp_instr_set *is= (new (lex->thd->mem_root)
+ sp_instr_set *is= new (lex->thd->mem_root)
sp_instr_set(lex->sphead->instructions(),
- pctx,
- var_idx,
- dflt_value_item,
- $4.field_type(),
- lex,
- last));
- if (is == NULL ||
- lex->sphead->add_instr(is))
+ pctx, var_idx, dflt_value_item,
+ $4.field_type(), lex, last);
+ if (is == NULL || lex->sphead->add_instr(is))
MYSQL_YYABORT;
}
@@ -3179,10 +3158,7 @@ sp_decl:
sp_pcontext *spc= lex->spcont;
if (spc->find_condition($2, TRUE))
- {
- my_error(ER_SP_DUP_COND, MYF(0), $2.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_DUP_COND, MYF(0), $2.str));
if(spc->add_condition(thd, $2, $5))
MYSQL_YYABORT;
$$.vars= $$.hndlrs= $$.curs= 0;
@@ -3201,7 +3177,7 @@ sp_decl:
sp_pcontext *ctx= lex->spcont;
sp_instr_hpush_jump *i=
- new (lex->thd->mem_root) sp_instr_hpush_jump(sp->instructions(),
+ new (thd->mem_root) sp_instr_hpush_jump(sp->instructions(),
ctx, h);
if (i == NULL || sp->add_instr(i))
@@ -3225,7 +3201,7 @@ sp_decl:
if ($2 == sp_handler::CONTINUE)
{
- i= new (lex->thd->mem_root)
+ i= new (thd->mem_root)
sp_instr_hreturn(sp->instructions(), ctx);
if (i == NULL ||
sp->add_instr(i))
@@ -3233,7 +3209,7 @@ sp_decl:
}
else
{ /* EXIT or UNDO handler, just jump to the end of the block */
- i= new (lex->thd->mem_root)
+ i= new (thd->mem_root)
sp_instr_hreturn(sp->instructions(), ctx);
if (i == NULL ||
sp->add_instr(i) ||
@@ -3256,17 +3232,12 @@ sp_decl:
sp_instr_cpush *i;
if (ctx->find_cursor($2, &offp, TRUE))
- {
- my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
- delete $5;
- MYSQL_YYABORT;
- }
- i= new (lex->thd->mem_root)
- sp_instr_cpush(sp->instructions(), ctx, $5,
- ctx->current_cursor_count());
- if (i == NULL ||
- sp->add_instr(i) ||
- ctx->add_cursor($2))
+ my_yyabort_error((ER_SP_DUP_CURS, MYF(0), $2.str));
+
+ i= new (thd->mem_root)
+ sp_instr_cpush(sp->instructions(), ctx, $5,
+ ctx->current_cursor_count());
+ if (i == NULL || sp->add_instr(i) || ctx->add_cursor($2))
MYSQL_YYABORT;
$$.vars= $$.conds= $$.hndlrs= 0;
$$.curs= 1;
@@ -3284,11 +3255,7 @@ sp_cursor_stmt:
DBUG_ASSERT(lex->sql_command == SQLCOM_SELECT);
if (lex->result)
- {
- my_message(ER_SP_BAD_CURSOR_SELECT, ER_THD(thd, ER_SP_BAD_CURSOR_SELECT),
- MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BAD_CURSOR_SELECT, MYF(0)));
lex->sp_lex_in_use= TRUE;
$$= lex;
if (lex->sphead->restore_lex(thd))
@@ -3317,17 +3284,10 @@ sp_hcond_element:
sp_pcontext *ctx= lex->spcont->parent_context();
if (ctx->check_duplicate_handler($1))
- {
- my_message(ER_SP_DUP_HANDLER, ER_THD(thd, ER_SP_DUP_HANDLER), MYF(0));
- MYSQL_YYABORT;
- }
- else
- {
- sp_instr_hpush_jump *i=
- (sp_instr_hpush_jump *)sp->last_instruction();
+ my_yyabort_error((ER_SP_DUP_HANDLER, MYF(0)));
- i->add_condition($1);
- }
+ sp_instr_hpush_jump *i= (sp_instr_hpush_jump *)sp->last_instruction();
+ i->add_condition($1);
}
;
@@ -3335,10 +3295,7 @@ sp_cond:
ulong_num
{ /* mysql errno */
if ($1 == 0)
- {
- my_error(ER_WRONG_VALUE, MYF(0), "CONDITION", "0");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_VALUE, MYF(0), "CONDITION", "0"));
$$= new (thd->mem_root) sp_condition_value($1);
if ($$ == NULL)
MYSQL_YYABORT;
@@ -3358,10 +3315,7 @@ sqlstate:
condition.
*/
if (!is_sqlstate_valid(&$3) || is_sqlstate_completion($3.str))
- {
- my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BAD_SQLSTATE, MYF(0), $3.str));
$$= new (thd->mem_root) sp_condition_value($3.str);
if ($$ == NULL)
MYSQL_YYABORT;
@@ -3382,10 +3336,7 @@ sp_hcond:
{
$$= Lex->spcont->find_condition($1, false);
if ($$ == NULL)
- {
- my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
}
| SQLWARNING_SYM /* SQLSTATEs 01??? */
{
@@ -3426,23 +3377,15 @@ signal_value:
{
LEX *lex= Lex;
sp_condition_value *cond;
+
+ /* SIGNAL foo cannot be used outside of stored programs */
if (lex->spcont == NULL)
- {
- /* SIGNAL foo cannot be used outside of stored programs */
- my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
cond= lex->spcont->find_condition($1, false);
if (cond == NULL)
- {
- my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
if (cond->type != sp_condition_value::SQLSTATE)
- {
- my_error(ER_SIGNAL_BAD_CONDITION_TYPE, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SIGNAL_BAD_CONDITION_TYPE, MYF(0)));
$$= cond;
}
| sqlstate
@@ -3465,7 +3408,7 @@ opt_set_signal_information:
;
signal_information_item_list:
- signal_condition_information_item_name EQ signal_allowed_expr
+ signal_condition_information_item_name '=' signal_allowed_expr
{
Set_signal_information *info;
info= &thd->m_parser_state->m_yacc.m_set_signal_info;
@@ -3474,17 +3417,14 @@ signal_information_item_list:
info->m_item[index]= $3;
}
| signal_information_item_list ','
- signal_condition_information_item_name EQ signal_allowed_expr
+ signal_condition_information_item_name '=' signal_allowed_expr
{
Set_signal_information *info;
info= &thd->m_parser_state->m_yacc.m_set_signal_info;
int index= (int) $3;
if (info->m_item[index] != NULL)
- {
- my_error(ER_DUP_SIGNAL_SET, MYF(0),
- Diag_condition_item_names[index].str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_DUP_SIGNAL_SET, MYF(0),
+ Diag_condition_item_names[index].str));
info->m_item[index]= $5;
}
;
@@ -3613,7 +3553,7 @@ statement_information:
;
statement_information_item:
- simple_target_specification EQ statement_information_item_name
+ simple_target_specification '=' statement_information_item_name
{
$$= new (thd->mem_root) Statement_information_item($3, $1);
if ($$ == NULL)
@@ -3670,7 +3610,7 @@ condition_information:
;
condition_information_item:
- simple_target_specification EQ condition_information_item_name
+ simple_target_specification '=' condition_information_item_name
{
$$= new (thd->mem_root) Condition_information_item($3, $1);
if ($$ == NULL)
@@ -3715,10 +3655,7 @@ sp_decl_idents:
sp_pcontext *spc= lex->spcont;
if (spc->find_variable($1, TRUE))
- {
- my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $1.str));
spc->add_variable(thd, $1);
$$= 1;
}
@@ -3730,10 +3667,7 @@ sp_decl_idents:
sp_pcontext *spc= lex->spcont;
if (spc->find_variable($3, TRUE))
- {
- my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $3.str));
spc->add_variable(thd, $3);
$$= $1 + 1;
}
@@ -3804,11 +3738,9 @@ sp_proc_stmt_statement:
sp_head *sp= lex->sphead;
sp->m_flags|= sp_get_flags_for_command(lex);
+ /* "USE db" doesn't work in a procedure */
if (lex->sql_command == SQLCOM_CHANGE_DB)
- { /* "USE db" doesn't work in a procedure */
- my_error(ER_SP_BADSTATEMENT, MYF(0), "USE");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "USE"));
/*
Don't add an instruction for SET statements, since all
instructions for them were already added during processing
@@ -3818,7 +3750,7 @@ sp_proc_stmt_statement:
lex->var_list.is_empty());
if (lex->sql_command != SQLCOM_SET_OPTION)
{
- sp_instr_stmt *i=new (lex->thd->mem_root)
+ sp_instr_stmt *i=new (thd->mem_root)
sp_instr_stmt(sp->instructions(), lex->spcont, lex);
if (i == NULL)
MYSQL_YYABORT;
@@ -3852,22 +3784,17 @@ sp_proc_stmt_return:
sp_head *sp= lex->sphead;
if (sp->m_type != TYPE_ENUM_FUNCTION)
- {
- my_message(ER_SP_BADRETURN, ER_THD(thd, ER_SP_BADRETURN), MYF(0));
- MYSQL_YYABORT;
- }
- else
- {
- sp_instr_freturn *i;
+ my_yyabort_error((ER_SP_BADRETURN, MYF(0)));
+
+ sp_instr_freturn *i;
- i= new (lex->thd->mem_root)
+ i= new (thd->mem_root)
sp_instr_freturn(sp->instructions(), lex->spcont, $3,
sp->m_return_field_def.sql_type, lex);
- if (i == NULL ||
- sp->add_instr(i))
- MYSQL_YYABORT;
- sp->m_flags|= sp_head::HAS_RETURN;
- }
+ if (i == NULL || sp->add_instr(i))
+ MYSQL_YYABORT;
+ sp->m_flags|= sp_head::HAS_RETURN;
+
if (sp->restore_lex(thd))
MYSQL_YYABORT;
}
@@ -3882,49 +3809,44 @@ sp_proc_stmt_leave:
sp_label *lab= ctx->find_label($2);
if (! lab)
+ my_yyabort_error((ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str));
+
+ sp_instr_jump *i;
+ uint ip= sp->instructions();
+ uint n;
+ /*
+ When jumping to a BEGIN-END block end, the target jump
+ points to the block hpop/cpop cleanup instructions,
+ so we should exclude the block context here.
+ When jumping to something else (i.e., SP_LAB_ITER),
+ there are no hpop/cpop at the jump destination,
+ so we should include the block context here for cleanup.
+ */
+ bool exclusive= (lab->type == sp_label::BEGIN);
+
+ n= ctx->diff_handlers(lab->ctx, exclusive);
+ if (n)
{
- my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str);
- MYSQL_YYABORT;
+ sp_instr_hpop *hpop= new (thd->mem_root)
+ sp_instr_hpop(ip++, ctx, n);
+ if (hpop == NULL)
+ MYSQL_YYABORT;
+ sp->add_instr(hpop);
}
- else
+ n= ctx->diff_cursors(lab->ctx, exclusive);
+ if (n)
{
- sp_instr_jump *i;
- uint ip= sp->instructions();
- uint n;
- /*
- When jumping to a BEGIN-END block end, the target jump
- points to the block hpop/cpop cleanup instructions,
- so we should exclude the block context here.
- When jumping to something else (i.e., SP_LAB_ITER),
- there are no hpop/cpop at the jump destination,
- so we should include the block context here for cleanup.
- */
- bool exclusive= (lab->type == sp_label::BEGIN);
-
- n= ctx->diff_handlers(lab->ctx, exclusive);
- if (n)
- {
- sp_instr_hpop *hpop= new (lex->thd->mem_root)
- sp_instr_hpop(ip++, ctx, n);
- if (hpop == NULL)
- MYSQL_YYABORT;
- sp->add_instr(hpop);
- }
- n= ctx->diff_cursors(lab->ctx, exclusive);
- if (n)
- {
- sp_instr_cpop *cpop= new (lex->thd->mem_root)
- sp_instr_cpop(ip++, ctx, n);
- if (cpop == NULL)
- MYSQL_YYABORT;
- sp->add_instr(cpop);
- }
- i= new (lex->thd->mem_root) sp_instr_jump(ip, ctx);
- if (i == NULL)
+ sp_instr_cpop *cpop= new (thd->mem_root)
+ sp_instr_cpop(ip++, ctx, n);
+ if (cpop == NULL)
MYSQL_YYABORT;
- sp->push_backpatch(thd, i, lab); /* Jumping forward */
- sp->add_instr(i);
+ sp->add_instr(cpop);
}
+ i= new (thd->mem_root) sp_instr_jump(ip, ctx);
+ if (i == NULL)
+ MYSQL_YYABORT;
+ sp->push_backpatch(thd, i, lab); /* Jumping forward */
+ sp->add_instr(i);
}
;
@@ -3937,40 +3859,35 @@ sp_proc_stmt_iterate:
sp_label *lab= ctx->find_label($2);
if (! lab || lab->type != sp_label::ITERATION)
+ my_yyabort_error((ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str));
+
+ sp_instr_jump *i;
+ uint ip= sp->instructions();
+ uint n;
+
+ n= ctx->diff_handlers(lab->ctx, FALSE); /* Inclusive the dest. */
+ if (n)
{
- my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str);
- MYSQL_YYABORT;
+ sp_instr_hpop *hpop= new (thd->mem_root)
+ sp_instr_hpop(ip++, ctx, n);
+ if (hpop == NULL ||
+ sp->add_instr(hpop))
+ MYSQL_YYABORT;
}
- else
+ n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */
+ if (n)
{
- sp_instr_jump *i;
- uint ip= sp->instructions();
- uint n;
-
- n= ctx->diff_handlers(lab->ctx, FALSE); /* Inclusive the dest. */
- if (n)
- {
- sp_instr_hpop *hpop= new (lex->thd->mem_root)
- sp_instr_hpop(ip++, ctx, n);
- if (hpop == NULL ||
- sp->add_instr(hpop))
- MYSQL_YYABORT;
- }
- n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */
- if (n)
- {
- sp_instr_cpop *cpop= new (lex->thd->mem_root)
- sp_instr_cpop(ip++, ctx, n);
- if (cpop == NULL ||
- sp->add_instr(cpop))
- MYSQL_YYABORT;
- }
- i= new (lex->thd->mem_root)
- sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
- if (i == NULL ||
- sp->add_instr(i))
+ sp_instr_cpop *cpop= new (thd->mem_root)
+ sp_instr_cpop(ip++, ctx, n);
+ if (cpop == NULL ||
+ sp->add_instr(cpop))
MYSQL_YYABORT;
}
+ i= new (thd->mem_root)
+ sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
+ if (i == NULL ||
+ sp->add_instr(i))
+ MYSQL_YYABORT;
}
;
@@ -3983,11 +3900,8 @@ sp_proc_stmt_open:
sp_instr_copen *i;
if (! lex->spcont->find_cursor($2, &offset, false))
- {
- my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
- MYSQL_YYABORT;
- }
- i= new (lex->thd->mem_root)
+ my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $2.str));
+ i= new (thd->mem_root)
sp_instr_copen(sp->instructions(), lex->spcont, offset);
if (i == NULL ||
sp->add_instr(i))
@@ -4004,11 +3918,8 @@ sp_proc_stmt_fetch:
sp_instr_cfetch *i;
if (! lex->spcont->find_cursor($3, &offset, false))
- {
- my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
- i= new (lex->thd->mem_root)
+ my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $3.str));
+ i= new (thd->mem_root)
sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
if (i == NULL ||
sp->add_instr(i))
@@ -4027,11 +3938,8 @@ sp_proc_stmt_close:
sp_instr_cclose *i;
if (! lex->spcont->find_cursor($2, &offset, false))
- {
- my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
- MYSQL_YYABORT;
- }
- i= new (lex->thd->mem_root)
+ my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $2.str));
+ i= new (thd->mem_root)
sp_instr_cclose(sp->instructions(), lex->spcont, offset);
if (i == NULL ||
sp->add_instr(i))
@@ -4054,17 +3962,11 @@ sp_fetch_list:
sp_variable *spv;
if (!spc || !(spv = spc->find_variable($1, false)))
- {
- my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
- else
- {
- /* An SP local variable */
- sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
+ my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));
- i->add_to_varlist(spv);
- }
+ /* An SP local variable */
+ sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
+ i->add_to_varlist(spv);
}
| sp_fetch_list ',' ident
{
@@ -4074,17 +3976,11 @@ sp_fetch_list:
sp_variable *spv;
if (!spc || !(spv = spc->find_variable($3, false)))
- {
- my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
- else
- {
- /* An SP local variable */
- sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
+ my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $3.str));
- i->add_to_varlist(spv);
- }
+ /* An SP local variable */
+ sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
+ i->add_to_varlist(spv);
}
;
@@ -4096,7 +3992,7 @@ sp_if:
sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont;
uint ip= sp->instructions();
- sp_instr_jump_if_not *i= new (lex->thd->mem_root)
+ sp_instr_jump_if_not *i= new (thd->mem_root)
sp_instr_jump_if_not(ip, ctx, $2, lex);
if (i == NULL ||
sp->push_backpatch(thd, i, ctx->push_label(thd, empty_lex_str, 0)) ||
@@ -4304,10 +4200,7 @@ sp_labeled_block:
sp_label *lab= ctx->find_label($1);
if (lab)
- {
- my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_LABEL_REDEFINE, MYF(0), $1.str));
lex->name= $1;
}
sp_block_content sp_opt_label
@@ -4315,10 +4208,7 @@ sp_labeled_block:
if ($6.str)
{
if (my_strcasecmp(system_charset_info, $6.str, $5->name.str) != 0)
- {
- my_error(ER_SP_LABEL_MISMATCH, MYF(0), $6.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_LABEL_MISMATCH, MYF(0), $6.str));
}
}
;
@@ -4372,7 +4262,7 @@ sp_block_content:
}
if ($2.curs)
{
- i= new (lex->thd->mem_root)
+ i= new (thd->mem_root)
sp_instr_cpop(sp->instructions(), ctx, $2.curs);
if (i == NULL ||
sp->add_instr(i))
@@ -4389,7 +4279,7 @@ loop_body:
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */
- sp_instr_jump *i= new (lex->thd->mem_root)
+ sp_instr_jump *i= new (thd->mem_root)
sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL ||
lex->sphead->add_instr(i))
@@ -4403,7 +4293,7 @@ while_body:
LEX *lex= Lex;
sp_head *sp= lex->sphead;
uint ip= sp->instructions();
- sp_instr_jump_if_not *i= new (lex->thd->mem_root)
+ sp_instr_jump_if_not *i= new (thd->mem_root)
sp_instr_jump_if_not(ip, lex->spcont, $1, lex);
if (i == NULL ||
/* Jumping forward */
@@ -4419,7 +4309,7 @@ while_body:
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */
- sp_instr_jump *i= new (lex->thd->mem_root)
+ sp_instr_jump *i= new (thd->mem_root)
sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL ||
lex->sphead->add_instr(i))
@@ -4436,7 +4326,7 @@ repeat_body:
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */
- sp_instr_jump_if_not *i= new (lex->thd->mem_root)
+ sp_instr_jump_if_not *i= new (thd->mem_root)
sp_instr_jump_if_not(ip, lex->spcont, $4, lab->ip, lex);
if (i == NULL ||
lex->sphead->add_instr(i))
@@ -4457,10 +4347,7 @@ pop_sp_label:
{
if (my_strcasecmp(system_charset_info, $1.str,
lab->name.str) != 0)
- {
- my_error(ER_SP_LABEL_MISMATCH, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_LABEL_MISMATCH, MYF(0), $1.str));
}
}
;
@@ -4827,10 +4714,7 @@ opt_ts_nodegroup:
{
LEX *lex= Lex;
if (lex->alter_tablespace_info->nodegroup_id != UNDEF_NODEGROUP)
- {
- my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NODEGROUP");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NODEGROUP"));
lex->alter_tablespace_info->nodegroup_id= $3;
}
;
@@ -4840,10 +4724,7 @@ opt_ts_comment:
{
LEX *lex= Lex;
if (lex->alter_tablespace_info->ts_comment != NULL)
- {
- my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"COMMENT");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"COMMENT"));
lex->alter_tablespace_info->ts_comment= $3.str;
}
;
@@ -4853,11 +4734,8 @@ opt_ts_engine:
{
LEX *lex= Lex;
if (lex->alter_tablespace_info->storage_engine != NULL)
- {
- my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),
- "STORAGE ENGINE");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE, MYF(0),
+ "STORAGE ENGINE"));
lex->alter_tablespace_info->storage_engine= $4;
}
;
@@ -4877,10 +4755,7 @@ ts_wait:
{
LEX *lex= Lex;
if (!(lex->alter_tablespace_info->wait_until_completed))
- {
- my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NO_WAIT");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NO_WAIT"));
lex->alter_tablespace_info->wait_until_completed= FALSE;
}
;
@@ -4912,23 +4787,14 @@ size_number:
text_shift_number+=10;
break;
default:
- {
- my_error(ER_WRONG_SIZE_NUMBER, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_SIZE_NUMBER, MYF(0)));
}
if (prefix_number >> 31)
- {
- my_error(ER_SIZE_OVERFLOW_ERROR, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SIZE_OVERFLOW_ERROR, MYF(0)));
number= prefix_number << text_shift_number;
}
else
- {
- my_error(ER_WRONG_SIZE_NUMBER, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_SIZE_NUMBER, MYF(0)));
$$= number;
}
;
@@ -4948,7 +4814,10 @@ create_body:
CREATE TABLE t1 (SELECT 1);
*/
| '(' create_select_query_specification ')'
- { Select->set_braces(1);} union_opt {}
+ | '(' create_select_query_specification ')'
+ { Select->set_braces(1);} union_list {}
+ | '(' create_select_query_specification ')'
+ { Select->set_braces(1);} union_order_or_limit {}
| create_like
{
@@ -4980,7 +4849,10 @@ create_select_query_expression_body:
| SELECT_SYM create_select_part2 create_select_part3_union_not_ready
create_select_part4
| '(' create_select_query_specification ')'
- { Select->set_braces(1);} union_opt {}
+ | '(' create_select_query_specification ')'
+ { Select->set_braces(1);} union_list {}
+ | '(' create_select_query_specification ')'
+ { Select->set_braces(1);} union_order_or_limit {}
;
opt_create_partitioning:
@@ -5049,15 +4921,11 @@ have_partitioning:
#ifdef WITH_PARTITION_STORAGE_ENGINE
LEX_STRING partition_name={C_STRING_WITH_LEN("partition")};
if (!plugin_is_ready(&partition_name, MYSQL_STORAGE_ENGINE_PLUGIN))
- {
- my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
- "--skip-partition");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_OPTION_PREVENTS_STATEMENT, MYF(0),
+ "--skip-partition"));
#else
- my_error(ER_FEATURE_DISABLED, MYF(0), "partitioning",
- "--with-plugin-partition");
- MYSQL_YYABORT;
+ my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), "partitioning",
+ "--with-plugin-partition"));
#endif
}
;
@@ -5080,7 +4948,9 @@ partition_entry:
;
partition:
- BY part_type_def opt_num_parts opt_sub_part part_defs
+ BY
+ { Lex->safe_to_cache_query= 1; }
+ part_type_def opt_num_parts opt_sub_part part_defs
;
part_type_def:
@@ -5113,7 +4983,7 @@ opt_linear:
opt_key_algo:
/* empty */
{ Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_NONE;}
- | ALGORITHM_SYM EQ real_ulong_num
+ | ALGORITHM_SYM '=' real_ulong_num
{
switch ($3) {
case 1:
@@ -5150,11 +5020,8 @@ part_field_item:
MYSQL_YYABORT;
}
if (part_info->num_columns > MAX_REF_PARTS)
- {
- my_error(ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
- "list of partition fields");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
+ "list of partition fields"));
}
;
@@ -5195,10 +5062,7 @@ opt_num_parts:
uint num_parts= $2;
partition_info *part_info= Lex->part_info;
if (num_parts == 0)
- {
- my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_NO_PARTS_ERROR, MYF(0), "partitions"));
part_info->num_parts= num_parts;
part_info->use_default_num_partitions= FALSE;
@@ -5235,22 +5099,15 @@ sub_part_field_item:
MYSQL_YYABORT;
}
if (part_info->subpart_field_list.elements > MAX_REF_PARTS)
- {
- my_error(ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
- "list of subpartition fields");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
+ "list of subpartition fields"));
}
;
part_func_expr:
bit_expr
{
- LEX *lex= Lex;
- bool not_corr_func;
- not_corr_func= !lex->safe_to_cache_query;
- lex->safe_to_cache_query= 1;
- if (not_corr_func)
+ if (!Lex->safe_to_cache_query)
{
my_parse_error(thd, ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT;
@@ -5266,10 +5123,7 @@ opt_num_subparts:
uint num_parts= $2;
LEX *lex= Lex;
if (num_parts == 0)
- {
- my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_NO_PARTS_ERROR, MYF(0), "subpartitions"));
lex->part_info->num_subparts= num_parts;
lex->part_info->use_default_num_subpartitions= FALSE;
}
@@ -5280,17 +5134,11 @@ part_defs:
{
partition_info *part_info= Lex->part_info;
if (part_info->part_type == RANGE_PARTITION)
- {
- my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
- "RANGE");
- MYSQL_YYABORT;
- }
- else if (part_info->part_type == LIST_PARTITION)
- {
- my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
- "LIST");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
+ "RANGE"));
+ if (part_info->part_type == LIST_PARTITION)
+ my_yyabort_error((ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
+ "LIST"));
}
| '(' part_def_list ')'
{
@@ -5360,17 +5208,11 @@ opt_part_values:
if (! lex->is_partition_management())
{
if (part_info->part_type == RANGE_PARTITION)
- {
- my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
- "RANGE", "LESS THAN");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
+ "RANGE", "LESS THAN"));
if (part_info->part_type == LIST_PARTITION)
- {
- my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
- "LIST", "IN");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
+ "LIST", "IN"));
}
else
part_info->part_type= HASH_PARTITION;
@@ -5382,11 +5224,8 @@ opt_part_values:
if (! lex->is_partition_management())
{
if (part_info->part_type != RANGE_PARTITION)
- {
- my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
- "RANGE", "LESS THAN");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
+ "RANGE", "LESS THAN"));
}
else
part_info->part_type= RANGE_PARTITION;
@@ -5399,11 +5238,8 @@ opt_part_values:
if (! lex->is_partition_management())
{
if (part_info->part_type != LIST_PARTITION)
- {
- my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
- "LIST", "IN");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
+ "LIST", "IN"));
}
else
part_info->part_type= LIST_PARTITION;
@@ -6017,12 +5853,16 @@ create_table_option:
}
| IDENT_sys equal TEXT_STRING_sys
{
+ if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
new (thd->mem_root)
engine_option_value($1, $3, true, &Lex->create_info.option_list,
&Lex->option_list_last);
}
| IDENT_sys equal ident
{
+ if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
new (thd->mem_root)
engine_option_value($1, $3, false, &Lex->create_info.option_list,
&Lex->option_list_last);
@@ -6077,10 +5917,7 @@ storage_engines:
else
{
if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
- {
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str));
$$= 0;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_UNKNOWN_STORAGE_ENGINE,
@@ -6097,10 +5934,7 @@ known_storage_engines:
if ((plugin= ha_resolve_by_name(thd, &$1, false)))
$$= plugin_hton(plugin);
else
- {
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str));
}
;
@@ -6143,11 +5977,14 @@ field_list:
field_list_item:
column_def { }
| key_def
+ | constraint_def
;
column_def:
- field_spec opt_check_constraint { $$= $1; }
- | field_spec references { $$= $1; }
+ field_spec opt_check_constraint
+ { $$= $1; $$->check_constraint= $2; }
+ | field_spec references
+ { $$= $1; }
;
key_def:
@@ -6231,16 +6068,31 @@ key_def:
/* Only used for ALTER TABLE. Ignored otherwise. */
lex->alter_info.flags|= Alter_info::ADD_FOREIGN_KEY;
}
- | opt_constraint check_constraint { }
- ;
+ ;
+
+constraint_def:
+ opt_constraint check_constraint
+ {
+ Lex->add_constraint(&$1, $2);
+ }
+ ;
opt_check_constraint:
- /* empty */
- | check_constraint
+ /* empty */ { $$= (Virtual_column_info*) 0; }
+ | check_constraint { $$= $1;}
;
check_constraint:
- CHECK_SYM '(' expr ')'
+ CHECK_SYM '(' remember_name expr remember_end ')'
+ {
+ Virtual_column_info *v=
+ add_virtual_expression(thd, $3+1, (uint)($5 - $3) - 1, $4);
+ if (!v)
+ {
+ MYSQL_YYABORT;
+ }
+ $$= v;
+ }
;
opt_constraint:
@@ -6260,10 +6112,7 @@ field_spec:
if (check_string_char_length(&$1, 0, NAME_CHAR_LEN,
system_charset_info, 1))
- {
- my_error(ER_TOO_LONG_IDENT, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str));
if (!f)
MYSQL_YYABORT;
@@ -6292,8 +6141,8 @@ field_spec:
field_def:
opt_attribute
- | opt_generated_always AS
- '(' virtual_column_func ')'
+ | opt_generated_always AS virtual_column_func
+ { Lex->last_field->vcol_info= $3; }
vcol_opt_specifier vcol_opt_attribute
;
@@ -6315,6 +6164,10 @@ vcol_opt_specifier:
{
Lex->last_field->vcol_info->set_stored_in_db_flag(TRUE);
}
+ | STORED_SYM
+ {
+ Lex->last_field->vcol_info->set_stored_in_db_flag(TRUE);
+ }
;
vcol_opt_attribute:
@@ -6344,38 +6197,65 @@ vcol_attribute:
;
parse_vcol_expr:
- PARSE_VCOL_EXPR_SYM '(' virtual_column_func ')'
+ PARSE_VCOL_EXPR_SYM virtual_column_func
{
/*
"PARSE_VCOL_EXPR" can only be used by the SQL server
when reading a '*.frm' file.
Prevent the end user from invoking this command.
*/
- if (!Lex->parse_vcol_expr)
- {
- my_message(ER_SYNTAX_ERROR, ER_THD(thd, ER_SYNTAX_ERROR), MYF(0));
- MYSQL_YYABORT;
- }
+ MYSQL_YYABORT_UNLESS(Lex->parse_vcol_expr);
+ Lex->last_field->vcol_info= $2;
}
;
+parenthesized_expr:
+ subselect
+ {
+ $$= new (thd->mem_root) Item_singlerow_subselect(thd, $1);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | expr
+ | expr ',' expr_list
+ {
+ $3->push_front($1, thd->mem_root);
+ $$= new (thd->mem_root) Item_row(thd, *$3);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ ;
+
virtual_column_func:
- remember_name expr remember_end
+ '(' remember_cur_pos parenthesized_expr remember_end ')'
{
- Virtual_column_info *v= new (thd->mem_root) Virtual_column_info();
+ Virtual_column_info *v=
+ add_virtual_expression(thd, $2, (uint)($4 - $2), $3);
if (!v)
{
- mem_alloc_error(sizeof(Virtual_column_info));
MYSQL_YYABORT;
}
- uint expr_len= (uint)($3 - $1) - 1;
- v->expr_str.str= (char* ) thd->memdup($1 + 1, expr_len);
- v->expr_str.length= expr_len;
- v->expr_item= $2;
- Lex->last_field->vcol_info= v;
+ $$= v;
}
;
+expr_or_literal: column_default_non_parenthesized_expr | signed_literal ;
+
+column_default_expr:
+ virtual_column_func
+ | remember_name expr_or_literal opt_impossible_action remember_end
+ {
+ if (!($$= add_virtual_expression(thd, $1, (uint) ($4- $1), $2)))
+ MYSQL_YYABORT;
+ }
+ ;
+
+/* This is to force remember_end to look at next token */
+opt_impossible_action:
+ IMPOSSIBLE_ACTION {}
+ | /* empty */ {}
+
+
field_type:
int_type opt_field_length field_options { $$.set($1, $2); }
| real_type opt_precision field_options { $$.set($1, $2); }
@@ -6387,12 +6267,9 @@ field_type:
int err;
ulonglong tmp_length= my_strtoll10($2.length(), NULL, &err);
if (err || tmp_length > PRECISION_FOR_DOUBLE)
- {
- my_error(ER_WRONG_FIELD_SPEC, MYF(0),
- Lex->last_field->field_name);
- MYSQL_YYABORT;
- }
- else if (tmp_length > PRECISION_FOR_FLOAT)
+ my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
+ Lex->last_field->field_name));
+ if (tmp_length > PRECISION_FOR_FLOAT)
$$.set(MYSQL_TYPE_DOUBLE);
else
$$.set(MYSQL_TYPE_FLOAT);
@@ -6498,9 +6375,8 @@ field_type:
Lex->last_field->geom_type= $1;
$$.set(MYSQL_TYPE_GEOMETRY, $2);
#else
- my_error(ER_FEATURE_DISABLED, MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
- MYSQL_YYABORT;
+ my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
+ sym_group_geom.needed_define));
#endif
}
| MEDIUMBLOB
@@ -6605,7 +6481,7 @@ srid_option:
/* empty */
{ Lex->last_field->srid= 0; }
|
- REF_SYSTEM_ID_SYM EQ NUM
+ REF_SYSTEM_ID_SYM '=' NUM
{
Lex->last_field->srid=atoi($3.str);
}
@@ -6669,7 +6545,7 @@ opt_attribute_list:
attribute:
NULL_SYM { Lex->last_field->flags&= ~ NOT_NULL_FLAG; }
| not NULL_SYM { Lex->last_field->flags|= NOT_NULL_FLAG; }
- | DEFAULT now_or_signed_literal { Lex->last_field->def= $2; }
+ | DEFAULT column_default_expr { Lex->last_field->default_value= $2; }
| ON UPDATE_SYM NOW_SYM opt_default_time_precision
{
Item *item= new (thd->mem_root) Item_func_now_local(thd, $4);
@@ -6706,24 +6582,22 @@ attribute:
| COLLATE_SYM collation_name
{
if (Lex->charset && !my_charset_same(Lex->charset,$2))
- {
- my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
- $2->name,Lex->charset->csname);
- MYSQL_YYABORT;
- }
- else
- {
- Lex->last_field->charset= $2;
- }
+ my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ $2->name,Lex->charset->csname));
+ Lex->last_field->charset= $2;
}
| IDENT_sys equal TEXT_STRING_sys
{
+ if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
new (thd->mem_root)
engine_option_value($1, $3, true, &Lex->last_field->option_list,
&Lex->option_list_last);
}
| IDENT_sys equal ident
{
+ if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
new (thd->mem_root)
engine_option_value($1, $3, false, &Lex->last_field->option_list,
&Lex->option_list_last);
@@ -6756,18 +6630,6 @@ type_with_opt_collate:
}
;
-
-now_or_signed_literal:
- NOW_SYM opt_default_time_precision
- {
- $$= new (thd->mem_root) Item_func_now_local(thd, $2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | signed_literal
- { $$=$1; }
- ;
-
charset:
CHAR_SYM SET {}
| CHARSET {}
@@ -6777,10 +6639,7 @@ charset_name:
ident_or_text
{
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
- {
- my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str));
}
| BINARY { $$= &my_charset_bin; }
;
@@ -6800,10 +6659,7 @@ old_or_new_charset_name:
{
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
!($$=get_old_charset_by_name($1.str)))
- {
- my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str));
}
| BINARY { $$= &my_charset_bin; }
;
@@ -6842,10 +6698,7 @@ charset_or_alias:
| UNICODE_SYM
{
if (!($$= get_charset_by_csname("ucs2", MY_CS_PRIMARY,MYF(0))))
- {
- my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2"));
}
;
@@ -7061,9 +6914,8 @@ spatial:
#ifdef HAVE_SPATIAL
$$= Key::SPATIAL;
#else
- my_error(ER_FEATURE_DISABLED, MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
- MYSQL_YYABORT;
+ my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
+ sym_group_geom.needed_define));
#endif
}
;
@@ -7122,12 +6974,16 @@ all_key_opt:
{ Lex->last_key->key_create_info.comment= $2; }
| IDENT_sys equal TEXT_STRING_sys
{
+ if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
new (thd->mem_root)
engine_option_value($1, $3, true, &Lex->option_list,
&Lex->option_list_last);
}
| IDENT_sys equal ident
{
+ if ($3.length > ENGINE_OPTION_MAX_LENGTH)
+ my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str));
new (thd->mem_root)
engine_option_value($1, $3, false, &Lex->option_list,
&Lex->option_list_last);
@@ -7161,10 +7017,7 @@ fulltext_key_opt:
if (plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN))
Lex->last_key->key_create_info.parser_name= $3;
else
- {
- my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str));
}
;
@@ -7196,9 +7049,7 @@ key_part:
{
int key_part_len= atoi($3.str);
if (!key_part_len)
- {
- my_error(ER_KEY_PART_0, MYF(0), $1.str);
- }
+ my_yyabort_error((ER_KEY_PART_0, MYF(0), $1.str));
$$= new (thd->mem_root) Key_part_spec($1, (uint) key_part_len);
if ($$ == NULL)
MYSQL_YYABORT;
@@ -7278,10 +7129,7 @@ alter:
{
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_NO_DROP_SP, MYF(0), "DATABASE");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "DATABASE"));
lex->sql_command= SQLCOM_ALTER_DB_UPGRADE;
lex->name= $3;
}
@@ -7290,10 +7138,7 @@ alter:
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"));
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
sp_a_chistics
@@ -7308,10 +7153,7 @@ alter:
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
sp_a_chistics
@@ -7326,10 +7168,7 @@ alter:
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"));
lex->create_view_mode= VIEW_ALTER;
}
view_tail
@@ -7344,10 +7183,7 @@ alter:
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"));
lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT;
lex->create_view_mode= VIEW_ALTER;
}
@@ -7720,6 +7556,10 @@ alter_list_item:
Lex->alter_info.flags|= Alter_info::ALTER_ADD_COLUMN |
Alter_info::ALTER_ADD_INDEX;
}
+ | ADD constraint_def
+ {
+ Lex->alter_info.flags|= Alter_info::ALTER_ADD_CHECK_CONSTRAINT;
+ }
| CHANGE opt_column opt_if_exists_table_element field_ident
field_spec opt_place
{
@@ -7746,6 +7586,17 @@ alter_list_item:
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= Alter_info::ALTER_DROP_COLUMN;
}
+ | DROP CONSTRAINT opt_if_exists_table_element field_ident
+ {
+ LEX *lex=Lex;
+ Alter_drop *ad= (new (thd->mem_root)
+ Alter_drop(Alter_drop::CHECK_CONSTRAINT,
+ $4.str, $3));
+ if (ad == NULL)
+ MYSQL_YYABORT;
+ lex->alter_info.drop_list.push_back(ad, thd->mem_root);
+ lex->alter_info.flags|= Alter_info::ALTER_DROP_CHECK_CONSTRAINT;
+ }
| DROP FOREIGN KEY_SYM opt_if_exists_table_element field_ident
{
LEX *lex=Lex;
@@ -7789,7 +7640,7 @@ alter_list_item:
lex->alter_info.keys_onoff= Alter_info::ENABLE;
lex->alter_info.flags|= Alter_info::ALTER_KEYS_ONOFF;
}
- | ALTER opt_column field_ident SET DEFAULT signed_literal
+ | ALTER opt_column field_ident SET DEFAULT column_default_expr
{
LEX *lex=Lex;
Alter_column *ac= new (thd->mem_root) Alter_column($3.str,$6);
@@ -7802,7 +7653,7 @@ alter_list_item:
{
LEX *lex=Lex;
Alter_column *ac= (new (thd->mem_root)
- Alter_column($3.str, (Item*) 0));
+ Alter_column($3.str, (Virtual_column_info*) 0));
if (ac == NULL)
MYSQL_YYABORT;
lex->alter_info.alter_list.push_back(ac, thd->mem_root);
@@ -7820,10 +7671,7 @@ alter_list_item:
}
if (check_table_name($3->table.str,$3->table.length, FALSE) ||
($3->db.str && check_db_name(&$3->db)))
- {
- my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3->table.str));
lex->name= $3->table;
lex->alter_info.flags|= Alter_info::ALTER_RENAME;
}
@@ -7835,15 +7683,11 @@ alter_list_item:
}
$5= $5 ? $5 : $4;
if (!my_charset_same($4,$5))
- {
- my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
- $5->name, $4->csname);
- MYSQL_YYABORT;
- }
- LEX *lex= Lex;
- if (lex->create_info.add_alter_list_item_convert_to_charset($5))
+ my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ $5->name, $4->csname));
+ if (Lex->create_info.add_alter_list_item_convert_to_charset($5))
MYSQL_YYABORT;
- lex->alter_info.flags|= Alter_info::ALTER_CONVERT;
+ Lex->alter_info.flags|= Alter_info::ALTER_CONVERT;
}
| create_table_options_space_separated
{
@@ -7884,10 +7728,7 @@ alter_algorithm_option:
| ALGORITHM_SYM opt_equal ident
{
if (Lex->alter_info.set_requested_algorithm(&$3))
- {
- my_error(ER_UNKNOWN_ALTER_ALGORITHM, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_UNKNOWN_ALTER_ALGORITHM, MYF(0), $3.str));
}
;
@@ -7900,10 +7741,7 @@ alter_lock_option:
| LOCK_SYM opt_equal ident
{
if (Lex->alter_info.set_requested_lock(&$3))
- {
- my_error(ER_UNKNOWN_ALTER_LOCK, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_UNKNOWN_ALTER_LOCK, MYF(0), $3.str));
}
;
@@ -7963,7 +7801,7 @@ opt_place:
opt_to:
/* empty */ {}
| TO_SYM {}
- | EQ {}
+ | '=' {}
| AS {}
;
@@ -8079,13 +7917,9 @@ slave_until:
(lex->mi.relay_log_name || lex->mi.relay_log_pos)) ||
!((lex->mi.log_file_name && lex->mi.pos) ||
(lex->mi.relay_log_name && lex->mi.relay_log_pos)))
- {
- my_message(ER_BAD_SLAVE_UNTIL_COND,
- ER_THD(thd, ER_BAD_SLAVE_UNTIL_COND), MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_BAD_SLAVE_UNTIL_COND, MYF(0)));
}
- | UNTIL_SYM MASTER_GTID_POS_SYM EQ TEXT_STRING_sys
+ | UNTIL_SYM MASTER_GTID_POS_SYM '=' TEXT_STRING_sys
{
Lex->mi.gtid_pos_str = $4;
}
@@ -8101,7 +7935,7 @@ checksum:
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_CHECKSUM;
- /* Will be overriden during execution. */
+ /* Will be overridden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
table_list opt_checksum_type
@@ -8127,7 +7961,7 @@ repair:
lex->no_write_to_binlog= $2;
lex->check_opt.init();
lex->alter_info.reset();
- /* Will be overriden during execution. */
+ /* Will be overridden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
repair_table_or_view
@@ -8169,7 +8003,7 @@ analyze:
lex->no_write_to_binlog= $2;
lex->check_opt.init();
lex->alter_info.reset();
- /* Will be overriden during execution. */
+ /* Will be overridden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
analyze_table_list
@@ -8291,17 +8125,14 @@ check: CHECK_SYM
lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init();
lex->alter_info.reset();
- /* Will be overriden during execution. */
+ /* Will be overridden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
check_view_or_table
{
LEX* lex= thd->lex;
if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "CHECK"));
DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_check_table();
if (lex->m_sql_cmd == NULL)
@@ -8341,7 +8172,7 @@ optimize:
lex->no_write_to_binlog= $2;
lex->check_opt.init();
lex->alter_info.reset();
- /* Will be overriden during execution. */
+ /* Will be overridden during execution. */
YYPS->m_lock_type= TL_UNLOCK;
}
table_list
@@ -8398,9 +8229,9 @@ table_to_table:
{
LEX *lex=Lex;
SELECT_LEX *sl= lex->current_select;
- if (!sl->add_table_to_list(lex->thd, $1,NULL,TL_OPTION_UPDATING,
+ if (!sl->add_table_to_list(thd, $1,NULL,TL_OPTION_UPDATING,
TL_IGNORE, MDL_EXCLUSIVE) ||
- !sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING,
+ !sl->add_table_to_list(thd, $3,NULL,TL_OPTION_UPDATING,
TL_IGNORE, MDL_EXCLUSIVE))
MYSQL_YYABORT;
}
@@ -8539,12 +8370,16 @@ select:
select_init:
SELECT_SYM select_options_and_item_list select_init3
- | '(' select_paren ')' union_opt
+ | '(' select_paren ')'
+ | '(' select_paren ')' union_list
+ | '(' select_paren ')' union_order_or_limit
;
union_list_part2:
SELECT_SYM select_options_and_item_list select_init3_union_query_term
- | '(' select_paren_union_query_term ')' union_opt
+ | '(' select_paren_union_query_term ')'
+ | '(' select_paren_union_query_term ')' union_list
+ | '(' select_paren_union_query_term ')' union_order_or_limit
;
select_paren:
@@ -8758,10 +8593,7 @@ select_options:
| select_option_list
{
if (Select->options & SELECT_DISTINCT && Select->options & SELECT_ALL)
- {
- my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT"));
}
;
@@ -8779,26 +8611,15 @@ select_option:
SQL_CACHE wasn't specified, and only once per query.
*/
if (Lex->current_select != &Lex->select_lex)
- {
- my_error(ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_NO_CACHE");
- MYSQL_YYABORT;
- }
- else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
- {
- my_error(ER_WRONG_USAGE, MYF(0), "SQL_CACHE", "SQL_NO_CACHE");
- MYSQL_YYABORT;
- }
- else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
- {
- my_error(ER_DUP_ARGUMENT, MYF(0), "SQL_NO_CACHE");
- MYSQL_YYABORT;
- }
- else
- {
- Lex->safe_to_cache_query=0;
- Lex->select_lex.options&= ~OPTION_TO_QUERY_CACHE;
- Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE;
- }
+ my_yyabort_error((ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_NO_CACHE"));
+ if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
+ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "SQL_CACHE", "SQL_NO_CACHE"));
+ if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SQL_NO_CACHE"));
+
+ Lex->safe_to_cache_query=0;
+ Lex->select_lex.options&= ~OPTION_TO_QUERY_CACHE;
+ Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE;
}
| SQL_CACHE_SYM
{
@@ -8807,26 +8628,15 @@ select_option:
SQL_NO_CACHE wasn't specified, and only once per query.
*/
if (Lex->current_select != &Lex->select_lex)
- {
- my_error(ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_CACHE");
- MYSQL_YYABORT;
- }
- else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
- {
- my_error(ER_WRONG_USAGE, MYF(0), "SQL_NO_CACHE", "SQL_CACHE");
- MYSQL_YYABORT;
- }
- else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
- {
- my_error(ER_DUP_ARGUMENT, MYF(0), "SQL_CACHE");
- MYSQL_YYABORT;
- }
- else
- {
- Lex->safe_to_cache_query=1;
- Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
- Lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE;
- }
+ my_yyabort_error((ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_CACHE"));
+ if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
+ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "SQL_NO_CACHE", "SQL_CACHE"));
+ if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SQL_CACHE"));
+
+ Lex->safe_to_cache_query=1;
+ Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
+ Lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE;
}
;
@@ -8879,10 +8689,7 @@ select_item:
{
if (Lex->sql_command == SQLCOM_CREATE_VIEW &&
check_column_name($4.str))
- {
- my_error(ER_WRONG_COLUMN_NAME, MYF(0), $4.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), $4.str));
$2->is_autogenerated_name= FALSE;
$2->set_name(thd, $4.str, $4.length, system_charset_info);
}
@@ -8899,6 +8706,12 @@ remember_tok_start:
}
;
+remember_cur_pos:
+ {
+ $$= (char*) YYLIP->get_cpp_ptr();
+ }
+ ;
+
remember_name:
{
$$= (char*) YYLIP->get_cpp_tok_start();
@@ -9103,13 +8916,13 @@ bool_pri:
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri comp_op predicate %prec EQ
+ | bool_pri comp_op predicate %prec '='
{
$$= (*$2)(0)->create(thd, $1, $3);
if ($$ == NULL)
MYSQL_YYABORT;
}
- | bool_pri comp_op all_or_any '(' subselect ')' %prec EQ
+ | bool_pri comp_op all_or_any '(' subselect ')' %prec '='
{
$$= all_any_subquery_creator(thd, $1, $2, $3, $5);
if ($$ == NULL)
@@ -9333,11 +9146,11 @@ not2:
;
comp_op:
- EQ { $$ = &comp_eq_creator; }
+ '=' { $$ = &comp_eq_creator; }
| GE { $$ = &comp_ge_creator; }
- | GT_SYM { $$ = &comp_gt_creator; }
+ | '>' { $$ = &comp_gt_creator; }
| LE { $$ = &comp_le_creator; }
- | LT { $$ = &comp_lt_creator; }
+ | '<' { $$ = &comp_lt_creator; }
| NE { $$ = &comp_ne_creator; }
;
@@ -9427,71 +9240,45 @@ dyncall_create_list:
}
;
-simple_expr:
+/*
+ Expressions that the parser allows in a column DEFAULT clause
+ without parentheses. These expressions cannot end with a COLLATE clause.
+
+ If we allowed any "expr" in DEFAULT clause, there would be a confusion
+ in queries like this:
+ CREATE TABLE t1 (a TEXT DEFAULT 'a' COLLATE latin1_bin);
+ It would be not clear what COLLATE stands for:
+ - the collation of the column `a`, or
+ - the collation of the string literal 'a'
+
+ This restriction allows to parse the above query unambiguiusly:
+ COLLATE belongs to the column rather than the literal.
+ If one needs COLLATE to belong to the literal, parentheses must be used:
+ CREATE TABLE t1 (a TEXT DEFAULT ('a' COLLATE latin1_bin));
+ Note: the COLLATE clause is rather meaningless here, but the query
+ is syntactically correct.
+
+ Note, some of the expressions are not actually allowed in DEFAULT,
+ e.g. sum_expr, window_func_expr, ROW(...), VALUES().
+ We could move them to simple_expr, but that would make
+ these two queries return a different error messages:
+ CREATE TABLE t1 (a INT DEFAULT AVG(1));
+ CREATE TABLE t1 (a INT DEFAULT (AVG(1)));
+ The first query would return "syntax error".
+ Currenly both return:
+ Function or expression 'avg(' is not allowed for 'DEFAULT' ...
+*/
+column_default_non_parenthesized_expr:
simple_ident
| function_call_keyword
| function_call_nonkeyword
| function_call_generic
| function_call_conflict
- | simple_expr COLLATE_SYM ident_or_text %prec NEG
- {
- Item *i1= new (thd->mem_root) Item_string(thd, $3.str,
- $3.length,
- thd->charset());
- if (i1 == NULL)
- MYSQL_YYABORT;
- $$= new (thd->mem_root) Item_func_set_collation(thd, $1, i1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
| literal
| param_marker { $$= $1; }
| variable
| sum_expr
| window_func_expr
- | simple_expr OR_OR_SYM simple_expr
- {
- $$= new (thd->mem_root) Item_func_concat(thd, $1, $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | '+' simple_expr %prec NEG
- {
- $$= $2;
- }
- | '-' simple_expr %prec NEG
- {
- $$= new (thd->mem_root) Item_func_neg(thd, $2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | '~' simple_expr %prec NEG
- {
- $$= new (thd->mem_root) Item_func_bit_neg(thd, $2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | not2 simple_expr %prec NEG
- {
- $$= negate_expression(thd, $2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | '(' subselect ')'
- {
- $$= new (thd->mem_root) Item_singlerow_subselect(thd, $2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | '(' expr ')'
- { $$= $2; }
- | '(' expr ',' expr_list ')'
- {
- $4->push_front($2, thd->mem_root);
- $$= new (thd->mem_root) Item_row(thd, *$4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
| ROW_SYM '(' expr ',' expr_list ')'
{
$5->push_front($3, thd->mem_root);
@@ -9539,13 +9326,6 @@ simple_expr:
Select->add_ftfunc_to_list(thd, i1);
$$= i1;
}
- | BINARY simple_expr %prec NEG
- {
- $$= create_func_cast(thd, $2, ITEM_CAST_CHAR, NULL, NULL,
- &my_charset_bin);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
| CAST_SYM '(' expr AS cast_type ')'
{
LEX *lex= Lex;
@@ -9577,11 +9357,7 @@ simple_expr:
{
Item_splocal *il= $3->get_item_splocal();
if (il)
- {
-
- my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str));
$$= new (thd->mem_root) Item_default_value(thd, Lex->current_context(),
$3);
if ($$ == NULL)
@@ -9594,6 +9370,57 @@ simple_expr:
if ($$ == NULL)
MYSQL_YYABORT;
}
+ ;
+
+simple_expr:
+ column_default_non_parenthesized_expr
+ | simple_expr COLLATE_SYM ident_or_text %prec NEG
+ {
+ Item *i1= new (thd->mem_root) Item_string(thd, $3.str,
+ $3.length,
+ thd->charset());
+ if (i1 == NULL)
+ MYSQL_YYABORT;
+ $$= new (thd->mem_root) Item_func_set_collation(thd, $1, i1);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | '(' parenthesized_expr ')' { $$= $2; }
+ | BINARY simple_expr %prec NEG
+ {
+ $$= create_func_cast(thd, $2, ITEM_CAST_CHAR, NULL, NULL,
+ &my_charset_bin);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | simple_expr OR_OR_SYM simple_expr
+ {
+ $$= new (thd->mem_root) Item_func_concat(thd, $1, $3);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | '+' simple_expr %prec NEG
+ {
+ $$= $2;
+ }
+ | '-' simple_expr %prec NEG
+ {
+ $$= $2->neg(thd);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | '~' simple_expr %prec NEG
+ {
+ $$= new (thd->mem_root) Item_func_bit_neg(thd, $2);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | not2 simple_expr %prec NEG
+ {
+ $$= negate_expression(thd, $2);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
| INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
/* we cannot put interval before - */
{
@@ -10197,9 +10024,8 @@ function_call_conflict:
if ($$ == NULL)
MYSQL_YYABORT;
#else
- my_error(ER_FEATURE_DISABLED, MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
- MYSQL_YYABORT;
+ my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
+ sym_group_geom.needed_define));
#endif
}
;
@@ -10361,10 +10187,7 @@ function_call_generic:
*/
if (!$1.str || check_db_name(&$1))
- {
- my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
if (check_routine_name(&$3))
{
MYSQL_YYABORT;
@@ -10674,10 +10497,7 @@ variable:
'@'
{
if (! Lex->parsing_options.allows_variable)
- {
- my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0)));
}
variable_aux
{
@@ -10736,20 +10556,7 @@ opt_gconcat_separator:
opt_gorder_clause:
/* empty */
- | ORDER_SYM BY
- {
- LEX *lex= Lex;
- SELECT_LEX *sel= lex->current_select;
- if (sel->linkage != GLOBAL_OPTIONS_TYPE &&
- sel->olap != UNSPECIFIED_OLAP_TYPE &&
- (sel->linkage != UNION_TYPE || sel->braces))
- {
- my_error(ER_WRONG_USAGE, MYF(0),
- "CUBE/ROLLUP", "ORDER BY");
- MYSQL_YYABORT;
- }
- }
- gorder_list;
+ | ORDER_SYM BY gorder_list;
;
gorder_list:
@@ -10882,7 +10689,7 @@ table_ref:
| join_table
{
LEX *lex= Lex;
- if (!($$= lex->current_select->nest_last_join(lex->thd)))
+ if (!($$= lex->current_select->nest_last_join(thd)))
{
my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT;
@@ -11145,7 +10952,7 @@ table_primary_derived:
Table_ident *ti= new (thd->mem_root) Table_ident(unit);
if (ti == NULL)
MYSQL_YYABORT;
- if (!($$= sel->add_table_to_list(lex->thd,
+ if (!($$= sel->add_table_to_list(thd,
ti, $5, 0,
TL_READ, MDL_SHARED_READ)))
@@ -11366,11 +11173,6 @@ get_select_lex_derived:
select_derived_init:
{
LEX *lex= Lex;
- if (! lex->parsing_options.allows_derived)
- {
- my_error(ER_VIEW_SELECT_DERIVED, MYF(0));
- MYSQL_YYABORT;
- }
TABLE_LIST *embedding= lex->current_select->embedding;
$$= embedding &&
@@ -11505,7 +11307,7 @@ date_time_type:
table_alias:
/* empty */
| AS
- | EQ
+ | '='
;
opt_table_alias:
@@ -11601,14 +11403,11 @@ olap_opt:
*/
LEX *lex=Lex;
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
- {
- my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE",
- "global union parameters");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "WITH CUBE",
+ "global union parameters"));
lex->current_select->olap= CUBE_TYPE;
- my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
- MYSQL_YYABORT;
+
+ my_yyabort_error((ER_NOT_SUPPORTED_YET, MYF(0), "CUBE"));
}
| WITH_ROLLUP_SYM
{
@@ -11621,11 +11420,8 @@ olap_opt:
*/
LEX *lex= Lex;
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
- {
- my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
- "global union parameters");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
+ "global union parameters"));
lex->current_select->olap= ROLLUP_TYPE;
}
;
@@ -11839,7 +11635,7 @@ order_clause:
if (!unit->is_union() &&
(first_sl->order_list.elements ||
first_sl->select_limit) &&
- unit->add_fake_select_lex(lex->thd))
+ unit->add_fake_select_lex(thd))
MYSQL_YYABORT;
}
if (sel->master_unit()->is_union() && !sel->braces)
@@ -11956,15 +11752,9 @@ limit_option:
lex->safe_to_cache_query=0;
}
else
- {
- my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));
if (splocal->type() != Item::INT_ITEM)
- {
- my_error(ER_WRONG_SPVAR_TYPE_IN_LIMIT, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_SPVAR_TYPE_IN_LIMIT, MYF(0)));
splocal->limit_clause_param= TRUE;
$$= splocal;
}
@@ -12085,7 +11875,7 @@ procedure_clause:
NULL, NULL, $2.str);
if (item == NULL)
MYSQL_YYABORT;
- if (add_proc_to_list(lex->thd, item))
+ if (add_proc_to_list(thd, item))
MYSQL_YYABORT;
Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
@@ -12169,10 +11959,7 @@ select_outvar:
sp_variable *t;
if (!Lex->spcont || !(t= Lex->spcont->find_variable($1, false)))
- {
- my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));
$$ = Lex->result ? (new (thd->mem_root)
my_var_sp($1, t->offset, t->sql_type(),
Lex->sphead)) :
@@ -12259,7 +12046,7 @@ drop:
lex->alter_info.reset();
lex->alter_info.flags= Alter_info::ALTER_DROP_INDEX;
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
- if (!lex->current_select->add_table_to_list(lex->thd, $6, NULL,
+ if (!lex->current_select->add_table_to_list(thd, $6, NULL,
TL_OPTION_UPDATING,
TL_READ_NO_INSERT,
MDL_SHARED_UPGRADABLE))
@@ -12276,17 +12063,11 @@ drop:
LEX *lex= thd->lex;
sp_name *spname;
if ($4.str && check_db_name(&$4))
- {
- my_error(ER_WRONG_DB_NAME, MYF(0), $4.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $4.str));
if (lex->sphead)
- {
- my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
lex->set_command(SQLCOM_DROP_FUNCTION, $3);
- spname= new (lex->thd->mem_root) sp_name($4, $6, true);
+ spname= new (thd->mem_root) sp_name($4, $6, true);
if (spname == NULL)
MYSQL_YYABORT;
spname->init_qname(thd);
@@ -12298,14 +12079,11 @@ drop:
LEX_STRING db= {0, 0};
sp_name *spname;
if (lex->sphead)
- {
- my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
if (thd->db && lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
lex->set_command(SQLCOM_DROP_FUNCTION, $3);
- spname= new (lex->thd->mem_root) sp_name(db, $4, false);
+ spname= new (thd->mem_root) sp_name(db, $4, false);
if (spname == NULL)
MYSQL_YYABORT;
spname->init_qname(thd);
@@ -12315,10 +12093,7 @@ drop:
{
LEX *lex=Lex;
if (lex->sphead)
- {
- my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"));
lex->set_command(SQLCOM_DROP_PROCEDURE, $3);
lex->spname= $4;
}
@@ -12574,7 +12349,7 @@ ident_eq_value:
;
equal:
- EQ {}
+ '=' {}
| SET_VAR {}
;
@@ -13352,19 +13127,14 @@ opt_extended_describe:
opt_format_json:
/* empty */ {}
- | FORMAT_SYM EQ ident_or_text
+ | FORMAT_SYM '=' ident_or_text
{
if (!my_strcasecmp(system_charset_info, $3.str, "JSON"))
Lex->explain_json= true;
else if (!my_strcasecmp(system_charset_info, $3.str, "TRADITIONAL"))
- {
DBUG_ASSERT(Lex->explain_json==false);
- }
else
- {
- my_error(ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), $3.str));
}
;
@@ -13461,10 +13231,7 @@ flush_option:
{
LEX *lex= Lex;
if (lex->type & REFRESH_RELAY_LOG)
- {
- my_error(ER_WRONG_USAGE, MYF(0), "FLUSH", "RELAY LOGS");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "FLUSH", "RELAY LOGS"));
lex->type|= REFRESH_RELAY_LOG;
lex->relay_log_connection_name= lex->mi.connection_name;
}
@@ -13485,10 +13252,7 @@ flush_option:
{
LEX *lex= Lex;
if (lex->type & REFRESH_SLAVE)
- {
- my_error(ER_WRONG_USAGE, MYF(0), "FLUSH","SLAVE");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "FLUSH","SLAVE"));
lex->type|= REFRESH_SLAVE;
lex->reset_slave_info.all= false;
}
@@ -13967,25 +13731,18 @@ param_marker:
Lex_input_stream *lip= YYLIP;
Item_param *item;
if (! lex->parsing_options.allows_variable)
- {
- my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0)));
const char *query_start= lex->sphead ? lex->sphead->m_tmp_query
: thd->query();
item= new (thd->mem_root) Item_param(thd, lip->get_tok_start() -
query_start);
if (!($$= item) || lex->param_list.push_back(item, thd->mem_root))
- {
- my_message(ER_OUT_OF_RESOURCES, ER_THD(thd, ER_OUT_OF_RESOURCES), MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_OUT_OF_RESOURCES, MYF(0)));
}
;
signed_literal:
- literal { $$ = $1; }
- | '+' NUM_literal { $$ = $2; }
+ '+' NUM_literal { $$ = $2; }
| '-' NUM_literal
{
$2->max_length++;
@@ -14268,10 +14025,7 @@ simple_ident:
{
/* We're compiling a stored procedure and found a variable */
if (! lex->parsing_options.allows_variable)
- {
- my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0)));
Item_splocal *splocal;
splocal= new (thd->mem_root)
@@ -14347,17 +14101,11 @@ simple_ident_q:
if (lex->trg_chistics.event == TRG_EVENT_INSERT &&
!new_row)
- {
- my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "OLD", "on INSERT");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "OLD", "on INSERT"));
if (lex->trg_chistics.event == TRG_EVENT_DELETE &&
new_row)
- {
- my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "NEW", "on DELETE");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "NEW", "on DELETE"));
DBUG_ASSERT(!new_row ||
(lex->trg_chistics.event == TRG_EVENT_INSERT ||
@@ -14466,26 +14214,17 @@ field_ident:
{
TABLE_LIST *table= Select->table_list.first;
if (my_strcasecmp(table_alias_charset, $1.str, table->db))
- {
- my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
if (my_strcasecmp(table_alias_charset, $3.str,
table->table_name))
- {
- my_error(ER_WRONG_TABLE_NAME, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3.str));
$$=$5;
}
| ident '.' ident
{
TABLE_LIST *table= Select->table_list.first;
if (my_strcasecmp(table_alias_charset, $1.str, table->alias))
- {
- my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $1.str));
$$=$3;
}
| '.' ident { $$=$2;} /* For Delphi */
@@ -14760,6 +14499,7 @@ keyword:
| SONAME_SYM {}
| START_SYM {}
| STOP_SYM {}
+ | STORED_SYM {}
| TRUNCATE_SYM {}
| UNICODE_SYM {}
| UNINSTALL_SYM {}
@@ -15121,10 +14861,7 @@ set:
{
LEX *lex= Lex;
if (lex->table_or_sp_used())
- {
- my_error(ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT"));
lex->stmt_var_list= lex->var_list;
lex->var_list.empty();
}
@@ -15453,10 +15190,7 @@ internal_variable_name:
!my_strcasecmp(system_charset_info, $1.str, "OLD")))
{
if ($1.str[0]=='O' || $1.str[0]=='o')
- {
- my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "OLD", "");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_TRG_CANT_CHANGE_ROW, MYF(0), "OLD", ""));
if (lex->trg_chistics.event == TRG_EVENT_DELETE)
{
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0),
@@ -15464,10 +15198,7 @@ internal_variable_name:
MYSQL_YYABORT;
}
if (lex->trg_chistics.action_time == TRG_ACTION_AFTER)
- {
- my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "NEW", "after ");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_TRG_CANT_CHANGE_ROW, MYF(0), "NEW", "after "));
/* This special combination will denote field of NEW row */
$$.var= trg_new_row_fake_var;
$$.base_name= $3;
@@ -15559,10 +15290,7 @@ opt_for_user:
LEX_STRING pw= { C_STRING_WITH_LEN("password") };
if (spc && spc->find_variable(pw, false))
- {
- my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str));
if (!(lex->definer= (LEX_USER*) thd->calloc(sizeof(LEX_USER))))
MYSQL_YYABORT;
lex->definer->user= current_user;
@@ -15615,10 +15343,7 @@ lock:
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "LOCK");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "LOCK"));
lex->sql_command= SQLCOM_LOCK_TABLES;
}
table_lock_list
@@ -15668,10 +15393,7 @@ unlock:
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "UNLOCK");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "UNLOCK"));
lex->sql_command= SQLCOM_UNLOCK_TABLES;
}
table_or_tables
@@ -15687,34 +15409,25 @@ handler:
{
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
lex->sql_command = SQLCOM_HA_OPEN;
- if (!lex->current_select->add_table_to_list(lex->thd, $2, $4, 0))
+ if (!lex->current_select->add_table_to_list(thd, $2, $4, 0))
MYSQL_YYABORT;
}
| HANDLER_SYM table_ident_nodb CLOSE_SYM
{
LEX *lex= Lex;
if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
lex->sql_command = SQLCOM_HA_CLOSE;
- if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
+ if (!lex->current_select->add_table_to_list(thd, $2, 0, 0))
MYSQL_YYABORT;
}
| HANDLER_SYM table_ident_nodb READ_SYM
{
LEX *lex=Lex;
if (lex->sphead)
- {
- my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
lex->expr_allows_subselect= FALSE;
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
@@ -15724,7 +15437,7 @@ handler:
lex->current_select->select_limit= one;
lex->current_select->offset_limit= 0;
lex->limit_rows_examined= 0;
- if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
+ if (!lex->current_select->add_table_to_list(thd, $2, 0, 0))
MYSQL_YYABORT;
}
handler_read_or_scan opt_where_clause opt_limit_clause
@@ -15768,11 +15481,11 @@ handler_rkey_function:
;
handler_rkey_mode:
- EQ { $$=HA_READ_KEY_EXACT; }
+ '=' { $$=HA_READ_KEY_EXACT; }
| GE { $$=HA_READ_KEY_OR_NEXT; }
| LE { $$=HA_READ_KEY_OR_PREV; }
- | GT_SYM { $$=HA_READ_AFTER_KEY; }
- | LT { $$=HA_READ_BEFORE_KEY; }
+ | '>' { $$=HA_READ_AFTER_KEY; }
+ | '<' { $$=HA_READ_BEFORE_KEY; }
;
/* GRANT / REVOKE */
@@ -15930,10 +15643,7 @@ grant_role:
/* trim end spaces (as they'll be lost in mysql.user anyway) */
$1.length= cs->cset->lengthsp(cs, $1.str, $1.length);
if ($1.length == 0)
- {
- my_error(ER_INVALID_ROLE, MYF(0), "");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_INVALID_ROLE, MYF(0), ""));
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT;
$$->user = $1;
@@ -16028,30 +15738,21 @@ require_list_element:
{
LEX *lex=Lex;
if (lex->x509_subject)
- {
- my_error(ER_DUP_ARGUMENT, MYF(0), "SUBJECT");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SUBJECT"));
lex->x509_subject=$2.str;
}
| ISSUER_SYM TEXT_STRING
{
LEX *lex=Lex;
if (lex->x509_issuer)
- {
- my_error(ER_DUP_ARGUMENT, MYF(0), "ISSUER");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "ISSUER"));
lex->x509_issuer=$2.str;
}
| CIPHER_SYM TEXT_STRING
{
LEX *lex=Lex;
if (lex->ssl_cipher)
- {
- my_error(ER_DUP_ARGUMENT, MYF(0), "CIPHER");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CIPHER"));
lex->ssl_cipher=$2.str;
}
;
@@ -16066,11 +15767,7 @@ grant_ident:
if (lex->grant == GLOBAL_ACLS)
lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements)
- {
- my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
- ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
}
| ident '.' '*'
{
@@ -16079,11 +15776,7 @@ grant_ident:
if (lex->grant == GLOBAL_ACLS)
lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements)
- {
- my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
- ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
}
| '*' '.' '*'
{
@@ -16092,16 +15785,12 @@ grant_ident:
if (lex->grant == GLOBAL_ACLS)
lex->grant= GLOBAL_ACLS & ~GRANT_ACL;
else if (lex->columns.elements)
- {
- my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
- ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
}
| table_ident
{
LEX *lex=Lex;
- if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL,
+ if (!lex->current_select->add_table_to_list(thd, $1,NULL,
TL_OPTION_UPDATING))
MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS)
@@ -16442,12 +16131,6 @@ union_list_view:
}
;
-union_opt:
- /* Empty */
- | union_order_or_limit
- | union_list
- ;
-
union_order_or_limit:
{
LEX *lex= thd->lex;
@@ -16674,7 +16357,7 @@ no_definer:
;
definer:
- DEFINER_SYM EQ user_or_role
+ DEFINER_SYM '=' user_or_role
{
Lex->definer= $3;
Lex->ssl_type= SSL_TYPE_NOT_SPECIFIED;
@@ -16690,11 +16373,11 @@ definer:
**************************************************************************/
view_algorithm:
- ALGORITHM_SYM EQ UNDEFINED_SYM
+ ALGORITHM_SYM '=' UNDEFINED_SYM
{ Lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; }
- | ALGORITHM_SYM EQ MERGE_SYM
+ | ALGORITHM_SYM '=' MERGE_SYM
{ Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; }
- | ALGORITHM_SYM EQ TEMPTABLE_SYM
+ | ALGORITHM_SYM '=' TEMPTABLE_SYM
{ Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; }
;
@@ -16750,7 +16433,6 @@ view_select:
{
LEX *lex= Lex;
lex->parsing_options.allows_variable= FALSE;
- lex->parsing_options.allows_derived= FALSE;
lex->create_view_select.str= (char *) YYLIP->get_cpp_ptr();
}
opt_with_clause query_expression_body_view view_check_option
@@ -16762,7 +16444,6 @@ view_select:
lex->create_view_select.str= (char *) create_view_select;
trim_whitespace(thd->charset(), &lex->create_view_select);
lex->parsing_options.allows_variable= TRUE;
- lex->parsing_options.allows_derived= TRUE;
lex->current_select->set_with_clause($2);
}
;
@@ -16824,10 +16505,7 @@ trigger_tail:
Lex_input_stream *lip= YYLIP;
if (lex->sphead)
- {
- my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER"));
lex->stmt_definition_begin= $2;
lex->ident.str= $9;
@@ -16884,10 +16562,7 @@ udf_tail2:
if (lex->add_create_options_with_check($2))
MYSQL_YYABORT;
if (is_native_function(thd, & $3))
- {
- my_error(ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str));
lex->sql_command= SQLCOM_CREATE_FUNCTION;
lex->udf.name= $3;
lex->udf.returns= (Item_result) $5;
@@ -16910,10 +16585,7 @@ sf_tail:
lex->spname= $3;
if (lex->sphead)
- {
- my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION"));
if (!make_sp_head(thd, $3, TYPE_ENUM_FUNCTION))
MYSQL_YYABORT;
@@ -16956,10 +16628,7 @@ sf_tail:
lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
sp->set_stmt_end(thd);
if (!(sp->m_flags & sp_head::HAS_RETURN))
- {
- my_error(ER_SP_NORETURN, MYF(0), sp->m_qname.str);
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NORETURN, MYF(0), sp->m_qname.str));
if (is_native_function(thd, & sp->m_name))
{
/*
@@ -17006,10 +16675,7 @@ sp_tail:
MYSQL_YYABORT;
if (Lex->sphead)
- {
- my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
- MYSQL_YYABORT;
- }
+ my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE"));
if (!make_sp_head(thd, $3, TYPE_ENUM_PROCEDURE))
MYSQL_YYABORT;