summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2021-10-11 13:36:07 +0300
committerAleksey Midenkov <midenok@gmail.com>2021-10-11 13:36:07 +0300
commit1e70b287e702b7ff9191454d1316d9137b9be0c1 (patch)
treeac231c4fc175257a6cfc105adf87af15963f5ea7 /mysql-test
parentd31f953789def34f20d29b31add847a3c30a8ecc (diff)
downloadmariadb-git-1e70b287e702b7ff9191454d1316d9137b9be0c1.tar.gz
MDEV-25891 Computed default for INVISIBLE column is ignored in INSERT
There are two fill_record() functions (lines 8343 and 8618). First one is used when there are some explicit values, the second one is used for all implicit values. First one does update_default_fields(), the second one did not. Added update_default_fields() call to the implicit version of fill_record().
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/invisible_field.result17
-rw-r--r--mysql-test/main/invisible_field.test13
2 files changed, 29 insertions, 1 deletions
diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result
index ee45567d212..cd1bb77be71 100644
--- a/mysql-test/main/invisible_field.result
+++ b/mysql-test/main/invisible_field.result
@@ -538,7 +538,7 @@ a b
insert into t2 values(1);
select a,b from t2;
a b
-NULL 1
+12 1
drop table t1,t2;
create table t1 (a int invisible, b int, c int);
create table t2 (a int, b int, d int);
@@ -623,3 +623,18 @@ drop table t1;
create table t1 (a int, b int invisible);
insert delayed into t1 values (1);
drop table t1;
+#
+# MDEV-25891 Computed default for INVISIBLE column is ignored in INSERT
+#
+create table t1(
+a int,
+x int default (a),
+y int default (a) invisible,
+z int default (33) invisible);
+insert into t1 values (1, default);
+insert into t1 (a) values (2);
+select a, x, y, z from t1;
+a x y z
+1 1 1 33
+2 2 2 33
+drop table t1;
diff --git a/mysql-test/main/invisible_field.test b/mysql-test/main/invisible_field.test
index 7a48347ec29..558ca7aa3a2 100644
--- a/mysql-test/main/invisible_field.test
+++ b/mysql-test/main/invisible_field.test
@@ -279,3 +279,16 @@ create table t1 (a int, b int invisible);
insert delayed into t1 values (1);
# cleanup
drop table t1;
+
+--echo #
+--echo # MDEV-25891 Computed default for INVISIBLE column is ignored in INSERT
+--echo #
+create table t1(
+ a int,
+ x int default (a),
+ y int default (a) invisible,
+ z int default (33) invisible);
+insert into t1 values (1, default);
+insert into t1 (a) values (2);
+select a, x, y, z from t1;
+drop table t1;