[CP] fix bug insert ignore with generated column maybe cause 4377 error

This commit is contained in:
yishenglanlingzui
2024-01-04 04:42:55 +00:00
committed by ob-robot
parent 10ee1c4603
commit 92add5609c
6 changed files with 45 additions and 2 deletions

View File

@ -1,4 +1,4 @@
drop table if exists t1,t2, test, t_ignore;
drop table if exists t1,t2, test, t_ignore, t3;
CREATE TABLE t1(a BIGINT primary key);
insert into t1 values(100);
insert into t1 values(100);
@ -324,3 +324,9 @@ SELECT * FROM t_ignore;
c1 c2
1
DROP TABLE t_ignore;
create TABLE t3 ( str varchar(255) character set utf8mb4 not null, key str (str(2)) );
INSERT ignore INTO t3 VALUES (NULL);
ERROR 23000: Column 'str' cannot be null
select /*+ opt_param('hidden_column_visible', 'true') index('str')*/__pk_increment, __substr2_16 from t3;
__pk_increment __substr2_16
drop table t3;

View File

@ -8,7 +8,7 @@ set @@session.explicit_defaults_for_timestamp=off;
##增加新的语法,支持ignore
--disable_warnings
drop table if exists t1,t2, test, t_ignore;
drop table if exists t1,t2, test, t_ignore, t3;
--enable_warnings
CREATE TABLE t1(a BIGINT primary key);
@ -185,3 +185,9 @@ CREATE TABLE t_ignore (`c1` bigint(20) NOT NULL AUTO_INCREMENT, `c2` varchar(50)
INSERT IGNORE INTO t_ignore (c1) value (1);
SELECT * FROM t_ignore;
DROP TABLE t_ignore;
create TABLE t3 ( str varchar(255) character set utf8mb4 not null, key str (str(2)) );
--error 1048
INSERT ignore INTO t3 VALUES (NULL);
select /*+ opt_param('hidden_column_visible', 'true') index('str')*/__pk_increment, __substr2_16 from t3;
drop table t3;

View File

@ -244,6 +244,7 @@ INSERT /*+ ENABLE_PARALLEL_DML PARALLEL(3) */ INTO table0_innodb_key_pk_parts_2
INSERT /*+ ENABLE_PARALLEL_DML PARALLEL(3) */ INTO table0_innodb_key_pk_parts_2 ( col_enum , col_enum_not_null , col_decimal ) VALUES ( '2006-04-09 05:33:14.045216' , '2008' , '2004-09-17 09:11:54.004359' );
INSERT /*+ ENABLE_PARALLEL_DML PARALLEL(3) */ INTO table0_innodb_key_pk_parts_2 ( col_blob_key , col_int_unsigned_not_null , col_int_not_null_key ) VALUES ( '20:35:45' , 47682 , 1319 );
--error 1048
UPDATE /*+ ENABLE_PARALLEL_DML PARALLEL(3) */ table0_innodb_key_pk_parts_2 SET col_blob_not_null_key = NULL WHERE col_bit_not_null <> '08:59:21';
select * from table0_innodb_key_pk_parts_2;
drop table table0_innodb_key_pk_parts_2;