summaryrefslogtreecommitdiff
path: root/mysql-test/t/invisible_field.test
diff options
context:
space:
mode:
authorSachin Setiya <sachin.setiya@mariadb.com>2018-01-30 14:04:05 +0530
committerSachin Setiya <sachin.setiya@mariadb.com>2018-01-31 10:45:33 +0530
commitfe3a95d44d65cf3de5133a9ee256764b8ae98104 (patch)
treec8cf5b0439257049e5e19b9abd6c30ca1a132cb4 /mysql-test/t/invisible_field.test
parent7a9611aee2ca27124f0b845d8cefe211b84f3045 (diff)
downloadmariadb-git-bb-mdev-15085.tar.gz
Mdev-15085 Invisible Column Non-constant Default value results...bb-mdev-15085
Problem:- If we create table field with dynamic default value then that field always gets NULL value. Analyze:- This is because in fill_record we simple continue at Invisible column because we though that share->default_values(default value is always copied into table->record[0] before insert) will have a default value for them(which is true for constant defaults , but not for dynamic defaults). Solution:- We simple set all_fields_have_value to null , and this will make call to update_default_fields (in the case of dynamic default), And default expr will be evaluted and value will be set in field.
Diffstat (limited to 'mysql-test/t/invisible_field.test')
-rw-r--r--mysql-test/t/invisible_field.test10
1 files changed, 9 insertions, 1 deletions
diff --git a/mysql-test/t/invisible_field.test b/mysql-test/t/invisible_field.test
index b1d28d882d7..a68e05cf320 100644
--- a/mysql-test/t/invisible_field.test
+++ b/mysql-test/t/invisible_field.test
@@ -213,4 +213,12 @@ execute insert_1;
set @a=2,@b=2, @c=2;
execute insert_2;
select a,b,c,d from t1 order by a;
-drop table t1; \ No newline at end of file
+drop table t1;
+#MDEV-15085 Non constant default getting Null values
+create table t1(a int default 5 invisible, b int);
+create table t2(a int default (b+11) invisible, b int);
+insert into t1 values(1);
+select a,b from t1;
+insert into t2 values(1);
+select a,b from t2;
+drop table t1,t2; \ No newline at end of file