List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:July 10 2006 7:38pm
Subject:bk commit into 5.1 tree (cmiller:1.2219)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cmiller. When cmiller 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@stripped, 2006-07-10 13:38:22-04:00, cmiller@zippy.(none) +11 -0
  Merge zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1
  into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1-new-maint
  MERGE: 1.2181.1.66

  mysql-test/mysql-test-run.pl@stripped, 2006-07-10 13:38:17-04:00, cmiller@zippy.(none) +0
-0
    Auto merged
    MERGE: 1.122.1.7

  mysql-test/r/create.result@stripped, 2006-07-10 13:38:17-04:00, cmiller@zippy.(none) +0 -0
    Auto merged
    MERGE: 1.120.1.1

  mysql-test/r/ps.result@stripped, 2006-07-10 13:38:17-04:00, cmiller@zippy.(none) +0 -0
    Auto merged
    MERGE: 1.66.1.3

  mysql-test/r/sp.result@stripped, 2006-07-10 13:38:18-04:00, cmiller@zippy.(none) +0 -0
    Auto merged
    MERGE: 1.206.1.5

  mysql-test/t/create.test@stripped, 2006-07-10 13:38:18-04:00, cmiller@zippy.(none) +0 -0
    Auto merged
    MERGE: 1.81.1.1

  mysql-test/t/ndb_autodiscover3.test@stripped, 2006-07-10 13:38:18-04:00, cmiller@zippy.(none)
+0 -0
    Auto merged
    MERGE: 1.4.1.2

  mysql-test/t/ps.test@stripped, 2006-07-10 13:38:18-04:00, cmiller@zippy.(none) +0 -0
    Auto merged
    MERGE: 1.64.1.3

  mysql-test/t/sp.test@stripped, 2006-07-10 13:38:18-04:00, cmiller@zippy.(none) +0 -0
    Auto merged
    MERGE: 1.189.1.5

  mysql-test/t/wait_timeout.test@stripped, 2006-07-10 13:38:18-04:00, cmiller@zippy.(none) +0
-0
    Auto merged
    MERGE: 1.6.1.2

  sql/field.cc@stripped, 2006-07-10 13:38:18-04:00, cmiller@zippy.(none) +0 -0
    Auto merged
    MERGE: 1.324.1.2

  sql/field.h@stripped, 2006-07-10 13:38:18-04:00, cmiller@zippy.(none) +0 -0
    Auto merged
    MERGE: 1.190.1.1

# 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:	cmiller
# Host:	zippy.(none)
# Root:	/home/cmiller/work/mysql/merge/mysql-5.1-new-maint/RESYNC

--- 1.325/sql/field.cc	2006-07-10 13:38:30 -04:00
+++ 1.326/sql/field.cc	2006-07-10 13:38:30 -04:00
@@ -1536,7 +1536,8 @@
 }
 
 
-Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table)
+Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table,
+                        bool keep_type __attribute__((unused)))
 {
   Field *tmp;
   if (!(tmp= (Field*) memdup_root(root,(char*) this,size_of())))
@@ -1561,7 +1562,7 @@
                             uint new_null_bit)
 {
   Field *tmp;
-  if ((tmp= new_field(root, new_table)))
+  if ((tmp= new_field(root, new_table, table == new_table)))
   {
     tmp->ptr=      new_ptr;
     tmp->null_ptr= new_null_ptr;
@@ -6383,11 +6384,12 @@
 }
 
 
-Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table)
+Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
+                               bool keep_type)
 {
   Field *field;
-  if (type() != MYSQL_TYPE_VAR_STRING || table == new_table)
-    return Field::new_field(root, new_table);
+  if (type() != MYSQL_TYPE_VAR_STRING || keep_type)
+    return Field::new_field(root, new_table, keep_type);
 
   /*
     Old VARCHAR field which should be modified to a VARCHAR on copy
@@ -6396,17 +6398,7 @@
   */
   if ((field= new Field_varstring(field_length, maybe_null(), field_name,
                                   new_table->s, charset())))
-  {
     field->init(new_table);
-    /*
-      delayed_insert::get_local_table() needs a ptr copied from old table.
-      This is what other new_field() methods do too. The above method of
-      Field_varstring sets ptr to NULL.
-    */
-    field->ptr= ptr;
-    field->null_ptr= null_ptr;
-    field->null_bit= null_bit;
-  }
   return field;
 }
 
@@ -6908,9 +6900,11 @@
 }
 
 
-Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table)
+Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table,
+                                  bool keep_type)
 {
-  Field_varstring *res= (Field_varstring*) Field::new_field(root, new_table);
+  Field_varstring *res= (Field_varstring*) Field::new_field(root, new_table,
+                                                            keep_type);
   if (res)
     res->length_bytes= length_bytes;
   return res;

--- 1.191/sql/field.h	2006-07-10 13:38:30 -04:00
+++ 1.192/sql/field.h	2006-07-10 13:38:30 -04:00
@@ -219,7 +219,8 @@
   */
   virtual bool can_be_compared_as_longlong() const { return FALSE; }
   virtual void free() {}
-  virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table);
+  virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table,
+                           bool keep_type);
   virtual Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
                                char *new_ptr, uchar *new_null_ptr,
                                uint new_null_bit);
@@ -1045,7 +1046,7 @@
   enum_field_types real_type() const { return FIELD_TYPE_STRING; }
   bool has_charset(void) const
   { return charset() == &my_charset_bin ? FALSE : TRUE; }
-  Field *new_field(MEM_ROOT *root, struct st_table *new_table);
+  Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
 };
 
 
@@ -1118,7 +1119,7 @@
   enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; }
   bool has_charset(void) const
   { return charset() == &my_charset_bin ? FALSE : TRUE; }
-  Field *new_field(MEM_ROOT *root, struct st_table *new_table);
+  Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
   Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
                        char *new_ptr, uchar *new_null_ptr,
                        uint new_null_bit);

--- 1.8/mysql-test/t/wait_timeout.test	2006-07-10 13:38:30 -04:00
+++ 1.9/mysql-test/t/wait_timeout.test	2006-07-10 13:38:30 -04:00
@@ -9,16 +9,20 @@
 # Connect with another connection and reset counters
 --disable_query_log
 connect (wait_con,localhost,root,,test,,);
-flush status; # Reset counters
 connection wait_con;
 set session wait_timeout=100;
 let $retries=300;
-let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
 set @aborted_clients= 0;
 --enable_query_log
 
 # Disable reconnect and do the query
 connection default;
+# If slow host (Valgrind...), we may have already timed out here.
+# So force a reconnect if necessary, using a dummy query. And issue a
+# 'flush status' to reset the 'aborted_clients' counter.
+--enable_reconnect
+select 0;
+flush status;
 --disable_reconnect
 select 1;
 
@@ -49,6 +53,9 @@
 select 2;
 --enable_reconnect
 select 3;
+# Disconnect so that we will not be confused by a future abort from this
+# connection.
+disconnect default
 
 #
 # Do the same test as above on a TCP connection
@@ -59,7 +66,6 @@
 connection wait_con;
 flush status; # Reset counters
 let $retries=300;
-let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
 set @aborted_clients= 0;
 --enable_query_log
 

--- 1.139/mysql-test/mysql-test-run.pl	2006-07-10 13:38:30 -04:00
+++ 1.140/mysql-test/mysql-test-run.pl	2006-07-10 13:38:30 -04:00
@@ -552,6 +552,11 @@
               "($opt_master_myport - $opt_master_myport + 10)");
   }
 
+  # This is needed for test log evaluation in "gen-build-status-page"
+  # in all cases where the calling tool does not log the commands
+  # directly before it executes them, like "make test-force-pl" in RPM builds.
+  print "Logging: $0 ", join(" ", @ARGV), "\n";
+
   # Read the command line
   # Note: Keep list, and the order, in sync with usage at end of this file
 

--- 1.121/mysql-test/r/create.result	2006-07-10 13:38:30 -04:00
+++ 1.122/mysql-test/r/create.result	2006-07-10 13:38:30 -04:00
@@ -620,7 +620,7 @@
 use mysqltest;
 drop database mysqltest;
 create table test.t1 like x;
-ERROR 42000: Incorrect database name 'NULL'
+ERROR 3D000: No database selected
 drop table if exists test.t1;
 create database mysqltest;
 use mysqltest;

--- 1.82/mysql-test/t/create.test	2006-07-10 13:38:30 -04:00
+++ 1.83/mysql-test/t/create.test	2006-07-10 13:38:30 -04:00
@@ -521,7 +521,7 @@
 create database mysqltest;
 use mysqltest;
 drop database mysqltest;
---error 1102
+--error ER_NO_DB_ERROR 
 create table test.t1 like x;
 --disable_warnings
 drop table if exists test.t1;

--- 1.209/mysql-test/r/sp.result	2006-07-10 13:38:30 -04:00
+++ 1.210/mysql-test/r/sp.result	2006-07-10 13:38:30 -04:00
@@ -4984,6 +4984,52 @@
 DROP FUNCTION bug18037_f1|
 DROP PROCEDURE bug18037_p1|
 DROP PROCEDURE bug18037_p2|
