diff options
author | unknown <sergefp@mysql.com> | 2005-11-07 09:23:43 +0300 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2005-11-07 09:23:43 +0300 |
commit | 467deb4cb7aeb456086838cadcdf10b25b667a36 (patch) | |
tree | 43568722102eea9419ddf527772823b778977743 /mysql-test/t/create.test | |
parent | 3a5a518de42c8c23b7b80d1ae716424e23748463 (diff) | |
download | mariadb-git-467deb4cb7aeb456086838cadcdf10b25b667a36.tar.gz |
BUG#14480, attempt2: In CREATE ... SELECT ..., don't count the same field twice
when calculating table->null_fields.
mysql-test/r/create.result:
Testcase for BUG#14480
mysql-test/t/create.test:
Testcase for BUG#14480
sql/sql_table.cc:
BUG#14480: For CREATE ... SELECT ... a field list passed to mysql_prepare_table() contains
instances of create_field for both create-list and select-list. mysql_prepare_table()
matches elements that refer to the same field, and joins them together. When the "join"
is performed, both of create_field structures has already been counted in "null_fields".
This fix makes sure that "null_fields" contains the correct value after two create_field
structures have been joined.
Diffstat (limited to 'mysql-test/t/create.test')
-rw-r--r-- | mysql-test/t/create.test | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 966be8b58a3..3bdc970027b 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -3,7 +3,7 @@ # --disable_warnings -drop table if exists t1,t2,t3; +drop table if exists t1,t2,t3,t4,t5; drop database if exists mysqltest; --enable_warnings @@ -534,4 +534,66 @@ create table t1 ( show create table t1; drop table t1; +# +# BUG#14480: assert failure in CREATE ... SELECT because of wrong +# calculation of number of NULLs. +# +CREATE TABLE t2 ( + a int(11) default NULL +); +insert into t2 values(111); + +create table t1 ( + a varchar(12) charset utf8 collate utf8_bin not null, + b int not null, primary key (a) +) select a, 1 as b from t2 ; +show create table t1; +drop table t1; + +create table t1 ( + a varchar(12) charset utf8 collate utf8_bin not null, + b int not null, primary key (a) +) select 'a' as a , 1 as b from t2 ; +show create table t1; +drop table t1; + +create table t1 ( + a varchar(12) charset utf8 collate utf8_bin, + b int not null, primary key (a) +) select 'a' as a , 1 as b from t2 ; +show create table t1; +drop table t1, t2; + +create table t1 ( + a1 int not null, + a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +); +insert into t1 values (1,1,1, 1,1,1, 1,1,1); + +create table t2 ( + a1 varchar(12) charset utf8 collate utf8_bin not null, + a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, + primary key (a1) +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; +drop table t2; + +create table t2 ( + a1 varchar(12) charset utf8 collate utf8_bin, + a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1; + +drop table t1, t2; +create table t1 ( + a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int +); +insert into t1 values (1,1,1, 1,1,1, 1,1,1); + +create table t2 ( + a1 varchar(12) charset utf8 collate utf8_bin not null, + a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, + primary key (a1) +) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; + +drop table t1, t2; + # End of 4.1 tests |