summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/check_constraint.result2
-rw-r--r--mysql-test/suite/gcol/inc/gcol_column_def_options.inc2
-rw-r--r--mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result2
-rw-r--r--mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result2
-rw-r--r--mysql-test/t/check_constraint.test6
5 files changed, 11 insertions, 3 deletions
diff --git a/mysql-test/r/check_constraint.result b/mysql-test/r/check_constraint.result
index 7447550ed09..fcda0a84fcb 100644
--- a/mysql-test/r/check_constraint.result
+++ b/mysql-test/r/check_constraint.result
@@ -140,6 +140,8 @@ create table t1 (a int, b int, check(a>0));
alter table t1 drop column a;
ERROR 42S22: Unknown column 'a' in 'CHECK'
drop table t1;
+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`
create table t1 (a int check (@b in (select user from mysql.user)));
ERROR HY000: Function or expression 'select ...' cannot be used in the CHECK clause of `a`
create table t1 (a int check (a > @b));
diff --git a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
index f132c2f2f63..ac70701e2cc 100644
--- a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
+++ b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
@@ -198,7 +198,7 @@ drop table t1;
create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual);
--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual);
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int);
--echo # Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE
diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
index c4a54999614..e93d3bf025a 100644
--- a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
@@ -259,7 +259,7 @@ ERROR 01000: Expression for field `b` is refering to uninitialized field `b`
create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual);
ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int);
-ERROR 01000: Expression for field `col_int_nokey` is refering to uninitialized field `pk`
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk`
# Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE
create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored);
insert into t1(a) values(1),(2);
diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
index 0f66b3ad779..563883adce0 100644
--- a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
@@ -259,7 +259,7 @@ ERROR 01000: Expression for field `b` is refering to uninitialized field `b`
create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual);
ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int);
-ERROR 01000: Expression for field `col_int_nokey` is refering to uninitialized field `pk`
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk`
# Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE
create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored);
insert into t1(a) values(1),(2);
diff --git a/mysql-test/t/check_constraint.test b/mysql-test/t/check_constraint.test
index 437463ee457..c70a208f774 100644
--- a/mysql-test/t/check_constraint.test
+++ b/mysql-test/t/check_constraint.test
@@ -88,6 +88,12 @@ alter table t1 drop column a;
drop table t1;
#
+# MDEV-11117 CHECK constraint fails on intermediate step of ALTER
+#
+-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+create or replace table t1( c1 int auto_increment primary key, check( c1 > 0 or c1 is null ) );
+
+#
# MDEV-12421 Check constraint with query crashes server and renders DB unusable
#
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED