List:Commits« Previous MessageNext Message »
From:konstantin Date:March 29 2006 8:52pm
Subject:bk commit into 5.1 tree (konstantin:1.2260)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kostja. When kostja 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.2260 06/03/29 22:52:42 konstantin@stripped +24 -0
  Merge mysql.com:/opt/local/work/mysql-5.0-15683
  into  mysql.com:/opt/local/work/mysql-5.1-root

  mysql-test/t/innodb.test
    1.133 06/03/29 22:49:33 konstantin@stripped +0 -1
    Auto merged

  mysql-test/t/sp-prelocking.test
    1.6 06/03/29 22:52:36 konstantin@stripped +4 -0
    Manual merge.

  storage/ndb/tools/Makefile.am
    1.26 06/03/29 22:49:37 konstantin@stripped +0 -0
    Auto merged

  sql/sql_view.cc
    1.87 06/03/29 22:49:36 konstantin@stripped +0 -0
    Auto merged

  sql/sql_select.cc
    1.393 06/03/29 22:49:35 konstantin@stripped +0 -0
    Auto merged

  sql/sql_load.cc
    1.95 06/03/29 22:49:35 konstantin@stripped +1 -2
    Auto merged

  sql/sql_insert.cc
    1.194 06/03/29 22:49:34 konstantin@stripped +0 -0
    Auto merged

  sql/sp.cc
    1.107 06/03/29 22:49:34 konstantin@stripped +0 -0
    Auto merged

  sql/ha_ndbcluster.cc
    1.296 06/03/29 22:49:34 konstantin@stripped +0 -0
    Auto merged

  sql/field.h
    1.181 06/03/29 22:49:34 konstantin@stripped +0 -0
    Auto merged

  sql/field.cc
    1.305 06/03/29 22:49:34 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/trigger.test
    1.41 06/03/29 22:49:33 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/sp.test
    1.186 06/03/29 22:49:33 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/sp-error.test
    1.107 06/03/29 22:49:33 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/ps.test
    1.61 06/03/29 22:49:33 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/ndb_read_multi_range.test
    1.8 06/03/29 22:49:33 konstantin@stripped +0 -0
    Auto merged

  mysql-test/t/loaddata.test
    1.19 06/03/29 22:49:33 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/trigger.result
    1.37 06/03/29 22:49:33 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/sp.result
    1.202 06/03/29 22:49:33 konstantin@stripped +0 -0
    Auto merged

  storage/ndb/tools/Makefile.am
    1.14.8.3 06/03/29 22:49:32 konstantin@stripped +0 -0
    Merge rename: ndb/tools/Makefile.am -> storage/ndb/tools/Makefile.am

  mysql-test/r/sp-prelocking.result
    1.6 06/03/29 22:49:32 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/sp-error.result
    1.108 06/03/29 22:49:32 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/ps.result
    1.63 06/03/29 22:49:32 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/ndb_read_multi_range.result
    1.6 06/03/29 22:49:32 konstantin@stripped +0 -0
    Auto merged

  mysql-test/r/loaddata.result
    1.24 06/03/29 22:49:32 konstantin@stripped +0 -0
    Auto merged

# 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:	konstantin
# Host:	dragonfly.local
# Root:	/opt/local/work/mysql-5.1-root/RESYNC

--- 1.180/sql/field.h	2006-03-01 12:16:09 +03:00
+++ 1.181/sql/field.h	2006-03-29 22:49:34 +04:00
@@ -350,6 +350,12 @@
   /* convert decimal to longlong with overflow check */
   longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
                                     int *err);
+  /* The max. number of characters */
+  inline uint32 char_length() const
+  {
+    return field_length / charset()->mbmaxlen;
+  }
+
   friend bool reopen_table(THD *,struct st_table *,bool);
   friend int cre_myisam(my_string name, register TABLE *form, uint options,
 			ulonglong auto_increment_value);

--- 1.193/sql/sql_insert.cc	2006-03-28 15:53:14 +04:00
+++ 1.194/sql/sql_insert.cc	2006-03-29 22:49:34 +04:00
@@ -419,11 +419,15 @@
     let's *try* to start bulk inserts. It won't necessary
     start them as values_list.elements should be greater than
     some - handler dependent - threshold.
+    We should not start bulk inserts if this statement uses
+    functions or invokes triggers since they may access
+    to the same table and therefore should not see its
+    inconsistent state created by this optimization.
     So we call start_bulk_insert to perform nesessary checks on
     values_list.elements, and - if nothing else - to initialize
     the code to make the call of end_bulk_insert() below safe.
   */
-  if (lock_type != TL_WRITE_DELAYED)
+  if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
     table->file->start_bulk_insert(values_list.elements);
 
   thd->no_trans_update= 0;