+use test|
+create table t3 (i int)|
+insert into t3 values (1), (2)|
+create database mysqltest1|
+use mysqltest1|
+create function bug17199() returns varchar(2) deterministic return 'ok'|
+use test|
+select *, mysqltest1.bug17199() from t3|
+i	mysqltest1.bug17199()
+1	ok
+2	ok
+use mysqltest1|
+create function bug18444(i int) returns int no sql deterministic return i + 1|
+use test|
+select mysqltest1.bug18444(i) from t3|
+mysqltest1.bug18444(i)
+2
+3
+drop database mysqltest1|
+create database mysqltest1 charset=utf8|
+create database mysqltest2 charset=utf8|
+create procedure mysqltest1.p1()
+begin
+-- alters the default collation of database test 
+alter database character set koi8r;
+end|
+use mysqltest1|
+call p1()|
+show create database mysqltest1|
+Database	Create Database
+mysqltest1	CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET koi8r */
+show create database mysqltest2|
+Database	Create Database
+mysqltest2	CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET utf8 */
+alter database mysqltest1 character set utf8|
+use mysqltest2|
+call mysqltest1.p1()|
+show create database mysqltest1|
+Database	Create Database
+mysqltest1	CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET koi8r */
+show create database mysqltest2|
+Database	Create Database
+mysqltest2	CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET utf8 */
+drop database mysqltest1|
+drop database mysqltest2|
+use test|
 drop table if exists t3|
 drop procedure if exists bug15217|
 create table t3 as select 1|

--- 1.192/mysql-test/t/sp.test	2006-07-10 13:38:30 -04:00
+++ 1.193/mysql-test/t/sp.test	2006-07-10 13:38:30 -04:00
@@ -5877,6 +5877,52 @@
 DROP PROCEDURE bug18037_p2|
 
 #
+# Bug#17199: "Table not found" error occurs if the query contains a call
+#            to a function from another database.
+#            See also ps.test for an additional test case for this bug.
+#
+use test|
+create table t3 (i int)|
+insert into t3 values (1), (2)|
+create database mysqltest1|
+use mysqltest1|
+create function bug17199() returns varchar(2) deterministic return 'ok'|
+use test|
+select *, mysqltest1.bug17199() from t3|
+#
+# Bug#18444: Fully qualified stored function names don't work correctly
+#            in select statements
+#
+use mysqltest1|
+create function bug18444(i int) returns int no sql deterministic return i + 1|
+use test|
+select mysqltest1.bug18444(i) from t3|
+drop database mysqltest1|
+#
+# Check that current database has no influence to a stored procedure
+#
+create database mysqltest1 charset=utf8|
+create database mysqltest2 charset=utf8|
+create procedure mysqltest1.p1()
+begin
+-- alters the default collation of database test 
+  alter database character set koi8r;
+end|
+use mysqltest1|
+call p1()|
+show create database mysqltest1|
+show create database mysqltest2|
+alter database mysqltest1 character set utf8|
+use mysqltest2|
+call mysqltest1.p1()|
+show create database mysqltest1|
+show create database mysqltest2|
+drop database mysqltest1|
+drop database mysqltest2|
+#
+# Restore the old environemnt
+use test|
+#
 # Bug#15217 "Using a SP cursor on a table created with PREPARE fails with
 #           weird error". Check that the code that is supposed to work at
 #           the first execution of a stored procedure actually works for

--- 1.68/mysql-test/r/ps.result	2006-07-10 13:38:30 -04:00
+++ 1.69/mysql-test/r/ps.result	2006-07-10 13:38:30 -04:00
@@ -1158,3 +1158,108 @@
 Error	1146	Table 'test.t4' doesn't exist
 deallocate prepare stmt;
 drop table t1, t2, t3;
