set @save_check_constraint=@@check_constraint_checks;
create table t1 (a int check(a>10 ), b int check (b > 20 ), constraint `min ` check (a+b > 100 ), constraint `max ` check (a+b <500 )) engine=myisam;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11 ) DEFAULT NULL CHECK (`a` > 10 ),
`b` int(11 ) DEFAULT NULL CHECK (`b` > 20 ),
CONSTRAINT `min ` CHECK (`a` + `b` > 100 ),
CONSTRAINT `max ` CHECK (`a` + `b` < 500 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
insert into t1 values (100 ,100 );
insert into t1 values (1 ,1 );
ERROR 23000 : CONSTRAINT `t1.a` failed for `test`.`t1`
insert into t1 values (20 ,1 );
ERROR 23000 : CONSTRAINT `t1.b` failed for `test`.`t1`
insert into t1 values (20 ,30 );
ERROR 23000 : CONSTRAINT `min ` failed for `test`.`t1`
insert into t1 values (500 ,500 );
ERROR 23000 : CONSTRAINT `max ` failed for `test`.`t1`
insert into t1 values (101 ,101 ),(102 ,102 ),(600 ,600 ),(103 ,103 );
ERROR 23000 : CONSTRAINT `max ` failed for `test`.`t1`
select * from t1;
a b
100 100
101 101
102 102
truncate table t1;
insert ignore into t1 values (101 ,101 ),(102 ,102 ),(600 ,600 ),(103 ,103 );
Warnings:
Warning 4025 CONSTRAINT `max ` failed for `test`.`t1`
select * from t1;
a b
101 101
102 102
103 103
set check_constraint_checks=0 ;
truncate table t1;
insert into t1 values (101 ,101 ),(102 ,102 ),(600 ,600 ),(103 ,103 );
select * from t1;
a b
101 101
102 102
600 600
103 103
set check_constraint_checks=@save_check_constraint;
alter table t1 add c int default 0 check (c < 10 );
ERROR 23000 : CONSTRAINT `max ` failed for `test`.`t1`
set check_constraint_checks=0 ;
alter table t1 add c int default 0 check (c < 10 );
alter table t1 add check (a+b+c < 500 );
set check_constraint_checks=@save_check_constraint;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11 ) DEFAULT NULL CHECK (`a` > 10 ),
`b` int(11 ) DEFAULT NULL CHECK (`b` > 20 ),
`c` int(11 ) DEFAULT 0 CHECK (`c` < 10 ),
CONSTRAINT `min ` CHECK (`a` + `b` > 100 ),
CONSTRAINT `max ` CHECK (`a` + `b` < 500 ),
CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
insert into t1 values(105 ,105 ,105 );
ERROR 23000 : CONSTRAINT `t1.c` failed for `test`.`t1`
insert into t1 values(249 ,249 ,9 );
ERROR 23000 : CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
insert into t1 values(105 ,105 ,9 );
select * from t1;
a b c
101 101 0
102 102 0
600 600 0
103 103 0
105 105 9
create table t2 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11 ) DEFAULT NULL CHECK (`a` > 10 ),
`b` int(11 ) DEFAULT NULL CHECK (`b` > 20 ),
`c` int(11 ) DEFAULT 0 CHECK (`c` < 10 ),
CONSTRAINT `min ` CHECK (`a` + `b` > 100 ),
CONSTRAINT `max ` CHECK (`a` + `b` < 500 ),
CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
alter table t2 drop constraint c;
ERROR 42000 : Can't DROP CONSTRAINT `c`; check that it exists
alter table t2 drop constraint if exists c;
Warnings:
Note 1091 Can't DROP CONSTRAINT `c`; check that it exists
alter table t2 drop constraint min ;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11 ) DEFAULT NULL CHECK (`a` > 10 ),
`b` int(11 ) DEFAULT NULL CHECK (`b` > 20 ),
`c` int(11 ) DEFAULT 0 CHECK (`c` < 10 ),
CONSTRAINT `max ` CHECK (`a` + `b` < 500 ),
CONSTRAINT `CONSTRAINT_1` CHECK (`a` + `b` + `c` < 500 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1,t2;
create or replace table t1 (a int, b int, constraint check (a>b));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11 ) DEFAULT NULL,
`b` int(11 ) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
create or replace table t1 (a int, b int,
constraint CONSTRAINT_1 check (a>1 ),
constraint check (b>1 ));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11 ) DEFAULT NULL,
`b` int(11 ) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 1 ),
CONSTRAINT `CONSTRAINT_2` CHECK (`b` > 1 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
create or replace table t1 (a int, b int,
constraint CONSTRAINT_1 check (a>1 ),
constraint check (b>1 ),
constraint CONSTRAINT_2 check (a>b));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11 ) DEFAULT NULL,
`b` int(11 ) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 1 ),
CONSTRAINT `CONSTRAINT_3` CHECK (`b` > 1 ),
CONSTRAINT `CONSTRAINT_2` CHECK (`a` > `b`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1;
#
# MDEV-10370 Check constraints on virtual columns fails on INSERT when column not specified
#
create table t1(c1 int, c2 int as (c1 + 1 ), check (c2 > 2 ));
insert into t1(c1) values(1 );
ERROR 23000 : CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
insert into t1(c1) values(2 );
drop table t1;
#
# MDEV-11117 CHECK constraint fails on intermediate step of ALTER
#
create or replace table t1( c1 int auto_increment primary key, check( c1 > 0 or c1 is null ) );
ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the CHECK clause of `c1`
#
# MDEV-12421 Check constraint with query crashes server and renders DB unusable
#
create table t1 (a int check (@b in (select user from mysql.user)));
ERROR 42000 : CHECK does not support subqueries or stored functions
create table t1 (a int check (a > @b));
ERROR HY000: Function or expression '@b' cannot be used in the CHECK clause of `a`
#
# MDEV-13596 CHECK constraints disallow NULL to pass through, violating SQL
#
create table t1 (a int check (a = 1 ));
insert t1 values (1 );
insert t1 values (2 );
ERROR 23000 : CONSTRAINT `t1.a` failed for `test`.`t1`
insert t1 values (NULL);
select * from t1;
a
1
NULL
drop table t1;
#
# MDEV-15141 Check constraint validation on a datetime field crashes the process
#
create table t1 (id int auto_increment primary key, datecol datetime, check (datecol>'0001-01-01 00:00:00' ));
insert into t1 (datecol) values (now());
insert into t1 (datecol) values (now());
drop table t1;
#
# MDEV-15461 Check Constraints with binary logging makes insert inconsistent
#
CREATE TABLE t1 (
EmployeeID SMALLINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
FirstName VARCHAR(30 ) NOT NULL CHECK (CHAR_LENGTH(FirstName > 2 ))
);
INSERT INTO t1 VALUES (NULL, 'Ken' );
ERROR 22007 : Truncated incorrect DECIMAL value: 'Ken'
SHOW WARNINGS;
Level Code Message
Error 1292 Truncated incorrect DECIMAL value: 'Ken'
Error 4025 CONSTRAINT `t1.FirstName` failed for `test`.`t1`
INSERT INTO t1 VALUES (NULL, 'Ken' ),(NULL, 'Brian' );
ERROR 22007 : Truncated incorrect DECIMAL value: 'Ken'
SHOW WARNINGS;
Level Code Message
Error 1292 Truncated incorrect DECIMAL value: 'Ken'
Error 4025 CONSTRAINT `t1.FirstName` failed for `test`.`t1`
INSERT IGNORE INTO t1 VALUES (NULL, 'Ken' );
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'Ken'
INSERT IGNORE INTO t1 VALUES (NULL, 'Ken' ),(NULL, 'Brian' );
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'Ken'
Warning 1292 Truncated incorrect DECIMAL value: 'Brian'
set sql_mode="" ;
INSERT INTO t1 VALUES (NULL, 'Ken' );
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'Ken'
INSERT INTO t1 VALUES (NULL, 'Ken' ),(NULL, 'Brian' );
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'Ken'
Warning 1292 Truncated incorrect DECIMAL value: 'Brian'
set sql_mode=default;
select * from t1;
EmployeeID FirstName
1 Ken
2 Ken
3 Brian
4 Ken
5 Ken
6 Brian
drop table t1;
#
# MDEV-16630 : Ambiguous error message when check constraint matches table name
#
use test;
drop table if exists t;
create table t(a int, b int check(b>0 ),
constraint a_lt_b check(a<b), constraint a check(a>0 ),
constraint x check (a>10 ));
show create table t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11 ) DEFAULT NULL,
`b` int(11 ) DEFAULT NULL CHECK (`b` > 0 ),
CONSTRAINT `a_lt_b` CHECK (`a` < `b`),
CONSTRAINT `a` CHECK (`a` > 0 ),
CONSTRAINT `x` CHECK (`a` > 10 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
# Field constraint 'b' will fail
insert into t values (-1 , 0 );
ERROR 23000 : CONSTRAINT `t.b` failed for `test`.`t`
# Table constraint 'a_lt_b' will fail
insert into t values (1 ,1 );
ERROR 23000 : CONSTRAINT `a_lt_b` failed for `test`.`t`
drop table t;
create table t1 (a int auto_increment primary key, b int, check (b > 5 ));
insert t1 (b) values (1 );
ERROR 23000 : CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
insert t1 (b) values (10 );
select * from t1 where a is null;
a b
set sql_auto_is_null=1 ;
select * from t1 where a is null;
a b
1 10
insert t1 (b) values (1 );
ERROR 23000 : CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
#
# MDEV-25638 Assertion `!result' failed in convert_const_to_int
#
create table t1 (v1 bigint check (v1 not in ('x' , 'x111' ))) ;
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'x'
Warning 1292 Truncated incorrect DECIMAL value: 'x111'
select * from t1;
v1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'x'
Warning 1292 Truncated incorrect DECIMAL value: 'x111'
select v1 from t1;
v1
select * from t1;
v1
prepare stmt from "select * from t1" ;
execute stmt;
v1
execute stmt;
v1
flush tables;
select * from t1;
v1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'x'
Warning 1292 Truncated incorrect DECIMAL value: 'x111'
select * from t1;
v1
deallocate prepare stmt;
drop table t1;
#
# MDEV-26061 MariaDB server crash at Field::set_default
#
create table t1 (v2 date check (v1 like default (v1)), v1 date default (from_days ('x' )));
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'x'
insert ignore into t1 values ( 'x' , 'x' ) ;
Warnings:
Warning 1265 Data truncated for column 'v2' at row 1
Warning 1265 Data truncated for column 'v1' at row 1
Warning 1292 Truncated incorrect INTEGER value: 'x'
drop table t1;
#
# MDEV-15338 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed on dropping column with CHECK
#
CREATE TABLE t1 (a INT, b INT, CHECK (a>0 )) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1 ,2 ),(3 ,4 );
ALTER TABLE t1 DROP COLUMN a;
CREATE OR REPLACE TABLE t1 (a INT, b INT, CHECK (a>0 )) ENGINE=MyISAM;
ALTER TABLE t1 DROP COLUMN b;
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0 )) ENGINE=MyISAM;
ALTER TABLE t1 DROP COLUMN b;
ERROR 42 S22: Unknown column 'b' in 'CHECK'
ALTER TABLE t1 DROP COLUMN a, DROP COLUMN b;
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0 )) ENGINE=MyISAM;
ALTER TABLE t1 DROP CONSTRAINT `CONSTRAINT_1`;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11 ) DEFAULT NULL,
`b` int(11 ) DEFAULT NULL,
`c` int(11 ) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0 )) ENGINE=MyISAM;
ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11 ) DEFAULT NULL,
`c` int(11 ) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
#
# MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table
#
create temporary table t1 (
id int not null auto_increment primary key,
f int not null default 0
);
insert into t1 () values ();
alter ignore table t1 add constraint check (f > 0 );
Warnings:
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
alter table t1;
drop table t1;
#
# MDEV-16905 ASAN heap-use-after-free in __interceptor_strnlen / ... / TABLE::verify_constraints upon INSERT into temporary table with CHECK constraint
#
create temporary table t1 (a int default 0 , check (a > 0 ));
alter table t1 drop constraint if exists non_existing_constraint;
Warnings:
Note 1091 Can't DROP CONSTRAINT `non_existing_constraint`; check that it exists
insert into t1 () values ();
ERROR 23000 : CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
# End of 10 .2 tests
#
# MDEV-26061 MariaDB server crash at Field::set_default
#
create table t1 (d timestamp not null default now() check (default (d) is true)) as select 1 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d` timestamp NOT NULL DEFAULT current_timestamp() CHECK (default(`d`) is true),
`1 ` int(1 ) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1;
# End of 10 .3 tests
#
# MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error
#
create table t1 (id varchar(2 ), constraint id check (id regexp '[a-z]' ));
alter table t1 force;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` varchar(2 ) DEFAULT NULL,
CONSTRAINT `id` CHECK (`id` regexp '[a-z]' )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1;
#
# MDEV-32586 incorrect error about cyclic reference about JSON type virtual column
#
create table t1 (a int, b json as (a));
drop table t1;
create table t1 (a int, b int as (a) check (b > 0 ));
insert t1 (a) values (1 );
insert t1 (a) values (-1 );
ERROR 23000 : CONSTRAINT `t1.b` failed for `test`.`t1`
drop table t1;
# End of 10 .4 tests
#
# MDEV-36662 CHECK constraint does not repeat in case of error
#
create table t1 (d date check (d > 2020 -01 -01 ));
insert into t1 values ('2023-12-05' );
ERROR 22007 : Truncated incorrect datetime value: '2018'
INSERT into t1 values ('2024-12-05' );
ERROR 22007 : Truncated incorrect datetime value: '2018'
create or replace table t1 (d time check (d > "a" ));
insert into t1 values ('22:30' );
ERROR 22007 : Truncated incorrect time value: 'a'
insert into t1 values ('23:30' );
ERROR 22007 : Truncated incorrect time value: 'a'
create or replace table t1 (d datetime check (d > "a" ));
insert into t1 values ('2023-12-05' );
ERROR 22007 : Truncated incorrect datetime value: 'a'
insert into t1 values ('2024-12-05' );
ERROR 22007 : Truncated incorrect datetime value: 'a'
create or replace table t1 (d timestamp check (d > "a" ));
insert into t1 values ('2023-12-05' );
ERROR 22007 : Truncated incorrect datetime value: 'a'
insert into t1 values ('2024-12-05' );
ERROR 22007 : Truncated incorrect datetime value: 'a'
create or replace table t1 (d year check (d > "a" ));
insert into t1 values ('2023' );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
insert into t1 values ('2024' );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
create or replace table t1 (d int check (d > "a" ));
insert into t1 values (0 );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
insert into t1 values (1 );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
create or replace table t1 (d real check (d > "a" ));
insert into t1 values (0 .1 );
ERROR 22007 : Truncated incorrect DOUBLE value: 'a'
insert into t1 values (1 .1 );
ERROR 22007 : Truncated incorrect DOUBLE value: 'a'
create or replace table t1 (d decimal check (d > "a" ));
insert into t1 values (0 );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
insert into t1 values (1 );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
create or replace table t1 (d bool check (d != "a" ));
insert into t1 values (0 );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
insert into t1 values (1 );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
drop table t1;
create or replace table t1 (d varchar(30 ) check (d != 1 ));
insert into t1 values ("a" );
ERROR 22007 : Truncated incorrect DECIMAL value: 'a'
insert into t1 values ("b" );
ERROR 22007 : Truncated incorrect DECIMAL value: 'b'
drop table t1;
#
# MDEV-24598 Duplicate CHECK constraint names are allowed
#
CREATE TABLE t1 (a INT CHECK (a>2 ), CONSTRAINT a CHECK (a < 5 ));
ERROR HY000: Duplicate CHECK constraint name 'a'
CREATE TABLE t2 (
path VARCHAR(100 ) NOT NULL,
json_c1 JSON NOT NULL DEFAULT '{}' ,
CONSTRAINT json_c1 CHECK (path > 0 )
);
ERROR HY000: Duplicate CHECK constraint name 'json_c1'
CREATE TABLE t3 (a INT, CONSTRAINT c1 CHECK (a > 0 ),
CONSTRAINT c1 CHECK (a < 100 ));
ERROR HY000: Duplicate CHECK constraint name 'c1'
CREATE TABLE t4 (CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 0 ),
CHECK (CONSTRAINT_1 < 100 ));
SHOW CREATE TABLE t4;
Table Create Table
t4 CREATE TABLE `t4` (
`CONSTRAINT_1` int(11 ) DEFAULT NULL CHECK (`CONSTRAINT_1` > 0 ),
CONSTRAINT `CONSTRAINT_2` CHECK (`CONSTRAINT_1` < 100 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t4;
CREATE TABLE t5 (a INT, CONSTRAINT b CHECK (a > 0 ));
ALTER TABLE t5 ADD COLUMN b INT CHECK (b > 5 );
ERROR HY000: Duplicate CHECK constraint name 'b'
DROP TABLE t5;
CREATE TABLE t6 (a INT CHECK (a > 0 ));
ALTER TABLE t6 ADD CONSTRAINT a CHECK (a < 100 );
ERROR HY000: Duplicate CHECK constraint name 'a'
DROP TABLE t6;
CREATE TABLE t7 (a INT CHECK (a > 0 ), CONSTRAINT new_a CHECK (a < 100 ));
ALTER TABLE t7 RENAME COLUMN a TO new_a;
ERROR HY000: Duplicate CHECK constraint name 'new_a'
DROP TABLE t7;
CREATE TABLE t8 (CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 0 ));
ALTER TABLE t8 ADD CHECK (CONSTRAINT_1 < 100 );
SHOW CREATE TABLE t8;
Table Create Table
t8 CREATE TABLE `t8` (
`CONSTRAINT_1` int(11 ) DEFAULT NULL CHECK (`CONSTRAINT_1` > 0 ),
CONSTRAINT `CONSTRAINT_2` CHECK (`CONSTRAINT_1` < 100 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t8;
CREATE TABLE t9 (a INT, CHECK (a > 0 ));
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
`a` int(11 ) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 0 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
ALTER TABLE t9 ADD COLUMN CONSTRAINT_1 INT CHECK (CONSTRAINT_1 > 5 );
ERROR HY000: Duplicate CHECK constraint name 'CONSTRAINT_1'
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
`a` int(11 ) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > 0 )
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t9;
# End of 10 .11 tests
#
# MDEV-32439 INSERT IGNORE VALUES (one row) errors on constraint
#
CREATE TABLE t1 (v1 varchar(10 ), v2 varchar(10 ), constraint unequal check (v1 != v2));
INSERT IGNORE INTO t1 VALUES (1 ,1 );
Warnings:
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
SHOW WARNINGS;
Level Code Message
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
INSERT IGNORE INTO t1 VALUES (1 ,2 ),(2 ,2 );
Warnings:
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
SHOW WARNINGS;
Level Code Message
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
INSERT IGNORE INTO t1 VALUES (3 ,3 ),(4 ,4 );
Warnings:
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
SHOW WARNINGS;
Level Code Message
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
SELECT * FROM t1;
v1 v2
1 2
DROP TABLE t1;
#
# MDEV-32439 INSERT IGNORE VALUES (one row) errors on constraint
#
CREATE TABLE t1 (v1 varchar(10 ), v2 varchar(10 ), constraint unequal check (v1 != v2));
INSERT IGNORE INTO t1 VALUES (1 ,1 );
Warnings:
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
SHOW WARNINGS;
Level Code Message
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
INSERT IGNORE INTO t1 VALUES (1 ,2 ),(2 ,2 );
Warnings:
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
SHOW WARNINGS;
Level Code Message
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
INSERT IGNORE INTO t1 VALUES (3 ,3 ),(4 ,4 );
Warnings:
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
SHOW WARNINGS;
Level Code Message
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
Warning 4025 CONSTRAINT `unequal` failed for `test`.`t1`
SELECT * FROM t1;
v1 v2
1 2
DROP TABLE t1;
# End of 11 .4 tests
Messung V0.5 in Prozent C=62 H=100 G=83
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-10-08)
¤
*© Formatika GbR, Deutschland