Below is the list of changes that have just been committed into a local
4.1 repository of psergey. When psergey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2457 05/10/31 09:33:00 sergefp@stripped +3 -0
BUG#14480: CREATE ... SELECT ...: Don't count the same field twice when calculating
table->null_fields.
sql/sql_table.cc
1.304 05/10/31 09:32:54 sergefp@stripped +8 -1
BUG#14480: For CREATE ... SELECT ... a field list passed to mysql_prepare_table()
contains
instances of class Field for both create list and select list. When we for Field *a,b
detect
that they refer to the same field, this field is counted twice in null_fields. The fix
is to
decrement null_fields back.
mysql-test/t/create.test
1.61 05/10/31 09:32:54 sergefp@stripped +13 -0
Testcase for BUG#14480
mysql-test/r/create.result
1.87 05/10/31 09:32:54 sergefp@stripped +16 -0
Testcase for BUG#14480
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: sergefp
# Host: newbox.mylan
# Root: /home/psergey/mysql-4.1-bug14480
--- 1.303/sql/sql_table.cc 2005-10-26 00:56:10 +04:00
+++ 1.304/sql/sql_table.cc 2005-10-31 09:32:54 +03:00
@@ -647,8 +647,15 @@
sql_field->pack_length= dup_field->pack_length;
sql_field->create_length_to_internal_length();
sql_field->decimals= dup_field->decimals;
- sql_field->flags= dup_field->flags;
sql_field->unireg_check= dup_field->unireg_check;
+ /*
+ We're making one field from two. If we've counted both of them
+ in null_fields, substract one back.
+ */
+ if ((dup_field->flags & NOT_NULL_FLAG) &&
+ (sql_field->flags & NOT_NULL_FLAG))
+ null_fields--;
+ sql_field->flags= dup_field->flags;
it2.remove(); // Remove first (create) definition
select_field_pos--;
break;
--- 1.86/mysql-test/r/create.result 2005-10-26 00:56:10 +04:00
+++ 1.87/mysql-test/r/create.result 2005-10-31 09:32:54 +03:00
@@ -632,3 +632,19 @@
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+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;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '',
+ `b` int(11) NOT NULL default '0',
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
--- 1.60/mysql-test/t/create.test 2005-10-26 00:56:10 +04:00
+++ 1.61/mysql-test/t/create.test 2005-10-31 09:32:54 +03:00
@@ -534,4 +534,17 @@
show create table t1;
drop table t1;
+# BUG#14480
+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, t2;
+
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (sergefp:1.2457) BUG#14480 | Sergey Petrunia | 31 Oct |