summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-07-23 16:55:52 +0200
committerSergei Golubchik <serg@mariadb.org>2016-08-27 16:59:12 +0200
commit12d2c4fcd0bc3fbe74759e8285f2c93ad348e749 (patch)
treee8f0ec7fab2a8ec1365e10a5ddde62e7af2e885d /mysql-test
parent4070d55735f1642e563b8d60fc2e9771f4963a3f (diff)
downloadmariadb-git-12d2c4fcd0bc3fbe74759e8285f2c93ad348e749.tar.gz
optimize constant default expressions
to be calculated at the CREATE TABLE time and stored in the default row image.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/default.result3
-rw-r--r--mysql-test/t/default.test3
2 files changed, 2 insertions, 4 deletions
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index 81568d6c654..386837a84bb 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -409,7 +409,6 @@ create or replace table t1 (a int not null, b int default (a+1));
create or replace table t1 (a int default a);
ERROR 01000: Expression for field `a` is refering to uninitialized field `a`
create or replace table t1 (a int default b, b int default (1+1));
-ERROR 01000: Expression for field `a` is refering to uninitialized field `b`
create or replace table t1 (a int default 1, b int as (c), c int as (a+1));
ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
CREATE TABLE t1 (a INT DEFAULT (DEFAULT(a)));
@@ -3035,7 +3034,7 @@ t1 CREATE TABLE `t1` (
`a` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT concat('A')
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
-create table t1 (a int default 1, b int default (1+1), c int);
+create table t1 (a int default 1, b int default (rand()*0+2), c int);
insert t1 (c) values (a);
insert t1 (c) values (b);
select * from t1;
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 47de4a00a50..6c871527212 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -295,7 +295,6 @@ create or replace table t1 (a int not null, b int default (a+1));
--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create or replace table t1 (a int default a);
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create or replace table t1 (a int default b, b int default (1+1));
--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create or replace table t1 (a int default 1, b int as (c), c int as (a+1));
@@ -1810,7 +1809,7 @@ DROP TABLE t1;
#
# Order of evaluation:
#
-create table t1 (a int default 1, b int default (1+1), c int);
+create table t1 (a int default 1, b int default (rand()*0+2), c int);
insert t1 (c) values (a);
insert t1 (c) values (b);
select * from t1;