diff options
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 70eb7803dba..fd461ad05aa 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /* sql_yacc.yy */ @@ -11735,6 +11735,7 @@ cast_type_numeric: | UNSIGNED { $$.set(&type_handler_ulonglong); } | UNSIGNED INT_SYM { $$.set(&type_handler_ulonglong); } | DECIMAL_SYM float_options { $$.set(&type_handler_newdecimal, $2); } + | FLOAT_SYM { $$.set(&type_handler_float); } | DOUBLE_SYM opt_precision { $$.set(&type_handler_double, $2); } ; @@ -13289,7 +13290,7 @@ insert: insert_lock_option opt_ignore insert2 { - Select->set_lock_for_tables($3); + Select->set_lock_for_tables($3, true); Lex->current_select= Lex->first_select_lex(); } insert_field_spec opt_insert_update @@ -13313,7 +13314,7 @@ replace: } replace_lock_option insert2 { - Select->set_lock_for_tables($3); + Select->set_lock_for_tables($3, true); Lex->current_select= Lex->first_select_lex(); } insert_field_spec @@ -13586,15 +13587,14 @@ update: opt_low_priority opt_ignore update_table_list SET update_list { - LEX *lex= Lex; - if (lex->first_select_lex()->table_list.elements > 1) - lex->sql_command= SQLCOM_UPDATE_MULTI; - else if (lex->first_select_lex()->get_table_list()->derived) + SELECT_LEX *slex= Lex->first_select_lex(); + if (slex->table_list.elements > 1) + Lex->sql_command= SQLCOM_UPDATE_MULTI; + else if (slex->get_table_list()->derived) { /* it is single table update and it is update of derived table */ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), - lex->first_select_lex()->get_table_list()->alias.str, - "UPDATE"); + slex->get_table_list()->alias.str, "UPDATE"); MYSQL_YYABORT; } /* @@ -13602,7 +13602,7 @@ update: be too pessimistic. We will decrease lock level if possible in mysql_multi_update(). */ - Select->set_lock_for_tables($3); + slex->set_lock_for_tables($3, slex->table_list.elements == 1); } opt_where_clause opt_order_clause delete_limit_clause { @@ -16694,13 +16694,16 @@ table_lock: { thr_lock_type lock_type= (thr_lock_type) $3; bool lock_for_write= (lock_type >= TL_WRITE_ALLOW_WRITE); + ulong table_options= lock_for_write ? TL_OPTION_UPDATING : 0; + enum_mdl_type mdl_type= !lock_for_write + ? MDL_SHARED_READ + : lock_type == TL_WRITE_CONCURRENT_INSERT + ? MDL_SHARED_WRITE + : MDL_SHARED_NO_READ_WRITE; + if (unlikely(!Select-> - add_table_to_list(thd, $1, $2, 0, lock_type, - (lock_for_write ? - lock_type == TL_WRITE_CONCURRENT_INSERT ? - MDL_SHARED_WRITE : - MDL_SHARED_NO_READ_WRITE : - MDL_SHARED_READ)))) + add_table_to_list(thd, $1, $2, table_options, + lock_type, mdl_type))) MYSQL_YYABORT; } ; |