summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2003-12-09 14:00:32 -0400
committerunknown <vva@eagle.mysql.r18.ru>2003-12-09 14:00:32 -0400
commite0daf11201dd6e81af73c1c74270039e73845a24 (patch)
treed4ea7710c0a83dbb74b1d1cb8d9211c8dad43a6c
parentee89f1d3404f98272e66f7e1326b73ff0fa45053 (diff)
parent32441953a75d036ead5c6b7c53de5a7e24021332 (diff)
downloadmariadb-git-e0daf11201dd6e81af73c1c74270039e73845a24.tar.gz
Merge vvagin@bk-internal.mysql.com:/home/bk/mysql-4.1
into eagle.mysql.r18.ru:/home/vva/work/BUG_1688/mysql-4.1
-rw-r--r--mysql-test/r/create.result16
-rw-r--r--mysql-test/t/create.test7
-rw-r--r--sql/sql_select.cc1
3 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 632e556d0ab..2f61b4838ee 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -407,6 +407,22 @@ a b c d e f g h dd
1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
drop table t1, t2;
+create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
+insert into t1 values ('','',0,0.0);
+describe t1;
+Field Type Null Key Default Extra
+str varchar(10) YES def
+strnull varchar(10) YES NULL
+intg int(11) YES 10
+rel double YES 3.14
+create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
+describe t2;
+Field Type Null Key Default Extra
+str varchar(10) YES NULL
+strnull varchar(10) YES NULL
+intg int(11) YES NULL
+rel double YES NULL
+drop table t1, t2;
create database test_$1;
use test_$1;
select database();
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 5bb7e420e1c..54166c3b0dc 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -323,6 +323,13 @@ select * from t2;
drop table t1, t2;
+create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
+insert into t1 values ('','',0,0.0);
+describe t1;
+create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
+describe t2;
+drop table t1, t2;
+
#
# Bug #1209
#
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3d2a572c3a9..0bf493ee953 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4734,6 +4734,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
return 0; // Error
}
case Item::FIELD_ITEM:
+ case Item::DEFAULT_VALUE_ITEM:
return create_tmp_field_from_field(thd, (*from_field=
((Item_field*) item)->field),
item, table, modify_item);