@@ -549,7 +553,7 @@
   else
 #endif
   {
-    if (table->file->end_bulk_insert() && !error)
+    if (!thd->prelocked_mode && table->file->end_bulk_insert()
&& !error)
     {
       table->file->print_error(my_errno,MYF(0));
       error=1;
@@ -2230,7 +2234,7 @@
     lex->current_select->options|= OPTION_BUFFER_RESULT;
     lex->current_select->join->select_options|= OPTION_BUFFER_RESULT;
   }
-  else
+  else if (!thd->prelocked_mode)
   {
     /*
       We must not yet prepare the result table if it is the same as one of the 
@@ -2238,6 +2242,8 @@
       indexes on the result table, which may be used during the select, if it
       is the same table (Bug #6034). Do the preparation after the select phase
       in select_insert::prepare2().
+      We won't start bulk inserts at all if this statement uses functions or
+      should invoke triggers since they may access to the same table too.
     */
     table->file->start_bulk_insert((ha_rows) 0);
   }
@@ -2288,7 +2294,8 @@
 int select_insert::prepare2(void)
 {
   DBUG_ENTER("select_insert::prepare2");
-  if (thd->lex->current_select->options & OPTION_BUFFER_RESULT)
+  if (thd->lex->current_select->options & OPTION_BUFFER_RESULT &&
+      !thd->prelocked_mode)
     table->file->start_bulk_insert((ha_rows) 0);
   DBUG_RETURN(0);
 }
@@ -2391,7 +2398,8 @@
     */
     DBUG_VOID_RETURN;
   }
-  table->file->end_bulk_insert();
+  if (!thd->prelocked_mode)
+    table->file->end_bulk_insert();
   /*
     If at least one row has been inserted/modified and will stay in the table
     (the table doesn't have transactions) we must write to the binlog (and
@@ -2447,7 +2455,7 @@
   int error,error2;
   DBUG_ENTER("select_insert::send_eof");
 
-  error=table->file->end_bulk_insert();
+  error= (!thd->prelocked_mode) ? table->file->end_bulk_insert():0;
   table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
 
   /*
@@ -2556,7 +2564,8 @@
   thd->cuted_fields=0;
   if (info.ignore || info.handle_duplicates != DUP_ERROR)
     table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
-  table->file->start_bulk_insert((ha_rows) 0);
+  if (!thd->prelocked_mode)
+    table->file->start_bulk_insert((ha_rows) 0);
   thd->no_trans_update= 0;
   thd->abort_on_warning= (!info.ignore &&
                           (thd->variables.sql_mode &

--- 1.94/sql/sql_load.cc	2006-02-28 12:06:53 +03:00
+++ 1.95/sql/sql_load.cc	2006-03-29 22:49:35 +04:00
@@ -367,7 +367,8 @@
     if (ignore ||
 	handle_duplicates == DUP_REPLACE)
       table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
-    table->file->start_bulk_insert((ha_rows) 0);
+    if (!thd->prelocked_mode)
+      table->file->start_bulk_insert((ha_rows) 0);
     table->copy_blobs=1;
 
     thd->no_trans_update= 0;
@@ -384,7 +385,7 @@
       error= read_sep_field(thd, info, table_list, fields_vars,
                             set_fields, set_values, read_info,
 			    *enclosed, skip_lines, ignore);
-    if (table->file->end_bulk_insert() && !error)
+    if (!thd->prelocked_mode && table->file->end_bulk_insert()
&& !error)
     {
       table->file->print_error(my_errno, MYF(0));
       error= 1;

--- 1.392/sql/sql_select.cc	2006-03-16 15:23:20 +03:00
+++ 1.393/sql/sql_select.cc	2006-03-29 22:49:35 +04:00
@@ -12410,7 +12410,11 @@
   Item **select_item; /* The corresponding item from the SELECT clause. */
   Field *from_field;  /* The corresponding field from the FROM clause. */
 