+create database mysqltest_long_database_name_to_thrash_heap;
+use test;
+create table t1 (i int);
+prepare stmt from "alter table test.t1 rename t1";
+use mysqltest_long_database_name_to_thrash_heap;
+execute stmt;
+show tables like 't1';
+Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
+prepare stmt from "alter table test.t1 rename t1";
+use test;
+execute stmt;
+show tables like 't1';
+Tables_in_test (t1)
+use mysqltest_long_database_name_to_thrash_heap;
+show tables like 't1';
+Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
+t1
+deallocate prepare stmt;
+use mysqltest_long_database_name_to_thrash_heap;
+prepare stmt_create from "create table t1 (i int)";
+prepare stmt_insert from "insert into t1 (i) values (1)";
+prepare stmt_update from "update t1 set i=2";
+prepare stmt_delete from "delete from t1 where i=2";
+prepare stmt_select from "select * from t1";
+prepare stmt_alter from "alter table t1 add column (b int)";
+prepare stmt_alter1 from "alter table t1 drop column b";
+prepare stmt_analyze from "analyze table t1";
+prepare stmt_optimize from "optimize table t1";
+prepare stmt_show from "show tables like 't1'";
+prepare stmt_truncate from "truncate table t1";
+prepare stmt_drop from "drop table t1";
+drop table t1;
+use test;
+execute stmt_create;
+show tables like 't1';
+Tables_in_test (t1)
+use mysqltest_long_database_name_to_thrash_heap;
+show tables like 't1';
+Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
+t1
+use test;
+execute stmt_insert;
+select * from mysqltest_long_database_name_to_thrash_heap.t1;
+i
+1
+execute stmt_update;
+select * from mysqltest_long_database_name_to_thrash_heap.t1;
+i
+2
+execute stmt_delete;
+execute stmt_select;
+i
+execute stmt_alter;
+show columns from mysqltest_long_database_name_to_thrash_heap.t1;
+Field	Type	Null	Key	Default	Extra
+i	int(11)	YES		NULL	
+b	int(11)	YES		NULL	
+execute stmt_alter1;
+show columns from mysqltest_long_database_name_to_thrash_heap.t1;
+Field	Type	Null	Key	Default	Extra
+i	int(11)	YES		NULL	
+execute stmt_analyze;
+Table	Op	Msg_type	Msg_text
+mysqltest_long_database_name_to_thrash_heap.t1	analyze	status	Table is already up to date
+execute stmt_optimize;
+Table	Op	Msg_type	Msg_text
+mysqltest_long_database_name_to_thrash_heap.t1	optimize	status	Table is already up to
date
+execute stmt_show;
+Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
+t1
+execute stmt_truncate;
+execute stmt_drop;
+show tables like 't1';
+Tables_in_test (t1)
+use mysqltest_long_database_name_to_thrash_heap;
+show tables like 't1';
+Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
+drop database mysqltest_long_database_name_to_thrash_heap;
+prepare stmt_create from "create table t1 (i int)";
+ERROR 3D000: No database selected
+prepare stmt_insert from "insert into t1 (i) values (1)";
+ERROR 3D000: No database selected
+prepare stmt_update from "update t1 set i=2";
+ERROR 3D000: No database selected
+prepare stmt_delete from "delete from t1 where i=2";
+ERROR 3D000: No database selected
+prepare stmt_select from "select * from t1";
+ERROR 3D000: No database selected
+prepare stmt_alter from "alter table t1 add column (b int)";
+ERROR 3D000: No database selected
+prepare stmt_alter1 from "alter table t1 drop column b";
+ERROR 3D000: No database selected
+prepare stmt_analyze from "analyze table t1";
+ERROR 3D000: No database selected
+prepare stmt_optimize from "optimize table t1";
+ERROR 3D000: No database selected
+prepare stmt_show from "show tables like 't1'";
+ERROR 3D000: No database selected
+prepare stmt_truncate from "truncate table t1";
+ERROR 3D000: No database selected
+prepare stmt_drop from "drop table t1";
+ERROR 3D000: No database selected
+create temporary table t1 (i int);
+ERROR 3D000: No database selected
+use test;

--- 1.66/mysql-test/t/ps.test	2006-07-10 13:38:30 -04:00
+++ 1.67/mysql-test/t/ps.test	2006-07-10 13:38:30 -04:00
@@ -1146,4 +1146,122 @@
 execute stmt;
 deallocate prepare stmt;
 drop table t1, t2, t3;
+
+#
+# Bug#17199 "Table not found" error occurs if the query contains a call
+#            to a function from another database.
+#            Test prepared statements- related behaviour.
+#
+#
+# ALTER TABLE RENAME and Prepared Statements: wrong DB name buffer was used
+# in ALTER ... RENAME which caused memory corruption in prepared statements.
+# No need to fix this problem in 4.1 as ALTER TABLE is not allowed in
+# Prepared Statements in 4.1.
+#
+create database mysqltest_long_database_name_to_thrash_heap;
+use test;
+create table t1 (i int);
+prepare stmt from "alter table test.t1 rename t1";
+use mysqltest_long_database_name_to_thrash_heap;
+execute stmt;
+show tables like 't1';
+prepare stmt from "alter table test.t1 rename t1";
+use test;
+execute stmt;
+show tables like 't1';
+use mysqltest_long_database_name_to_thrash_heap;
+show tables like 't1';
+deallocate prepare stmt;
+#
+# Check that a prepared statement initializes its current database at
+# PREPARE, and then works correctly even if the current database has been
+# changed.
+# 
+use mysqltest_long_database_name_to_thrash_heap; 
+# Necessary for preparation of INSERT/UPDATE/DELETE to succeed
+prepare stmt_create from "create table t1 (i int)";
+prepare stmt_insert from "insert into t1 (i) values (1)";
+prepare stmt_update from "update t1 set i=2";
+prepare stmt_delete from "delete from t1 where i=2";
+prepare stmt_select from "select * from t1";
+prepare stmt_alter from "alter table t1 add column (b int)";
+prepare stmt_alter1 from "alter table t1 drop column b";
+prepare stmt_analyze from "analyze table t1";
+prepare stmt_optimize from "optimize table t1";
+prepare stmt_show from "show tables like 't1'";
+prepare stmt_truncate from "truncate table t1";
+prepare stmt_drop from "drop table t1";
+# Drop the table that was used to prepare INSERT/UPDATE/DELETE: we will
+# create a new one by executing stmt_create
+drop table t1;
+# Switch the current database
+use test;
+# Check that all prepared statements operate on the database that was
+# active at PREPARE
+execute stmt_create;
+# should return empty set
+show tables like 't1';
+use mysqltest_long_database_name_to_thrash_heap;
+show tables like 't1';
+use test;
+execute stmt_insert;
+select * from mysqltest_long_database_name_to_thrash_heap.t1;
+execute stmt_update;
+select * from mysqltest_long_database_name_to_thrash_heap.t1;
+execute stmt_delete;
+execute stmt_select;
+execute stmt_alter;
+show columns from mysqltest_long_database_name_to_thrash_heap.t1;
+execute stmt_alter1;
+show columns from mysqltest_long_database_name_to_thrash_heap.t1;
+execute stmt_analyze;
+execute stmt_optimize;
+execute stmt_show;
+execute stmt_truncate;
+execute stmt_drop;
+show tables like 't1';
+use mysqltest_long_database_name_to_thrash_heap;
+show tables like 't1';
+#
+# Attempt a statement PREPARE when there is no current database:
+# is expected to return an error.
+#
+drop database mysqltest_long_database_name_to_thrash_heap;
+--error ER_NO_DB_ERROR
+prepare stmt_create from "create table t1 (i int)";
+--error ER_NO_DB_ERROR
+prepare stmt_insert from "insert into t1 (i) values (1)";
+--error ER_NO_DB_ERROR
+prepare stmt_update from "update t1 set i=2";
+--error ER_NO_DB_ERROR
+prepare stmt_delete from "delete from t1 where i=2";
+--error ER_NO_DB_ERROR
+prepare stmt_select from "select * from t1";
+--error ER_NO_DB_ERROR
+prepare stmt_alter from "alter table t1 add column (b int)";
+--error ER_NO_DB_ERROR
+prepare stmt_alter1 from "alter table t1 drop column b";
+--error ER_NO_DB_ERROR
+prepare stmt_analyze from "analyze table t1";
+--error ER_NO_DB_ERROR
+prepare stmt_optimize from "optimize table t1";
+--error ER_NO_DB_ERROR
+prepare stmt_show from "show tables like 't1'";
+--error ER_NO_DB_ERROR
+prepare stmt_truncate from "truncate table t1";
+--error ER_NO_DB_ERROR
+prepare stmt_drop from "drop table t1";
+#
+# The above has automatically deallocated all our statements.
+#
+# Attempt to CREATE a temporary table when no DB used: it should fail
+# This proves that no table can be used without explicit specification of
+# its database if there is no current database. 
+#
+--error ER_NO_DB_ERROR
+create temporary table t1 (i int);
+#
+# Restore the old environemnt
+#
+use test;
 # End of 5.0 tests

--- 1.5/mysql-test/t/ndb_autodiscover3.test	2006-07-10 13:38:30 -04:00
+++ 1.6/mysql-test/t/ndb_autodiscover3.test	2006-07-10 13:38:30 -04:00
@@ -2,7 +2,6 @@
 -- source include/have_multi_ndb.inc
 -- source include/not_embedded.inc
 
-
 --disable_warnings
 drop table if exists t1, t2;
 --enable_warnings
Thread
bk commit into 5.1 tree (cmiller:1.2219)Chad MILLER10 Jul