Commit 97c2a735 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-13290: Assertion Assertion `!is_set() || (m_status == DA_OK_BULK &&...

MDEV-13290: Assertion Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' or `! is_set()' failed

Check error status which can be set by conversion procedures.
parent 389f7cdf
......@@ -717,3 +717,31 @@ insert ignore into t1 values (1,12);
Warnings:
Warning 1062 Duplicate entry '1' for key 'f1'
DROP TABLE t1;
#
# MDEV-13290 Assertion Assertion `!is_set() || (m_status == DA_OK_BULK
# && is_bulk_op())' or `! is_set()' failed
#
SET @save_mode= @@sql_mode;
SET sql_mode= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (f1 INT DEFAULT 0, f2 INT);
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
REPLACE INTO v1 SET f2 = 1;
ERROR 22007: Truncated incorrect DOUBLE value: 'x'
SELECT * from t1;
f1 f2
drop view v1;
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as decimal) WITH CHECK OPTION;
REPLACE INTO v1 SET f2 = 1;
ERROR 22007: Truncated incorrect DECIMAL value: ''
SELECT * from t1;
f1 f2
drop view v1;
SELECT 0,0 INTO OUTFILE 't1.txt';
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
LOAD DATA INFILE 't1.txt' INTO TABLE v1;
ERROR 22007: Truncated incorrect DOUBLE value: 'x'
SELECT * from t1;
f1 f2
drop view v1;
drop table t1;
SET @@sql_mode= @save_mode;
......@@ -573,3 +573,32 @@ insert ignore into t1 values (1,12) on duplicate key update f2=13;
set @@old_mode="";
insert ignore into t1 values (1,12);
DROP TABLE t1;
--echo #
--echo # MDEV-13290 Assertion Assertion `!is_set() || (m_status == DA_OK_BULK
--echo # && is_bulk_op())' or `! is_set()' failed
--echo #
SET @save_mode= @@sql_mode;
SET sql_mode= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (f1 INT DEFAULT 0, f2 INT);
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
--error ER_TRUNCATED_WRONG_VALUE
REPLACE INTO v1 SET f2 = 1;
SELECT * from t1;
drop view v1;
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as decimal) WITH CHECK OPTION;
--error ER_TRUNCATED_WRONG_VALUE
REPLACE INTO v1 SET f2 = 1;
SELECT * from t1;
drop view v1;
SELECT 0,0 INTO OUTFILE 't1.txt';
CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
--error ER_TRUNCATED_WRONG_VALUE
LOAD DATA INFILE 't1.txt' INTO TABLE v1;
SELECT * from t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/t1.txt;
drop view v1;
drop table t1;
SET @@sql_mode= @save_mode;
......@@ -4642,6 +4642,9 @@ int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure)
main_view->view_name.str);
return(VIEW_CHECK_ERROR);
}
/* We check thd->error() because it can be set by conversion problem. */
if (thd->is_error())
return(VIEW_CHECK_ERROR);
return(VIEW_CHECK_OK);
}
......
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