summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2004-09-10 18:56:47 +0200
committerunknown <ingo@mysql.com>2004-09-10 18:56:47 +0200
commit7c80446c4e0bd6d4572bdbc3a5498c379c49d0a5 (patch)
treea909c5ccb0ef4d5a098f4bc2bde5325839c3482c /mysql-test
parente2252a49f7393076107ee5e228be79660e7faecb (diff)
downloadmariadb-git-7c80446c4e0bd6d4572bdbc3a5498c379c49d0a5.tar.gz
BUG#4788 - show create table provides incorrect statement.
Added code to adjust the field_length of user variables in dependence on the field type. Aded new constants for numeric field widths. include/mysql_com.h: BUG#4788 - show create table provides incorrect statement. Introduced definitions for default field width of numeric types. So common values can be used at different places in the code. mysql-test/r/variables.result: BUG#4788 - show create table provides incorrect statement. New test results. mysql-test/t/variables.test: BUG#4788 - show create table provides incorrect statement. Added a test for the bug. sql/item_func.cc: BUG#4788 - show create table provides incorrect statement. Added code to adjust the field_length of user variables in dependence on the field type. sql/sql_parse.cc: BUG#4788 - show create table provides incorrect statement. Changed numeric literals to the new constants.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/variables.result26
-rw-r--r--mysql-test/t/variables.test19
2 files changed, 45 insertions, 0 deletions
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 5d3f32cdd55..b2a97ce3e48 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -452,3 +452,29 @@ set global log_warnings = @tstlw;
show global variables like 'log_warnings';
Variable_name Value
log_warnings 1
+create table t1 (
+c1 tinyint,
+c2 smallint,
+c3 mediumint,
+c4 int,
+c5 bigint);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(4) default NULL,
+ `c2` smallint(6) default NULL,
+ `c3` mediumint(9) default NULL,
+ `c4` int(11) default NULL,
+ `c5` bigint(20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
+create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) default NULL,
+ `c2` double default NULL,
+ `c3` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index a480ecb570a..fd6ab4d6405 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -335,3 +335,22 @@ show global variables like 'log_warnings';
set global log_warnings = @tstlw;
show global variables like 'log_warnings';
+#
+# BUG#4788 show create table provides incorrect statement
+#
+# What default width have numeric types?
+create table t1 (
+ c1 tinyint,
+ c2 smallint,
+ c3 mediumint,
+ c4 int,
+ c5 bigint);
+show create table t1;
+drop table t1;
+#
+# What types and widths have variables?
+set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
+create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
+show create table t1;
+drop table t1;
+