diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index e52bdcf336c..62c9a86a46c 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -69,3 +69,11 @@ ERROR 42S22: Unknown column '' in 'VALUES() function' INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE b=(SELECT VALUES(a)+2 FROM t1); DROP TABLE t1, t2; +# +# MDEV-492: incorrect error check before sending OK in mysql_update +# +CREATE TABLE t1 (a CHAR(3), b BLOB); +UPDATE t1 SET a = 'new' +WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL; +ERROR 22007: Illegal value used as argument of dynamic column function +drop table t1; diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test index b426d9fd5b0..b6aeee63677 100644 --- a/mysql-test/t/errors.test +++ b/mysql-test/t/errors.test @@ -85,3 +85,12 @@ INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE 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; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 4f816e5f032..7d6eb62f57d 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -359,7 +359,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;