Re: [Maria-developers] [Commits] Rev 3565: MDEV-492: fixed incorrect error check. in file:///home/bell/maria/bzr/work-maria-5.3-MDEV-492/
![](https://secure.gravatar.com/avatar/3c2329333dd5898f2e72818af773243d.jpg?s=120&d=mm&r=g)
Hi, Sanja! On Aug 27, sanja@askmonty.org wrote:
message: MDEV-492: fixed incorrect error check.
=== modified file 'mysql-test/t/errors.test' --- a/mysql-test/t/errors.test 2012-03-12 07:56:56 +0000 +++ b/mysql-test/t/errors.test 2012-08-27 14:29:26 +0000 @@ -85,3 +85,12 @@ INSERT INTO t2 VALUES (1,0) ON DUPLICATE INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE b=(SELECT VALUES(a)+2 FROM t1); DROP TABLE t1, t2; + +--echo # +--echo # MDEV-492: incorrect error check before sending OK in mysql_update +--echo # +CREATE TABLE t1 (a CHAR(3), b BLOB); +--error ER_DYN_COL_DATA +UPDATE t1 SET a = 'new' +WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL; +drop table t1;
=== modified file 'sql/sql_update.cc' --- a/sql/sql_update.cc 2012-04-26 17:21:37 +0000 +++ b/sql/sql_update.cc 2012-08-27 14:29:26 +0000 @@ -872,7 +872,7 @@ int mysql_update(THD *thd, id= thd->arg_of_last_insert_id_function ? thd->first_successful_insert_id_in_prev_stmt : 0;
- if (error < 0) + if (error < 0 && (!thd->is_error())) { char buff[MYSQL_ERRMSG_SIZE]; my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
Nope, this is not good. The bug happens because the error from remove_eq_conds() is ignored. You need to catch and process this error as soon as possible. While in your patch you let the update work all the way till the end. This patch is better, it aborts much earlier: === modified file 'sql/sql_update.cc' --- sql/sql_update.cc 2012-08-09 15:22:00 +0000 +++ sql/sql_update.cc 2012-08-28 19:05:33 +0000 @@ -406,7 +406,7 @@ int mysql_update(THD *thd, table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); select= make_select(table, 0, 0, conds, 0, &error); - if (error || !limit || + if (error || !limit || thd->is_error() || (select && select->check_quick(thd, safe_update, limit))) { delete select; Regards, Sergei
participants (1)
-
Sergei Golubchik