Commit fce76d29 authored by Kristofer Pettersson's avatar Kristofer Pettersson

Bug#42108 Wrong locking for UPDATE with subqueries leads to broken statement

          replication
              
MySQL server uses wrong lock type (always TL_READ instead of
TL_READ_NO_INSERT when appropriate) for tables used in
subqueries of UPDATE statement. This leads in some cases to
a broken replication as statements are written in the wrong
order to the binlog.

sql/sql_yacc.yy:
  * Set lock_option to either TL_READ_NO_INSERT or
    TL_READ for any sub-SELECT following UPDATE.
  * Changed line adjusted for parser identation
    rules; code begins at column 13.
parent faf5044d
......@@ -7810,7 +7810,7 @@ update:
LEX *lex= Lex;
mysql_init_select(lex);
lex->sql_command= SQLCOM_UPDATE;
lex->lock_option= TL_UNLOCK; /* Will be set later */
lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ;
lex->duplicates= DUP_ERROR;
}
opt_low_priority opt_ignore join_table_list
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment