List:Commits« Previous MessageNext Message »
From:gkodinov Date:November 30 2006 11:27am
Subject:bk commit into 5.1 tree (gkodinov:1.2365)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of gkodinov. When gkodinov 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-11-30 12:27:04+01:00, gkodinov@stripped +6 -0
  Merge dl145s.mysql.com:/data0/bk/team_tree_merge/mysql-5.1
  into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE/mysql-5.1-opt
  MERGE: 1.2353.3.23

  mysql-test/r/func_in.result@stripped, 2006-11-30 12:26:58+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.30.1.1

  mysql-test/r/ps.result@stripped, 2006-11-30 12:26:58+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.87.1.2

  mysql-test/t/ps.test@stripped, 2006-11-30 12:26:58+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.86.1.2

  sql/field.cc@stripped, 2006-11-30 12:26:58+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.355.1.1

  sql/item_func.h@stripped, 2006-11-30 12:26:58+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.152.1.3

  sql/item_sum.cc@stripped, 2006-11-30 12:26:59+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.201.1.2

# 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:	gkodinov
# Host:	dl145s.mysql.com
# Root:	/data0/bk/team_tree_merge/MERGE/mysql-5.1-opt/RESYNC

--- 1.356/sql/field.cc	2006-11-29 11:48:42 +01:00
+++ 1.357/sql/field.cc	2006-11-30 12:26:58 +01:00
@@ -6731,9 +6731,9 @@ void Field_varstring::sql_type(String &r
 }
 
 
-uint32 Field_varstring::data_length(const char *from)
+uint32 Field_varstring::data_length()
 {
-  return length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr);
+  return length_bytes == 1 ? (uint32) (uchar) *ptr : uint2korr(ptr);
 }
 
 /*

--- 1.154/sql/item_func.h	2006-11-29 21:36:21 +01:00
+++ 1.155/sql/item_func.h	2006-11-30 12:26:58 +01:00
@@ -157,7 +157,7 @@ public:
     return (null_value=args[0]->get_time(ltime));
   }
   bool is_null() { 
-    (void) val_int();  /* Discard result. It sets null_value as side-effect. */ 
+    update_null_value();
     return null_value; 
   }
   void signal_divide_by_null();
@@ -241,7 +241,7 @@ public:
   virtual double real_op()= 0;
   virtual my_decimal *decimal_op(my_decimal *)= 0;
   virtual String *str_op(String *)= 0;
-  bool is_null() { (void) val_real(); return null_value; }
+  bool is_null() { update_null_value(); return null_value; }
 };
 
 /* function where type of result detected by first argument */

--- 1.202/sql/item_sum.cc	2006-11-29 11:46:26 +01:00
+++ 1.203/sql/item_sum.cc	2006-11-30 12:26:59 +01:00
@@ -322,9 +322,13 @@ void Item_sum::make_field(Send_field *tm
   if (args[0]->type() == Item::FIELD_ITEM && keep_field_type())
   {
     ((Item_field*) args[0])->field->make_field(tmp_field);
-    tmp_field->db_name=(char*)"";
-    tmp_field->org_table_name=tmp_field->table_name=(char*)"";
-    tmp_field->org_col_name=tmp_field->col_name=name;
+    /* For expressions only col_name should be non-empty string. */
+    char *empty_string= (char*)"";
+    tmp_field->db_name= empty_string;
+    tmp_field->org_table_name= empty_string;
+    tmp_field->table_name= empty_string;
+    tmp_field->org_col_name= empty_string;
+    tmp_field->col_name= name;
     if (maybe_null)
       tmp_field->flags&= ~NOT_NULL_FLAG;
   }

--- 1.31/mysql-test/r/func_in.result	2006-11-16 12:12:59 +01:00
+++ 1.32/mysql-test/r/func_in.result	2006-11-30 12:26:58 +01:00
@@ -358,16 +358,22 @@ select f1 from t1 where f1 in ('a',1);
 f1
 a
 1
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'b'
 select f1, case f1 when 'a' then '+' when 1 then '-' end from t1;
 f1	case f1 when 'a' then '+' when 1 then '-' end
 a	+
 b	NULL
 1	-
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'b'
 create index t1f1_idx on t1(f1);
 select f1 from t1 where f1 in ('a',1);
 f1
 1
 a
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'b'
 explain select f1 from t1 where f1 in ('a',1);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	index	NULL	t1f1_idx	2	NULL	3	Using where; Using index
@@ -381,6 +387,9 @@ id	select_type	table	type	possible_keys	
 select f1 from t1 where f1 in (2,1);
 f1
 1
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'a'
+Warning	1292	Truncated incorrect DOUBLE value: 'b'
 explain select f1 from t1 where f1 in (2,1);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	index	t1f1_idx	t1f1_idx	2	NULL	3	Using where; Using index

--- 1.91/mysql-test/r/ps.result	2006-11-29 09:42:06 +01:00
+++ 1.92/mysql-test/r/ps.result	2006-11-30 12:26:58 +01:00
@@ -1486,6 +1486,24 @@ i
 1
 DEALLOCATE PREPARE stmt;
 DROP TABLE t1, t2;
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1), (2);
+SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
+WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1);
+i
+1
+PREPARE stmt FROM "SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
+WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1)";
+EXECUTE stmt;
+i
+1
+EXECUTE stmt;
+i
+1
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1;
+DROP TABLE t1;
 DROP PROCEDURE IF EXISTS p1;
 flush status;
 prepare sq from 'show status like "slow_queries"';

--- 1.90/mysql-test/t/ps.test	2006-11-29 09:42:06 +01:00
+++ 1.91/mysql-test/t/ps.test	2006-11-30 12:26:58 +01:00
@@ -1520,6 +1520,29 @@ DROP TABLE t1, t2;
 
 
 #
+# BUG#20327: Marking of a wrong field leads to a wrong result on select with
+#            view, prepared statement and subquery.
+#
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+INSERT INTO t1 VALUES (1), (2);
+
+let $query = SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
+             WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1);
+eval $query;
+eval PREPARE stmt FROM "$query";
+# Statement execution should return '1'.
+EXECUTE stmt;
+# Check re-execution.
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+#
 # BUG#21856: Prepared Statments: crash if bad create
 #
 --disable_warnings
Thread
bk commit into 5.1 tree (gkodinov:1.2365)gkodinov30 Nov