-  if (order_item->type() == Item::INT_ITEM)
+  /*
+    Local SP variables may be int but are expressions, not positions.
+    (And they can't be used before fix_fields is called for them).
+  */
+  if (order_item->type() == Item::INT_ITEM &&
order_item->basic_const_item())
   {						/* Order by position */
     uint count= (uint) order_item->val_int();
     if (!count || count > fields.elements)

--- 1.86/sql/sql_view.cc	2006-03-10 04:05:57 +03:00
+++ 1.87/sql/sql_view.cc	2006-03-29 22:49:36 +04:00
@@ -940,6 +940,7 @@
       tbl->skip_temporary= 1;
       tbl->belong_to_view= top_view;
       tbl->referencing_view= table;
+      tbl->prelocking_placeholder= table->prelocking_placeholder;
       /*
         First we fill want_privilege with SELECT_ACL (this is needed for the
         tables which belongs to view subqueries and temporary table views,

--- 1.36/mysql-test/r/trigger.result	2006-03-25 12:07:40 +03:00
+++ 1.37/mysql-test/r/trigger.result	2006-03-29 22:49:33 +04:00
@@ -2,6 +2,7 @@
 drop view if exists v1;
 drop database if exists mysqltest;
 drop function if exists f1;
+drop function if exists f2;
 drop procedure if exists p1;
 create table t1 (i int);
 create trigger trg before insert on t1 for each row set @a:=1;
@@ -928,3 +929,26 @@
 ERROR 42000: RETURN is only allowed in a FUNCTION
 insert into t1 values (1);
 drop table t1;
+create table t1 (a varchar(64), b int);
+create table t2 like t1;
+create trigger t1_ai after insert on t1 for each row
+set @a:= (select max(a) from t1);
+insert into t1 (a) values
+("Twas"),("brillig"),("and"),("the"),("slithy"),("toves"),
+("Did"),("gyre"),("and"),("gimble"),("in"),("the"),("wabe");
+create trigger t2_ai after insert on t2 for each row
+set @a:= (select max(a) from t2);
+insert into t2 select * from t1;
+load data infile '../std_data_ln/words.dat' into table t1 (a);
+drop trigger t1_ai;
+drop trigger t2_ai;
+create function f1() returns int return (select max(b) from t1);
+insert into t1 values
+("All",f1()),("mimsy",f1()),("were",f1()),("the",f1()),("borogoves",f1()),
+("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1());
+create function f2() returns int return (select max(b) from t2);
+insert into t2 select a, f2() from t1;
+load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
+drop table t1;
+drop function f1;
+drop function f2;

--- 1.40/mysql-test/t/trigger.test	2006-03-24 19:28:10 +03:00
+++ 1.41/mysql-test/t/trigger.test	2006-03-29 22:49:33 +04:00
@@ -7,6 +7,7 @@
 drop view if exists v1;
 drop database if exists mysqltest;
 drop function if exists f1;
+drop function if exists f2;
 drop procedure if exists p1;
 --enable_warnings
 
@@ -1080,3 +1081,36 @@
 create trigger t1_bi before insert on t1 for each row return 0;
 insert into t1 values (1);
 drop table t1;
+
+# Test for bug #17764 "Trigger crashes MyISAM table"
+#
+# Table was reported as crashed when it was subject table of trigger invoked
+# by insert statement which was executed with enabled bulk insert mode (which
+# is actually set of optimizations enabled by handler::start_bulk_insert())
+# and this trigger also explicitly referenced it.
+# The same problem arose when table to which bulk insert was done was also
+# referenced in function called by insert statement.
+create table t1 (a varchar(64), b int);
+create table t2 like t1;
+create trigger t1_ai after insert on t1 for each row
+  set @a:= (select max(a) from t1);
+insert into t1 (a) values
+  ("Twas"),("brillig"),("and"),("the"),("slithy"),("toves"),
+  ("Did"),("gyre"),("and"),("gimble"),("in"),("the"),("wabe");
+create trigger t2_ai after insert on t2 for each row
+  set @a:= (select max(a) from t2);
+insert into t2 select * from t1;
+load data infile '../std_data_ln/words.dat' into table t1 (a);
+drop trigger t1_ai;
+drop trigger t2_ai;
+# Test that the problem for functions is fixed as well
+create function f1() returns int return (select max(b) from t1);
+insert into t1 values
+  ("All",f1()),("mimsy",f1()),("were",f1()),("the",f1()),("borogoves",f1()),
+  ("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1());
+create function f2() returns int return (select max(b) from t2);
+insert into t2 select a, f2() from t1;
+load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
+drop table t1;
+drop function f1;
+drop function f2;

--- 1.295/sql/ha_ndbcluster.cc	2006-03-29 15:13:08 +04:00
+++ 1.296/sql/ha_ndbcluster.cc	2006-03-29 22:49:34 +04:00
@@ -7612,7 +7612,9 @@
     if ((* value).ptr)
     {
       DBUG_ASSERT(curr != 0);
-      (* value).rec= curr;
+      NdbValue* val= m_value + curr->getColumn()->getColumnNo();
+      DBUG_ASSERT(val->ptr);
+      val->rec= curr;
       curr= curr->next();
     }
   }

--- 1.107/mysql-test/r/sp-error.result	2006-03-15 20:21:52 +03:00
+++ 1.108/mysql-test/r/sp-error.result	2006-03-29 22:49:32 +04:00
@@ -634,10 +634,18 @@
 return 5;
 end|
 ERROR 0A000: FLUSH is not allowed in stored function or trigger
-create procedure
bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123()
+create procedure bug9529_901234567890123456789012345678901234567890123456789012345()
 begin
 end|
-ERROR 42000: Identifier name
'bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'
is too long
+ERROR 42000: Identifier name
'bug9529_901234567890123456789012345678901234567890123456789012345' is too long
+drop procedure if exists
bug17015_0123456789012345678901234567890123456789012345678901234|
+create procedure bug17015_0123456789012345678901234567890123456789012345678901234()
+begin
+end|
+show procedure status like 'bug17015%'|
+Db	Name	Type	Definer	Modified	Created	Security_type	Comment
+test	bug17015_0123456789012345678901234567890123456789012345678901234	PROCEDURE	root@localhost	0000-00-00
00:00:00	0000-00-00 00:00:00	DEFINER	
+drop procedure bug17015_0123456789012345678901234567890123456789012345678901234|
 drop procedure if exists bug10969|
 create procedure bug10969()
 begin

--- 1.201/mysql-test/r/sp.result	2006-03-10 14:48:13 +03:00
+++ 1.202/mysql-test/r/sp.result	2006-03-29 22:49:33 +04:00
@@ -4812,4 +4812,39 @@
 3	ccc
 drop function bug13575;
 drop table t3|
+drop procedure if exists bug16474_1|
+drop procedure if exists bug16474_2|
+delete from t1|
+insert into t1 values ('c', 2), ('b', 3), ('a', 1)|
+create procedure bug16474_1()
+begin
+declare x int;
+select id from t1 order by x;
+end|
+create procedure bug16474_2(x int)
+select id from t1 order by x|
+call bug16474_1()|
+id
+c
+b
+a
+call bug16474_2(1)|
+id
+c
+b
+a
+call bug16474_2(2)|
+id
+c
+b
+a
+drop procedure bug16474_1|
+drop procedure bug16474_2|
+set @x = 2|
+select * from t1 order by @x|
+id	data
+c	2
+b	3
+a	1
+delete from t1|
 drop table t1,t2;

--- 1.106/mysql-test/t/sp-error.test	2006-03-15 20:21:52 +03:00
+++ 1.107/mysql-test/t/sp-error.test	2006-03-29 22:49:33 +04:00
@@ -904,12 +904,26 @@
 #
 # BUG#9529: Stored Procedures: No Warning on truncation of procedure name
 #           during creation.
-# Note: When using utf8 for mysql.proc, this limit is much higher than before
+# BUG#17015: Routine name truncation not an error
+#            When we started using utf8 for mysql.proc, this limit appeared
+#            to be higher, but in reality the names were truncated.
 --error ER_TOO_LONG_IDENT
-create procedure
bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123()
+create procedure bug9529_901234567890123456789012345678901234567890123456789012345()
 begin
 end|
 
+--disable_warnings
+drop procedure if exists
bug17015_0123456789012345678901234567890123456789012345678901234|
+--enable_warnings
+# Check the upper limit, just to make sure.
+create procedure bug17015_0123456789012345678901234567890123456789012345678901234()
+begin
+end|
+
+--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
+show procedure status like 'bug17015%'|
+drop procedure bug17015_0123456789012345678901234567890123456789012345678901234|
+
 
 #
 # BUG#10969: Stored procedures: crash if default() function
@@ -1717,4 +1731,3 @@
 #drop procedure if exists bugNNNN|
 #--enable_warnings
 #create procedure bugNNNN...
-

--- 1.185/mysql-test/t/sp.test	2006-03-10 16:01:03 +03:00
+++ 1.186/mysql-test/t/sp.test	2006-03-29 22:49:33 +04:00
@@ -5654,6 +5654,42 @@
 drop table t3|
 
 #
+# BUG#16474: SP crashed MySQL
+# (when using "order by localvar", where 'localvar' is just that.
+#
+--disable_warnings
+drop procedure if exists bug16474_1|
+drop procedure if exists bug16474_2|
+--enable_warnings
+
+delete from t1|
+insert into t1 values ('c', 2), ('b', 3), ('a', 1)|
+
+create procedure bug16474_1()
+begin
+  declare x int;
+
+  select id from t1 order by x;
+end|
+
+# This does NOT order by column index; variable is an expression.
+create procedure bug16474_2(x int)
+  select id from t1 order by x|
+
+call bug16474_1()|
+call bug16474_2(1)|
+call bug16474_2(2)|
+drop procedure bug16474_1|
+drop procedure bug16474_2|
+
+# For reference: user variables are expressions too and do not affect ordering.
+set @x = 2|
+select * from t1 order by @x|
+
+delete from t1|
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings

--- 1.106/sql/sp.cc	2006-03-28 21:34:30 +04:00
+++ 1.107/sql/sp.cc	2006-03-29 22:49:34 +04:00
@@ -535,7 +535,11 @@
       ret= SP_GET_FIELD_FAILED;
       goto done;
     }
-    if (sp->m_name.length >
table->field[MYSQL_PROC_FIELD_NAME]->field_length)
+
+    if (system_charset_info->cset->numchars(system_charset_info,
+                                            sp->m_name.str,
+                                            sp->m_name.str+sp->m_name.length) >
+        table->field[MYSQL_PROC_FIELD_NAME]->char_length())
     {
       ret= SP_BAD_IDENTIFIER;
       goto done;

--- 1.62/mysql-test/r/ps.result	2006-02-27 18:58:31 +03:00
+++ 1.63/mysql-test/r/ps.result	2006-03-29 22:49:32 +04:00
@@ -880,3 +880,49 @@
 row_count()
 1
 drop table t1;
+create table t1 (a int, b int);
+insert into t1 (a,b) values (2,8),(1,9),(3,7);
+prepare stmt from "select * from t1 order by ?";
+execute stmt using @a;
+a	b
+2	8
+1	9
+3	7
+set @a=1;
+execute stmt using @a;
+a	b
+1	9
+2	8
+3	7
+set @a=2;
+execute stmt using @a;
+a	b
+3	7
+2	8
+1	9
+deallocate prepare stmt;
+select * from t1 order by 1;
+a	b
+1	9
+2	8
+3	7
+prepare stmt from "select * from t1 order by ?+1";
+set @a=0;
+execute stmt using @a;
+a	b
+2	8
+1	9
+3	7
+set @a=1;
+execute stmt using @a;
+a	b
+2	8
+1	9
+3	7
+deallocate prepare stmt;
+select * from t1 order by 1+1;
+a	b
+2	8
+1	9
+3	7
+drop table t1;

--- 1.5/mysql-test/r/sp-prelocking.result	2006-02-07 21:59:13 +03:00
+++ 1.6/mysql-test/r/sp-prelocking.result	2006-03-29 22:49:32 +04:00
@@ -214,3 +214,26 @@
 drop function f2;
 drop function f3;
 drop procedure sp1;
+drop table if exists t1;
+drop view if exists v1, v2, v3;
+drop function if exists bug15683;
+create table t1 (f1 bigint, f2 varchar(20), f3 bigint);
+insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1;
+create view v1 as select 1 from t1 union all select 1;
+create view v2 as select 1 from v1;
+create view v3 as select 1 as f1 from v2;
+create function bug15683() returns bigint
+begin
+return (select count(*) from v3);
+end|
+prepare stmt from "select bug15683()";
+execute stmt;
+bug15683()
+2
+execute stmt;
+bug15683()
+2
+deallocate prepare stmt;
+drop table t1;
+drop view v1, v2, v3;
+drop function bug15683;

--- 1.60/mysql-test/t/ps.test	2006-02-27 18:58:31 +03:00
+++ 1.61/mysql-test/t/ps.test	2006-03-29 22:49:33 +04:00
@@ -933,4 +933,38 @@
 select row_count();
 drop table t1;
 
+#
+# BUG#16474: SP crashed MySQL
+# (when using "order by localvar", where 'localvar' is just that.
+# The actual bug test is in sp.test, this is just testing that we get the
+# expected result for prepared statements too, i.e. place holders work as
+# textual substitution. If it's a single integer, it works as the (deprecated)
+# "order by column#", otherwise it's an expression.
+#
+create table t1 (a int, b int);
+insert into t1 (a,b) values (2,8),(1,9),(3,7);
+
+# Will order by index
+prepare stmt from "select * from t1 order by ?";
+execute stmt using @a;
+set @a=1;
+execute stmt using @a;
+set @a=2;
+execute stmt using @a;
+deallocate prepare stmt;
+# For reference:
+select * from t1 order by 1;
+
+# Will not order by index.
+prepare stmt from "select * from t1 order by ?+1";
+set @a=0;
+execute stmt using @a;
+set @a=1;
+execute stmt using @a;
+deallocate prepare stmt;
+# For reference:
+select * from t1 order by 1+1;
+
+drop table t1;
+
 # End of 5.0 tests

--- 1.5/mysql-test/t/sp-prelocking.test	2006-02-07 21:59:14 +03:00
+++ 1.6/mysql-test/t/sp-prelocking.test	2006-03-29 22:52:36 +04:00
@@ -240,3 +240,38 @@
 drop function f2;
 drop function f3;
 drop procedure sp1;
+
+#
+# Bug#15683 "crash, Function on nested VIEWs, Prepared statement"
+# Check that when creating the prelocking list a nested view 
+# is not merged until it's used.
+#
+--disable_warnings
+drop table if exists t1;
+drop view if exists v1, v2, v3;
+drop function if exists bug15683;
+--enable_warnings
+create table t1 (f1 bigint, f2 varchar(20), f3 bigint);
+insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1;
+create view v1 as select 1 from t1 union all select 1;
+create view v2 as select 1 from v1;
+create view v3 as select 1 as f1 from v2;
+
+delimiter |;
+create function bug15683() returns bigint
+begin
+return (select count(*) from v3);
+end|
+delimiter ;|
+
+prepare stmt from "select bug15683()";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+drop table t1;
+drop view v1, v2, v3;
+drop function bug15683;
+
+#
+# End of 5.0 tests
+# 

--- 1.14.8.2/ndb/tools/Makefile.am	2006-03-29 17:05:01 +04:00
+++ 1.26/storage/ndb/tools/Makefile.am	2006-03-29 22:49:37 +04:00
@@ -36,19 +36,18 @@
                       restore/Restore.cpp \
                       ../test/src/NDBT_ResultRow.cpp $(tools_common_sources)
 
-ndb_config_SOURCES = ndb_config.cpp \
+ndb_config_SOURCES = ndb_condig.cpp \
 	../src/mgmsrv/Config.cpp \
 	../src/mgmsrv/ConfigInfo.cpp \
 	../src/mgmsrv/InitConfigFileParser.cpp
 
-ndb_config_CXXFLAGS = -I$(top_srcdir)/ndb/src/mgmapi \
-                      -I$(top_srcdir)/ndb/src/mgmsrv \
-                      -I$(top_srcdir)/ndb/include/mgmcommon \
+ndb_config_CXXFLAGS = -I$(top_srcdir)/storage/ndb/src/mgmapi \
+                      -I$(top_srcdir)/storage/ndb/src/mgmsrv \
+                      -I$(top_srcdir)/storage/ndb/include/mgmcommon \
                       -DMYSQLCLUSTERDIR="\"\""
 
-
-include $(top_srcdir)/ndb/config/common.mk.am
-include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am
+include $(top_srcdir)/storage/ndb/config/common.mk.am
+include $(top_srcdir)/storage/ndb/config/type_ndbapitools.mk.am
 
 ndb_test_platform_LDFLAGS = @ndb_bin_am_ldflags@
 ndb_waiter_LDFLAGS = @ndb_bin_am_ldflags@
@@ -76,97 +75,97 @@
   ndb_select_count.dsp
 
 ndb_waiter.dsp: Makefile \
-               $(top_srcdir)/ndb/config/win-prg.am \
-               $(top_srcdir)/ndb/config/win-name \
-               $(top_srcdir)/ndb/config/win-includes \
-               $(top_srcdir)/ndb/config/win-sources \
-               $(top_srcdir)/ndb/config/win-libraries
-	cat $(top_srcdir)/ndb/config/win-prg.am > $@
-	@$(top_srcdir)/ndb/config/win-name $@ ndb_waiter
-	@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
-	@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_waiter_SOURCES)
-	@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+               $(top_srcdir)/storage/ndb/config/win-prg.am \
+               $(top_srcdir)/storage/ndb/config/win-name \
+               $(top_srcdir)/storage/ndb/config/win-includes \
+               $(top_srcdir)/storage/ndb/config/win-sources \
+               $(top_srcdir)/storage/ndb/config/win-libraries
+	cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+	@$(top_srcdir)/storage/ndb/config/win-name $@ ndb_waiter
+	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndb_waiter_SOURCES)
+	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
 
 ndb_drop_table.dsp: Makefile \
-               $(top_srcdir)/ndb/config/win-prg.am \
-               $(top_srcdir)/ndb/config/win-name \
-               $(top_srcdir)/ndb/config/win-includes \
-               $(top_srcdir)/ndb/config/win-sources \
-               $(top_srcdir)/ndb/config/win-libraries
-	cat $(top_srcdir)/ndb/config/win-prg.am > $@
-	@$(top_srcdir)/ndb/config/win-name $@ ndb_drop_table
-	@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
-	@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_drop_table_SOURCES)
-	@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+               $(top_srcdir)/storage/ndb/config/win-prg.am \
+               $(top_srcdir)/storage/ndb/config/win-name \
+               $(top_srcdir)/storage/ndb/config/win-includes \
+               $(top_srcdir)/storage/ndb/config/win-sources \
+               $(top_srcdir)/storage/ndb/config/win-libraries
+	cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+	@$(top_srcdir)/storage/ndb/config/win-name $@ ndb_drop_table
+	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndb_drop_table_SOURCES)
+	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
 
 ndb_delete_all.dsp: Makefile \
-               $(top_srcdir)/ndb/config/win-prg.am \
-               $(top_srcdir)/ndb/config/win-name \
-               $(top_srcdir)/ndb/config/win-includes \
-               $(top_srcdir)/ndb/config/win-sources \
-               $(top_srcdir)/ndb/config/win-libraries
-	cat $(top_srcdir)/ndb/config/win-prg.am > $@
-	@$(top_srcdir)/ndb/config/win-name $@ ndb_delete_all
-	@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
-	@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_delete_all_SOURCES)
-	@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+               $(top_srcdir)/storage/ndb/config/win-prg.am \
+               $(top_srcdir)/storage/ndb/config/win-name \
+               $(top_srcdir)/storage/ndb/config/win-includes \
+               $(top_srcdir)/storage/ndb/config/win-sources \
+               $(top_srcdir)/storage/ndb/config/win-libraries
+	cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+	@$(top_srcdir)/storage/ndb/config/win-name $@ ndb_delete_all
+	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndb_delete_all_SOURCES)
+	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
 
 ndb_desc.dsp: Makefile \
-               $(top_srcdir)/ndb/config/win-prg.am \
-               $(top_srcdir)/ndb/config/win-name \
-               $(top_srcdir)/ndb/config/win-includes \
-               $(top_srcdir)/ndb/config/win-sources \
-               $(top_srcdir)/ndb/config/win-libraries
-	cat $(top_srcdir)/ndb/config/win-prg.am > $@
-	@$(top_srcdir)/ndb/config/win-name $@ ndb_desc
-	@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
-	@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_desc_SOURCES)
-	@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+               $(top_srcdir)/storage/ndb/config/win-prg.am \
+               $(top_srcdir)/storage/ndb/config/win-name \
+               $(top_srcdir)/storage/ndb/config/win-includes \
+               $(top_srcdir)/storage/ndb/config/win-sources \
+               $(top_srcdir)/storage/ndb/config/win-libraries
+	cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+	@$(top_srcdir)/storage/ndb/config/win-name $@ ndb_desc
+	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndb_desc_SOURCES)
+	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
 
 ndb_drop_index.dsp: Makefile \
-               $(top_srcdir)/ndb/config/win-prg.am \
-               $(top_srcdir)/ndb/config/win-name \
-               $(top_srcdir)/ndb/config/win-includes \
-               $(top_srcdir)/ndb/config/win-sources \
-               $(top_srcdir)/ndb/config/win-libraries
-	cat $(top_srcdir)/ndb/config/win-prg.am > $@
-	@$(top_srcdir)/ndb/config/win-name $@ ndb_drop_index
-	@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
-	@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_drop_index_SOURCES)
-	@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+               $(top_srcdir)/storage/ndb/config/win-prg.am \
+               $(top_srcdir)/storage/ndb/config/win-name \
+               $(top_srcdir)/storage/ndb/config/win-includes \
+               $(top_srcdir)/storage/ndb/config/win-sources \
+               $(top_srcdir)/storage/ndb/config/win-libraries
+	cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+	@$(top_srcdir)/storage/ndb/config/win-name $@ ndb_drop_index
+	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndb_drop_index_SOURCES)
+	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
 
 ndb_show_tables.dsp: Makefile \
                $(top_srcdir)/ndb/config/win-prg.am \
-               $(top_srcdir)/ndb/config/win-name \
-               $(top_srcdir)/ndb/config/win-includes \
-               $(top_srcdir)/ndb/config/win-sources \
-               $(top_srcdir)/ndb/config/win-libraries
-	cat $(top_srcdir)/ndb/config/win-prg.am > $@
-	@$(top_srcdir)/ndb/config/win-name $@ ndb_show_tables
-	@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
-	@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_show_tables_SOURCES)
-	@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+               $(top_srcdir)/storage/ndb/config/win-name \
+               $(top_srcdir)/storage/ndb/config/win-includes \
+               $(top_srcdir)/storage/ndb/config/win-sources \
+               $(top_srcdir)/storage/ndb/config/win-libraries
+	cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+	@$(top_srcdir)/storage/ndb/config/win-name $@ ndb_show_tables
+	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndb_show_tables_SOURCES)
+	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
 
 ndb_select_all.dsp: Makefile \
-               $(top_srcdir)/ndb/config/win-prg.am \
-               $(top_srcdir)/ndb/config/win-name \
-               $(top_srcdir)/ndb/config/win-includes \
-               $(top_srcdir)/ndb/config/win-sources \
-               $(top_srcdir)/ndb/config/win-libraries
-	cat $(top_srcdir)/ndb/config/win-prg.am > $@
-	@$(top_srcdir)/ndb/config/win-name $@ ndb_select_all
-	@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
-	@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_select_all_SOURCES)
-	@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+               $(top_srcdir)/storage/ndb/config/win-prg.am \
+               $(top_srcdir)/storage/ndb/config/win-name \
+               $(top_srcdir)/storage/ndb/config/win-includes \
+               $(top_srcdir)/storage/ndb/config/win-sources \
+               $(top_srcdir)/storage/ndb/config/win-libraries
+	cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+	@$(top_srcdir)/storage/ndb/config/win-name $@ ndb_select_all
+	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndb_select_all_SOURCES)
+	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)
 
 ndb_select_count.dsp: Makefile \
-               $(top_srcdir)/ndb/config/win-prg.am \
-               $(top_srcdir)/ndb/config/win-name \
-               $(top_srcdir)/ndb/config/win-includes \
-               $(top_srcdir)/ndb/config/win-sources \
-               $(top_srcdir)/ndb/config/win-libraries
-	cat $(top_srcdir)/ndb/config/win-prg.am > $@
-	@$(top_srcdir)/ndb/config/win-name $@ ndb_select_count
-	@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
-	@$(top_srcdir)/ndb/config/win-sources $@ $(ndb_select_count_SOURCES)
-	@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
+               $(top_srcdir)/storage/ndb/config/win-prg.am \
+               $(top_srcdir)/storage/ndb/config/win-name \
+               $(top_srcdir)/storage/ndb/config/win-includes \
+               $(top_srcdir)/storage/ndb/config/win-sources \
+               $(top_srcdir)/storage/ndb/config/win-libraries
+	cat $(top_srcdir)/storage/ndb/config/win-prg.am > $@
+	@$(top_srcdir)/storage/ndb/config/win-name $@ ndb_select_count
+	@$(top_srcdir)/storage/ndb/config/win-includes $@ $(INCLUDES)
+	@$(top_srcdir)/storage/ndb/config/win-sources $@ $(ndb_select_count_SOURCES)
+	@$(top_srcdir)/storage/ndb/config/win-libraries $@ LINK $(LDADD)

--- 1.5/mysql-test/r/ndb_read_multi_range.result	2005-12-14 02:36:09 +03:00
+++ 1.6/mysql-test/r/ndb_read_multi_range.result	2006-03-29 22:49:32 +04:00
@@ -263,3 +263,107 @@
 10	10	10	10
 drop table t2;
 drop table t1;
+CREATE TABLE t1 (
+a int(11) NOT NULL,
+b int(11) NOT NULL,
+c datetime default NULL,
+PRIMARY KEY  (a),
+KEY idx_bc (b,c)
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES 
+(406989,67,'2006-02-23 17:08:46'), (150078,67,'2005-10-26 11:17:45'),
+(406993,67,'2006-02-27 11:20:57'), (245655,67,'2005-12-08 15:59:08'),
+(406994,67,'2006-02-27 11:26:46'), (256,67,NULL),
+(398341,67,'2006-02-20 04:48:44'), (254,67,NULL),(1120,67,NULL),
+(406988,67,'2006-02-23 17:07:22'), (255,67,NULL),
+(398340,67,'2006-02-20 04:38:53'),(406631,67,'2006-02-23 10:49:42'),
+(245653,67,'2005-12-08 15:59:07'),(406992,67,'2006-02-24 16:47:18'),
+(245654,67,'2005-12-08 15:59:08'),(406995,67,'2006-02-28 11:55:00'),
+(127261,67,'2005-10-13 12:17:58'),(406991,67,'2006-02-24 16:42:32'),
+(245652,67,'2005-12-08 15:58:27'),(398545,67,'2006-02-20 04:53:13'),
+(154504,67,'2005-10-28 11:53:01'),(9199,67,NULL),(1,67,'2006-02-23 15:01:35'),
+(223456,67,NULL),(4101,67,NULL),(1133,67,NULL),
+(406990,67,'2006-02-23 18:01:45'),(148815,67,'2005-10-25 15:34:17'),
+(148812,67,'2005-10-25 15:30:01'),(245651,67,'2005-12-08 15:58:27'),
+(154503,67,'2005-10-28 11:52:38');
+create table t11 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3
asc;
+create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3
desc;
+create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08')
order by 3 asc;
+create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08')
order by 3 desc;
+select * from t11 order by 1,2,3;
+a	b	c
+254	67	NULL
+255	67	NULL
+256	67	NULL
+1120	67	NULL
+1133	67	NULL
+4101	67	NULL
+9199	67	NULL
+223456	67	NULL
+select * from t12 order by 1,2,3;
+a	b	c
+254	67	NULL
+255	67	NULL
+256	67	NULL
+1120	67	NULL
+1133	67	NULL
+4101	67	NULL
+9199	67	NULL
+223456	67	NULL
+select * from t21 order by 1,2,3;
+a	b	c
+1	67	2006-02-23 15:01:35
+254	67	NULL
+255	67	NULL
+256	67	NULL
+1120	67	NULL
+1133	67	NULL
+4101	67	NULL
+9199	67	NULL
+223456	67	NULL
+245651	67	2005-12-08 15:58:27
+245652	67	2005-12-08 15:58:27
+245653	67	2005-12-08 15:59:07
+245654	67	2005-12-08 15:59:08
+245655	67	2005-12-08 15:59:08
+398340	67	2006-02-20 04:38:53
+398341	67	2006-02-20 04:48:44
+398545	67	2006-02-20 04:53:13
+406631	67	2006-02-23 10:49:42
+406988	67	2006-02-23 17:07:22
+406989	67	2006-02-23 17:08:46
+406990	67	2006-02-23 18:01:45
+406991	67	2006-02-24 16:42:32
+406992	67	2006-02-24 16:47:18
+406993	67	2006-02-27 11:20:57
+406994	67	2006-02-27 11:26:46
+406995	67	2006-02-28 11:55:00
+select * from t22 order by 1,2,3;
+a	b	c
+1	67	2006-02-23 15:01:35
+254	67	NULL
+255	67	NULL
+256	67	NULL
+1120	67	NULL
+1133	67	NULL
+4101	67	NULL
+9199	67	NULL
+223456	67	NULL
+245651	67	2005-12-08 15:58:27
+245652	67	2005-12-08 15:58:27
+245653	67	2005-12-08 15:59:07
+245654	67	2005-12-08 15:59:08
+245655	67	2005-12-08 15:59:08
+398340	67	2006-02-20 04:38:53
+398341	67	2006-02-20 04:48:44
+398545	67	2006-02-20 04:53:13
+406631	67	2006-02-23 10:49:42
+406988	67	2006-02-23 17:07:22
+406989	67	2006-02-23 17:08:46
+406990	67	2006-02-23 18:01:45
+406991	67	2006-02-24 16:42:32
+406992	67	2006-02-24 16:47:18
+406993	67	2006-02-27 11:20:57
+406994	67	2006-02-27 11:26:46
+406995	67	2006-02-28 11:55:00
+DROP TABLE t1, t11, t12, t21, t22;

--- 1.7/mysql-test/t/ndb_read_multi_range.test	2005-12-14 02:26:57 +03:00
+++ 1.8/mysql-test/t/ndb_read_multi_range.test	2006-03-29 22:49:33 +04:00
@@ -200,3 +200,41 @@
 drop table t2;
 
 drop table t1;
+
+# bug17729
+
+CREATE TABLE t1 (
+  a int(11) NOT NULL,
+  b int(11) NOT NULL,
+  c datetime default NULL,
+  PRIMARY KEY  (a),
+  KEY idx_bc (b,c)
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES 
+(406989,67,'2006-02-23 17:08:46'), (150078,67,'2005-10-26 11:17:45'),
+(406993,67,'2006-02-27 11:20:57'), (245655,67,'2005-12-08 15:59:08'),
+(406994,67,'2006-02-27 11:26:46'), (256,67,NULL),
+(398341,67,'2006-02-20 04:48:44'), (254,67,NULL),(1120,67,NULL),
+(406988,67,'2006-02-23 17:07:22'), (255,67,NULL),
+(398340,67,'2006-02-20 04:38:53'),(406631,67,'2006-02-23 10:49:42'),
+(245653,67,'2005-12-08 15:59:07'),(406992,67,'2006-02-24 16:47:18'),
+(245654,67,'2005-12-08 15:59:08'),(406995,67,'2006-02-28 11:55:00'),
+(127261,67,'2005-10-13 12:17:58'),(406991,67,'2006-02-24 16:42:32'),
+(245652,67,'2005-12-08 15:58:27'),(398545,67,'2006-02-20 04:53:13'),
+(154504,67,'2005-10-28 11:53:01'),(9199,67,NULL),(1,67,'2006-02-23 15:01:35'),
+(223456,67,NULL),(4101,67,NULL),(1133,67,NULL),
+(406990,67,'2006-02-23 18:01:45'),(148815,67,'2005-10-25 15:34:17'),
+(148812,67,'2005-10-25 15:30:01'),(245651,67,'2005-12-08 15:58:27'),
+(154503,67,'2005-10-28 11:52:38');
+
+create table t11 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3
asc;
+create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3
desc;
+create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08')
order by 3 asc;
+create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08')
order by 3 desc;
+
+select * from t11 order by 1,2,3;
+select * from t12 order by 1,2,3;
+select * from t21 order by 1,2,3;
+select * from t22 order by 1,2,3;
+DROP TABLE t1, t11, t12, t21, t22;
Thread
bk commit into 5.1 tree (konstantin:1.2260)konstantin29 Mar