MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:May 12 2009 5:48pm
Subject:bzr push into mysql-5.1-bugteam branch (jimw:2875 to 2894) Bug#32991
View as plain text  
 2894 Jim Winstead	2009-05-12
      mysqlimport was not always compiled correctly to allow thread support,
      required for the --use-threads option. (Bug #32991)
      modified:
        client/Makefile.am
        mysql-test/r/mysqldump.result
        mysql-test/t/mysqldump.test

 2893 Jim Winstead	2009-05-12
      mysqldump would not dump the INFORMATION_SCHEMA even when it was explicitly
      requested. (Bug #33762)
      modified:
        client/mysqldump.c
        mysql-test/r/mysqldump.result
        mysql-test/t/mysqldump.test

 2892 Jim Winstead	2009-05-07
      The arguments to use for ps on Mac OS X were mis-detected by the mysql_zap
      utility. (Bug #41883, patch by Nicklas Westerlund)
      modified:
        scripts/mysql_zap.sh

 2891 Jim Winstead	2009-05-07
      The mysql command-line client did not properly handle MYSQL_HISTFILE being set
      to an empty string, or to /dev/null, as we suggest and have suggested in the
      documentation. (Bug #34224)
      modified:
        client/mysql.cc

 2890 Jim Winstead	2009-05-07
      mysqld_safe could generate filenames with spaces and then didn't properly
      quote them in later use. (Bug #33685, based on a patch by Hartmut Holzgraefe)
      modified:
        scripts/mysqld_safe.sh

 2889 Jim Winstead	2009-05-07
      mysqladmin kill can't handle 64-bit thread IDs. (Bug #32457)
      modified:
        client/mysqladmin.cc

 2888 Jim Winstead	2009-05-07
      Various command-line utilities, including mysqlbinlog and mysqldump, don't
      handle the --skip-password option correctly. (Bug #28479)
      modified:
        client/mysql_upgrade.c
        client/mysqladmin.cc
        client/mysqlbinlog.cc
        client/mysqlcheck.c
        client/mysqldump.c
        client/mysqlimport.c
        client/mysqlshow.c
        client/mysqlslap.c
        client/mysqltest.cc

 2887 Jim Winstead	2009-05-07
      Add explanation of the possible -s values for mysqldumpslow. (Bug #35663,
      based on a contribution by Ask Bjørn Hansen)
      modified:
        scripts/mysqldumpslow.sh

 2886 Jim Winstead	2009-05-05
      Fix incorrect filename in verbose output of innochecksum. (Bug #44484,
      patch contributed by Andrew Hutchings)
      modified:
        extra/innochecksum.c

 2885 Jim Winstead	2009-05-05 [merge]
      Merge with 5.1-bugteam.
      removed:
        mysql-test/suite/rpl/t/rpl_000015-slave.sh
      added:
        mysql-test/r/myisam_debug.result
        mysql-test/std_data/bug37631.MYD
        mysql-test/std_data/bug37631.MYI
        mysql-test/std_data/bug37631.frm
        mysql-test/suite/rpl/r/rpl_bug38694.result
        mysql-test/suite/rpl/t/rpl_bug38694-slave.opt
        mysql-test/suite/rpl/t/rpl_bug38694.test
        mysql-test/t/myisam_debug.test
      modified:
        mysql-test/r/ctype_cp932_binlog_stm.result
        mysql-test/r/ctype_sjis.result
        mysql-test/r/fulltext.result
        mysql-test/r/gis-rtree.result
        mysql-test/r/gis.result
        mysql-test/r/insert_select.result
        mysql-test/r/myisam.result
        mysql-test/r/sp.result
        mysql-test/r/subselect3.result
        mysql-test/r/upgrade.result
        mysql-test/suite/rpl/include/rpl_mixed_ddl.inc
        mysql-test/suite/rpl/t/rpl_incident.test
        mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
        mysql-test/t/ctype_cp932_binlog_stm.test
        mysql-test/t/ctype_sjis.test
        mysql-test/t/fulltext.test
        mysql-test/t/gis-rtree.test
        mysql-test/t/gis.test
        mysql-test/t/insert_select.test
        mysql-test/t/myisam.test
        mysql-test/t/sp.test
        mysql-test/t/sp_trans_log.test
        mysql-test/t/subselect3.test
        mysql-test/t/upgrade.test
        mysys/mf_keycache.c
        mysys/safemalloc.c
        sql/handler.h
        sql/item.cc
        sql/item_geofunc.cc
        sql/rpl_filter.cc
        sql/slave.cc
        sql/sp_head.cc
        sql/sp_head.h
        sql/sp_pcontext.cc
        sql/sp_pcontext.h
        sql/sql_repl.cc
        sql/sql_select.cc
        sql/sql_table.cc
        sql/sql_update.cc
        sql/sql_yacc.yy
        sql/unireg.cc
        storage/ibmdb2i/Makefile.am
        storage/ibmdb2i/db2i_charsetSupport.cc
        storage/ibmdb2i/db2i_conversion.cc
        storage/ibmdb2i/db2i_errors.cc
        storage/ibmdb2i/db2i_errors.h
        storage/ibmdb2i/ha_ibmdb2i.cc
        storage/myisam/ft_boolean_search.c
        storage/myisam/ha_myisam.cc
        storage/myisam/mi_delete.c
        storage/myisam/mi_open.c
        storage/myisam/mi_write.c
        strings/ctype-cp932.c
        strings/ctype-sjis.c
        tests/mysql_client_test.c

 2884 Jim Winstead	2009-04-28
      Add support for wildcards in mysql_convert_table_format, and add
      short options for all of the long options. (Bug #30373, original
      contribution by Tobias Asplund)
      modified:
        scripts/mysql_convert_table_format.sh

 2883 Jim Winstead	2009-04-28
      Remove extraneous space in --debug-check usage info.
      modified:
        client/mysql.cc

 2882 Jim Winstead	2009-04-28
      mysqld_multi still had mentions of safe_mysqld instead of mysqld_safe,
      as well as some unclear example paths. (Bug #28094)
      modified:
        scripts/mysqld_multi.sh

 2881 Jim Winstead	2009-04-28
      Make SSL options appear in correct place in mysql_upgrade and mysqltest
      usage information. (Bug #31883)
      modified:
        client/mysql_upgrade.c
        client/mysqltest.cc

 2880 Jim Winstead	2009-04-28
      Fix list of options enabled by mysqldump --compact (Bug #32408)
      modified:
        client/mysqldump.c

 2879 Jim Winstead	2009-04-28
      Add missing newline to usage message of ndb_print_backup_file (Bug #34989)
      modified:
        storage/ndb/src/kernel/blocks/backup/read.cpp

 2878 Jim Winstead	2009-04-28
      Update list of sorting options in mysqldumpslow (Bug #20454)
      modified:
        scripts/mysqldumpslow.sh

 2877 Jim Winstead	2009-04-28
      Make help text for perror more accurate. (Bug #34574)
      modified:
        extra/perror.c

 2876 Jim Winstead	2009-04-28
      Check for MEMORY, HEAP, and BLACKHOLE in mysql_convert_table_format when
      preventing a change that would result in table data loss. (Bug #27149)
      
      Also updated mysql_convert_table_format to use --engine as the documentation
      claimed, and use the engine terminology throughout instead of the obsolete
      'table type'.
      modified:
        scripts/mysql_convert_table_format.sh

 2875 Jim Winstead	2009-04-28
      Bug #27884: mysql --html does not quote HTML special characters in output
      
        Fix encoding of field values and names in HTML output from mysql client.
      modified:
        client/mysql.cc
        mysql-test/r/mysql.result
        mysql-test/t/mysql.test

=== modified file 'client/Makefile.am'
--- a/client/Makefile.am	2008-09-06 00:51:17 +0000
+++ b/client/Makefile.am	2009-05-12 17:45:40 +0000
@@ -71,7 +71,7 @@ mysqldump_SOURCES=              mysqldum
 	                        $(top_srcdir)/mysys/mf_getdate.c
 
 mysqlimport_SOURCES=		mysqlimport.c
-
+mysqlimport_CFLAGS=		-DTHREAD -UUNDEF_THREADS_HACK
 mysqlimport_LDADD =		$(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
 				@CLIENT_EXTRA_LDFLAGS@ \
 				$(LIBMYSQLCLIENT_LA) \

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2009-04-28 17:54:26 +0000
+++ b/client/mysql.cc	2009-05-08 00:48:20 +0000
@@ -1183,7 +1183,12 @@ int main(int argc,char *argv[])
         histfile= 0;
       }
     }
-    if (histfile)
+
+    /* We used to suggest setting MYSQL_HISTFILE=/dev/null. */
+    if (histfile && strncmp(histfile, "/dev/null", 10) == 0)
+      histfile= NULL;
+
+    if (histfile && histfile[0])
     {
       if (verbose)
 	tee_fprintf(stdout, "Reading history-file %s\n",histfile);
@@ -1218,7 +1223,8 @@ sig_handler mysql_end(int sig)
 {
   mysql_close(&mysql);
 #ifdef HAVE_READLINE
-  if (!status.batch && !quick && !opt_html && !opt_xml && histfile)
+  if (!status.batch && !quick && !opt_html && !opt_xml &&
+      histfile && histfile[0])
   {
     /* write-history */
     if (verbose)
@@ -1345,7 +1351,7 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
    (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
    (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,

=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2009-03-20 14:27:53 +0000
+++ b/client/mysql_upgrade.c	2009-05-07 17:51:55 +0000
@@ -115,11 +115,11 @@ static struct my_option my_long_options[
 #endif
   {"socket", 'S', "Socket file to use for connection.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#include <sslopt-longopts.h>
   {"tmpdir", 't', "Directory for temporary files",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"user", 'u', "User for login if not current user.", (uchar**) &opt_user,
    (uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#include <sslopt-longopts.h>
   {"verbose", 'v', "Display more output about the process",
    (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
    GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
@@ -231,6 +231,8 @@ get_one_option(int optid, const struct m
     break;
 
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";			// Don't require password
     tty_password= 1;
     add_option= FALSE;
     if (argument)

=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc	2009-02-13 16:41:47 +0000
+++ b/client/mysqladmin.cc	2009-05-07 20:09:53 +0000
@@ -232,6 +232,8 @@ get_one_option(int optid, const struct m
     opt_count_iterations= 1;
     break;
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";			// Don't require password
     if (argument)
     {
       char *start=argument;
@@ -677,10 +679,16 @@ static int execute_commands(MYSQL *mysql
 	pos=argv[1];
 	for (;;)
 	{
-	  if (mysql_kill(mysql,(ulong) atol(pos)))
+          /* We don't use mysql_kill(), since it only handles 32-bit IDs. */
+          char buff[26], *out; /* "KILL " + max 20 digs + NUL */
+          out= strxmov(buff, "KILL ", NullS);
+          ullstr(strtoull(pos, NULL, 0), out);
+
+          if (mysql_query(mysql, buff))
 	  {
-	    my_printf_error(0, "kill failed on %ld; error: '%s'", error_flags,
-			    atol(pos), mysql_error(mysql));
+            /* out still points to just the number */
+	    my_printf_error(0, "kill failed on %s; error: '%s'", error_flags,
+			    out, mysql_error(mysql));
 	    error=1;
 	  }
 	  if (!(pos=strchr(pos,',')))

=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2009-02-13 16:41:47 +0000
+++ b/client/mysqlbinlog.cc	2009-05-07 17:51:55 +0000
@@ -1226,6 +1226,8 @@ get_one_option(int optid, const struct m
     one_database = 1;
     break;
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";                     // Don't require password
     if (argument)
     {
       my_free(pass,MYF(MY_ALLOW_ZERO_PTR));

=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c	2009-02-13 16:41:47 +0000
+++ b/client/mysqlcheck.c	2009-05-07 17:51:55 +0000
@@ -286,6 +286,8 @@ get_one_option(int optid, const struct m
     what_to_do= DO_UPGRADE;
     break;
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";			// Don't require password
     if (argument)
     {
       char *start = argument;

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2009-03-24 13:58:52 +0000
+++ b/client/mysqldump.c	2009-05-12 17:38:14 +0000
@@ -221,7 +221,7 @@ static struct my_option my_long_options[
    (uchar**) &opt_compatible_mode_str, (uchar**) &opt_compatible_mode_str, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"compact", OPT_COMPACT,
-   "Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs.  Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-add-locks",
+   "Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs.  Enables options --skip-add-drop-table --skip-add-locks --skip-comments --skip-disable-keys --skip-set-charset",
    (uchar**) &opt_compact, (uchar**) &opt_compact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"complete-insert", 'c', "Use complete insert statements.",
@@ -702,6 +702,8 @@ get_one_option(int optid, const struct m
     break;
 #endif
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";                     // Don't require password
     if (argument)
     {
       char *start=argument;
@@ -3811,6 +3813,10 @@ static int dump_all_databases()
     return 1;
   while ((row= mysql_fetch_row(tableres)))
   {
+    if (mysql_get_server_version(mysql) >= 50003 &&
+        !my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
+      continue;
+
     if (dump_all_tables_in_db(row[0]))
       result=1;
   }
@@ -3825,6 +3831,10 @@ static int dump_all_databases()
     }
     while ((row= mysql_fetch_row(tableres)))
     {
+      if (mysql_get_server_version(mysql) >= 50003 &&
+          !my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
+        continue;
+
       if (dump_all_views_in_db(row[0]))
         result=1;
     }
@@ -3931,10 +3941,6 @@ int init_dumping_tables(char *qdatabase)
 
 static int init_dumping(char *database, int init_func(char*))
 {
-  if (mysql_get_server_version(mysql) >= 50003 &&
-      !my_strcasecmp(&my_charset_latin1, database, "information_schema"))
-    return 1;
-
   if (mysql_select_db(mysql, database))
   {
     DB_error(mysql, "when selecting the database");
@@ -3993,6 +3999,7 @@ static int dump_all_tables_in_db(char *d
     DBUG_RETURN(1);
   if (opt_xml)
     print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
+
   if (lock_tables)
   {
     DYNAMIC_STRING query;
@@ -4226,7 +4233,10 @@ static int dump_selected_tables(char *db
   }
   end= pos;
 
-  if (lock_tables)
+  /* Can't LOCK TABLES in INFORMATION_SCHEMA, so don't try. */
+  if (lock_tables &&
+      !(mysql_get_server_version(mysql) >= 50003 &&
+        !my_strcasecmp(&my_charset_latin1, db, "information_schema")))
   {
     if (mysql_real_query(mysql, lock_tables_query.str,
                          lock_tables_query.length-1))

=== modified file 'client/mysqlimport.c'
--- a/client/mysqlimport.c	2008-11-14 16:29:38 +0000
+++ b/client/mysqlimport.c	2009-05-07 17:51:55 +0000
@@ -221,6 +221,8 @@ get_one_option(int optid, const struct m
     break;
 #endif
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";			// Don't require password
     if (argument)
     {
       char *start=argument;

=== modified file 'client/mysqlshow.c'
--- a/client/mysqlshow.c	2008-11-14 16:29:38 +0000
+++ b/client/mysqlshow.c	2009-05-07 17:51:55 +0000
@@ -281,6 +281,8 @@ get_one_option(int optid, const struct m
     opt_verbose++;
     break;
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";			// Don't require password
     if (argument)
     {
       char *start=argument;

=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c	2009-02-13 16:41:47 +0000
+++ b/client/mysqlslap.c	2009-05-07 17:51:55 +0000
@@ -712,6 +712,8 @@ get_one_option(int optid, const struct m
     verbose++;
     break;
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";			// Don't require password
     if (argument)
     {
       char *start= argument;

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2009-04-09 09:24:36 +0000
+++ b/client/mysqltest.cc	2009-05-07 17:51:55 +0000
@@ -5665,11 +5665,11 @@ static struct my_option my_long_options[
   {"sp-protocol", OPT_SP_PROTOCOL, "Use stored procedures for select",
    (uchar**) &sp_protocol, (uchar**) &sp_protocol, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+#include "sslopt-longopts.h"
   {"tail-lines", OPT_TAIL_LINES,
    "Number of lines of the resul to include in a failure report",
    (uchar**) &opt_tail_lines, (uchar**) &opt_tail_lines, 0,
    GET_INT, REQUIRED_ARG, 0, 0, 10000, 0, 0, 0},
-#include "sslopt-longopts.h"
   {"test-file", 'x', "Read test from/in this file (default stdin).",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"timer-file", 'm', "File where the timing in micro seconds is stored.",
@@ -5803,6 +5803,8 @@ get_one_option(int optid, const struct m
     break;
   }
   case 'p':
+    if (argument == disabled_my_option)
+      argument= (char*) "";			// Don't require password
     if (argument)
     {
       my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR));

=== modified file 'extra/innochecksum.c'
--- a/extra/innochecksum.c	2007-05-10 09:59:39 +0000
+++ b/extra/innochecksum.c	2009-05-05 18:07:26 +0000
@@ -224,7 +224,7 @@ int main(int argc, char **argv)
   }
   else if (verbose)
   {
-    printf("file %s= %llu bytes (%lu pages)...\n", argv[1], size, pages);
+    printf("file %s = %llu bytes (%lu pages)...\n", argv[optind], size, pages);
     printf("checking pages in range %lu to %lu\n", start_page, use_end_page ? end_page : (pages - 1));
   }
 

=== modified file 'extra/perror.c'
--- a/extra/perror.c	2009-02-24 10:33:51 +0000
+++ b/extra/perror.c	2009-04-28 18:16:44 +0000
@@ -115,7 +115,7 @@ static void usage(void)
 {
   print_version();
   puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
-  printf("Print a description for a system error code or an error code from\na MyISAM/ISAM/BDB table handler.\n");
+  printf("Print a description for a system error code or a MySQL error code.\n");
   printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
   printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
   my_print_help(my_long_options);

=== modified file 'mysql-test/r/ctype_cp932_binlog_stm.result'
--- a/mysql-test/r/ctype_cp932_binlog_stm.result	2008-10-02 05:56:07 +0000
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result	2009-05-05 06:55:22 +0000
@@ -46,4 +46,12 @@ master-bin.000001	1137	Query	1	1216	use 
 End of 5.0 tests
 SHOW BINLOG EVENTS FROM 364;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
+Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
+CREATE TABLE t1 (a varchar(16)) character set cp932;
+INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
+SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
+hex(a)	hex(lower(a))	hex(upper(a))
+8352835E	8352835E	8352835E
+8372835E	8372835E	8372835E
+DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/r/ctype_sjis.result'
--- a/mysql-test/r/ctype_sjis.result	2008-02-20 18:49:26 +0000
+++ b/mysql-test/r/ctype_sjis.result	2009-05-05 06:55:22 +0000
@@ -209,3 +209,13 @@ SET NAMES sjis;
 SELECT HEX('�����@�\') FROM DUAL;
 HEX('�����@�\')
 8DB2939181408C5C
+# Start of 5.1 tests
+Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
+CREATE TABLE t1 (a varchar(16)) character set sjis;
+INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
+SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
+hex(a)	hex(lower(a))	hex(upper(a))
+8352835E	8352835E	8352835E
+8372835E	8372835E	8372835E
+DROP TABLE t1;
+# End of 5.1 tests

=== modified file 'mysql-test/r/fulltext.result'
--- a/mysql-test/r/fulltext.result	2009-02-12 10:10:07 +0000
+++ b/mysql-test/r/fulltext.result	2009-04-23 11:24:08 +0000
@@ -535,3 +535,11 @@ CREATE TABLE t1(a TEXT);
 SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
 ERROR HY000: Incorrect arguments to AGAINST
 DROP TABLE t1;
+CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
+INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
+a
+awrd bwrd cwrd
+awrd bwrd cwrd
+awrd bwrd cwrd
+DROP TABLE t1;

=== modified file 'mysql-test/r/gis-rtree.result'
--- a/mysql-test/r/gis-rtree.result	2007-10-23 08:44:14 +0000
+++ b/mysql-test/r/gis-rtree.result	2009-04-29 02:59:10 +0000
@@ -186,106 +186,106 @@ CREATE TABLE t2 (
 fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
 g GEOMETRY NOT NULL
 ) ENGINE=MyISAM;
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))));
-INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10)));
+INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)));
 ALTER TABLE t2 ADD SPATIAL KEY(g);
 SHOW CREATE TABLE t2;
 Table	Create Table
@@ -309,406 +309,406 @@ fid	AsText(g)
 56	LINESTRING(41 41,50 50)
 45	LINESTRING(51 51,60 60)
 55	LINESTRING(41 51,50 60)
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-99
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-98
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-97
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-96
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-95
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-94
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-93
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-92
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-91
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-90
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-89
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-88
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-87
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-86
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-85
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-84
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-83
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-82
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-81
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-80
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-79
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-78
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-77
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-76
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-75
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-74
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-73
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-72
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-71
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-70
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-69
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-68
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-67
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-66
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-65
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-64
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-63
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-62
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-61
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-60
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-59
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-58
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-57
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-56
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-55
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-54
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-53
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-52
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-51
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-50
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-49
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-48
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-47
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-46
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-45
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-44
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-43
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-42
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-41
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-40
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-39
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-38
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-37
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-36
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-35
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-34
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-33
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-32
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-31
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-30
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-29
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-28
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-27
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-26
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-25
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-24
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-23
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-22
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-21
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-20
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-19
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-18
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-17
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-16
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-15
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-14
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-13
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-12
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-11
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-10
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-9
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-8
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-7
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-6
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-5
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-4
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-3
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-2
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-1
-DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)))));
+100
+DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))));
 SELECT count(*) FROM t2;
 count(*)
-0
+100
 DROP TABLE t2;
 drop table if exists t1;
 Warnings:
@@ -863,11 +863,11 @@ Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 DROP TABLE t1;
 CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
-INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
-INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
-INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
-INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
-SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
+INSERT INTO t1 (foo) VALUES (POINT(1,1));
+INSERT INTO t1 (foo) VALUES (POINT(1,0));
+INSERT INTO t1 (foo) VALUES (POINT(0,1));
+INSERT INTO t1 (foo) VALUES (POINT(0,0));
+SELECT 1 FROM t1 WHERE foo != POINT(0,0);
 1
 1
 1
@@ -1426,35 +1426,35 @@ Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 DROP TABLE t1;
 create table t1 (a geometry not null, spatial index(a));
-insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
-insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
-insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
-insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
-insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
-insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
-insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
-insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
-insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
-insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
-insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
-insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
-insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
-insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
-insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
-insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
-insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
-insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
-insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
-insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
-insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
-insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
-insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
-insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
-insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
-insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
-insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
-insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
-insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
+insert into t1 values (POINT(1.1517219314031e+164, 131072));
+insert into t1 values (POINT(9.1248812352444e+192, 2.9740338169556e+284));
+insert into t1 values (POINT(4.7783097267365e-299, -0));
+insert into t1 values (POINT(1.49166814624e-154, 2.0880974297595e-53));
+insert into t1 values (POINT(4.0917382598702e+149, 1.2024538023802e+111));
+insert into t1 values (POINT(2.0349165139404e+236, 2.9993936277913e-241));
+insert into t1 values (POINT(2.5243548967072e-29, 1.2024538023802e+111));
+insert into t1 values (POINT(0, 6.9835074892995e-251));
+insert into t1 values (POINT(2.0880974297595e-53, 3.1050361846014e+231));
+insert into t1 values (POINT(2.8728483499323e-188, 2.4600631144627e+260));
+insert into t1 values (POINT(3.0517578125e-05, 2.0349165139404e+236));
+insert into t1 values (POINT(1.1517219314031e+164, 1.1818212630766e-125));
+insert into t1 values (POINT(2.481040258324e-265, 5.7766220027675e-275));
+insert into t1 values (POINT(2.0880974297595e-53, 2.5243548967072e-29));
+insert into t1 values (POINT(5.7766220027675e-275, 9.9464647281957e+86));
+insert into t1 values (POINT(2.2181357552967e+130, 3.7857669957337e-270));
+insert into t1 values (POINT(4.5767114681874e-246, 3.6893488147419e+19));
+insert into t1 values (POINT(4.5767114681874e-246, 3.7537584144024e+255));
+insert into t1 values (POINT(3.7857669957337e-270, 1.8033161362863e-130));
+insert into t1 values (POINT(0, 5.8774717541114e-39));
+insert into t1 values (POINT(1.1517219314031e+164, 2.2761049594727e-159));
+insert into t1 values (POINT(6.243497100632e+144, 3.7857669957337e-270));
+insert into t1 values (POINT(3.7857669957337e-270, 2.6355494858076e-82));
+insert into t1 values (POINT(2.0349165139404e+236, 3.8518598887745e-34));
+insert into t1 values (POINT(4.6566128730774e-10, 2.0880974297595e-53));
+insert into t1 values (POINT(2.0880974297595e-53, 1.8827498946116e-183));
+insert into t1 values (POINT(1.8033161362863e-130, 9.1248812352444e+192));
+insert into t1 values (POINT(4.7783097267365e-299, 2.2761049594727e-159));
+insert into t1 values (POINT(1.94906280228e+289, 1.2338789709327e-178));
 drop table t1;
 CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
 INSERT INTO t1(foo) VALUES (NULL);

=== modified file 'mysql-test/r/gis.result'
--- a/mysql-test/r/gis.result	2009-02-14 09:11:32 +0000
+++ b/mysql-test/r/gis.result	2009-04-29 02:59:10 +0000
@@ -47,26 +47,26 @@ INSERT INTO gis_point VALUES 
 INSERT INTO gis_line VALUES
 (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
 (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
-(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
+(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
 INSERT INTO gis_polygon VALUES
 (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
 (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
-(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
+(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
 INSERT INTO gis_multi_point VALUES
 (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
 (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
-(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
+(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
 INSERT INTO gis_multi_line VALUES
 (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
 (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
-(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
+(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
 INSERT INTO gis_multi_polygon VALUES
 (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
 (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
+(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
 INSERT INTO gis_geometrycollection VALUES
 (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
-(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
+(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
 INSERT into gis_geometry SELECT * FROM gis_point;
 INSERT into gis_geometry SELECT * FROM gis_line;
 INSERT into gis_geometry SELECT * FROM gis_polygon;

=== modified file 'mysql-test/r/insert_select.result'
--- a/mysql-test/r/insert_select.result	2007-09-24 13:23:40 +0000
+++ b/mysql-test/r/insert_select.result	2009-05-04 12:45:36 +0000
@@ -765,6 +765,11 @@ f1	f2
 2	2
 10	10
 DROP TABLE t1, t2;
+CREATE TABLE t1 ( a INT KEY, b INT );
+INSERT INTO t1 VALUES ( 0, 1 );
+INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+DROP TABLE t1;
 SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
 CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10)));
 CREATE TABLE t2 (d VARCHAR(10));

=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result	2008-09-06 00:51:17 +0000
+++ b/mysql-test/r/myisam.result	2009-04-30 11:03:44 +0000
@@ -2226,4 +2226,30 @@ Key Start Len Index   Type
 1   2     30  multip. varchar              
 2   33    30  multip. char NULL            
 DROP TABLE t1;
+CREATE TABLE t1 (
+c INT,
+d bit(1),
+e INT,
+f VARCHAR(1),
+g BIT(1),
+h BIT(1),
+KEY (h, d, e, g)
+);
+INSERT INTO t1 VALUES
+(  3, 1, 1, 'a', 0, 0 ),
+(  3, 1, 5, 'a', 0, 0 ),
+( 10, 1, 2, 'a', 0, 1 ),
+( 10, 1, 3, 'a', 0, 1 ),
+( 10, 1, 4, 'a', 0, 1 );
+SELECT f FROM t1 WHERE d = 1 AND e = 2 AND g = 0 AND h = 1;
+f
+a
+SELECT h+0, d + 0, e, g + 0 FROM t1;
+h+0	d + 0	e	g + 0
+0	1	1	0
+0	1	5	0
+1	1	2	0
+1	1	3	0
+1	1	4	0
+DROP TABLE t1;
 End of 5.1 tests

=== added file 'mysql-test/r/myisam_debug.result'
--- a/mysql-test/r/myisam_debug.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/myisam_debug.result	2009-04-30 11:03:44 +0000
@@ -0,0 +1,39 @@
+#
+# BUG#40827 - Killing insert-select to MyISAM can cause table corruption
+#
+CREATE TABLE `t1` (
+`id` BIGINT(20) ,
+`id1` BIGINT(20) AUTO_INCREMENT,
+KEY(id1), KEY(id)
+) ENGINE=MyISAM;
+CREATE TABLE `t2` (
+`id` BIGINT(20) ,
+`id1` BIGINT(20) AUTO_INCREMENT,
+KEY (id1), KEY(id)
+) ENGINE=MyISAM;
+INSERT INTO t2 (id) VALUES (123);
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+INSERT INTO t2 (id) SELECT id  FROM t2;
+# Switch to insert Connection
+SET SESSION debug='+d,wait_in_enable_indexes';
+# Send insert data
+INSERT INTO t1(id) SELECT id  FROM t2;
+# Switch to default Connection
+# Wait for insert data to reach the debug point
+SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE STATE = 'wait_in_enable_indexes' AND 
+INFO = "INSERT INTO t1(id) SELECT id  FROM t2" 
+INTO @thread_id;
+KILL QUERY @thread_id;
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+DROP TABLE t1,t2;

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2009-04-21 10:25:04 +0000
+++ b/mysql-test/r/mysqldump.result	2009-05-12 17:45:40 +0000
@@ -3563,9 +3563,6 @@ grant REPLICATION CLIENT on *.* to mysql
 drop table t1;
 drop user mysqltest_1@localhost;
 #
-# Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the
-#           information_schema database.
-#
 # Bug#21424 mysqldump failing to export/import views
 #
 create database mysqldump_myDB;
@@ -3605,6 +3602,39 @@ drop user myDB_User@localhost;
 drop database mysqldump_myDB;
 use test;
 #
+# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the 
+# information_schema database.
+#
+# Bug #33762: mysqldump can not dump INFORMATION_SCHEMA
+#
+DROP TABLE IF EXISTS `TABLES`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TEMPORARY TABLE `TABLES` (
+  `TABLE_CATALOG` varchar(512) DEFAULT NULL,
+  `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
+  `TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
+  `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '',
+  `ENGINE` varchar(64) DEFAULT NULL,
+  `VERSION` bigint(21) unsigned DEFAULT NULL,
+  `ROW_FORMAT` varchar(10) DEFAULT NULL,
+  `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL,
+  `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL,
+  `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
+  `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
+  `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL,
+  `DATA_FREE` bigint(21) unsigned DEFAULT NULL,
+  `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL,
+  `CREATE_TIME` datetime DEFAULT NULL,
+  `UPDATE_TIME` datetime DEFAULT NULL,
+  `CHECK_TIME` datetime DEFAULT NULL,
+  `TABLE_COLLATION` varchar(32) DEFAULT NULL,
+  `CHECKSUM` bigint(21) unsigned DEFAULT NULL,
+  `CREATE_OPTIONS` varchar(255) DEFAULT NULL,
+  `TABLE_COMMENT` varchar(80) NOT NULL DEFAULT ''
+) ENGINE=MEMORY DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+#
 # Bug#19745 mysqldump --xml produces invalid xml
 #
 DROP TABLE IF EXISTS t1;
@@ -4006,6 +4036,181 @@ UNLOCK TABLES;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
 DROP TABLE t1;
+create table t1 (a text , b text);
+create table t2 (a text , b text);
+insert t1 values ("Duck, Duck", "goose");
+insert t1 values ("Duck, Duck", "pidgeon");
+insert t2 values ("We the people", "in order to perform");
+insert t2 values ("a more perfect", "union");
+select * from t1;
+a	b
+Duck, Duck	goose
+Duck, Duck	pidgeon
+select * from t2;
+a	b
+We the people	in order to perform
+a more perfect	union
+test.t1: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
+test.t2: Records: 2  Deleted: 0  Skipped: 0  Warnings: 0
+select * from t1;
+a	b
+Duck, Duck	goose
+Duck, Duck	pidgeon
+Duck, Duck	goose
+Duck, Duck	pidgeon
+select * from t2;
+a	b
+We the people	in order to perform
+a more perfect	union
+We the people	in order to perform
+a more perfect	union
+create table words(a varchar(255));
+create table words2(b varchar(255));
+select * from t1;
+a	b
+Duck, Duck	goose
+Duck, Duck	pidgeon
+Duck, Duck	goose
+Duck, Duck	pidgeon
+Duck, Duck	goose
+Duck, Duck	pidgeon
+select * from t2;
+a	b
+We the people	in order to perform
+a more perfect	union
+We the people	in order to perform
+a more perfect	union
+We the people	in order to perform
+a more perfect	union
+select * from words;
+a
+Aarhus
+Aaron
+Ababa
+aback
+abaft
+abandon
+abandoned
+abandoning
+abandonment
+abandons
+Aarhus
+Aaron
+Ababa
+aback
+abaft
+abandon
+abandoned
+abandoning
+abandonment
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+select * from words2;
+b
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+drop table words;
+mysql-import: Error: 1146, Table 'test.words' doesn't exist, when using table: words
+drop table t1;
+drop table t2;
+drop table words2;
 #
 # Bug#16853 mysqldump doesn't show events
 #

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2009-04-01 08:58:55 +0000
+++ b/mysql-test/r/sp.result	2009-04-30 09:37:29 +0000
@@ -6994,6 +6994,21 @@ select name from mysql.proc where name =
 name
 p
 drop procedure p;
+CREATE DEFINER = 'root'@'localhost' PROCEDURE p1()
+NOT DETERMINISTIC
+CONTAINS SQL
+SQL SECURITY DEFINER
+COMMENT ''
+BEGIN
+SHOW TABLE STATUS like 't1';
+END;//
+CREATE TABLE t1 (f1 INT);
+CALL p1();
+CALL p1();
+CALL p1();
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
 # ------------------------------------------------------------------
 # -- End of 5.1 tests
 # ------------------------------------------------------------------

=== modified file 'mysql-test/r/subselect3.result'
--- a/mysql-test/r/subselect3.result	2009-01-28 18:48:41 +0000
+++ b/mysql-test/r/subselect3.result	2009-04-30 19:27:10 +0000
@@ -849,6 +849,25 @@ ROW(1,2) = (SELECT    1,    1)	ROW(1,2) 
 SELECT ROW(1,2) = (SELECT    1,    2), ROW(1,2) IN (SELECT    1,    2);
 ROW(1,2) = (SELECT    1,    2)	ROW(1,2) IN (SELECT    1,    2)
 1	1
+CREATE TABLE t1 (a INT, b INT, c INT);
+INSERT INTO t1 VALUES (1,1,1), (1,1,1);
+EXPLAIN EXTENDED 
+SELECT c FROM 
+( SELECT 
+(SELECT COUNT(a) FROM 
+(SELECT COUNT(b) FROM t1) AS x GROUP BY c
+) FROM t1 GROUP BY b
+) AS y;
+ERROR 42S22: Unknown column 'c' in 'field list'
+SHOW WARNINGS;
+Level	Code	Message
+Note	1276	Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
+Note	1276	Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
+Error	1054	Unknown column 'c' in 'field list'
+Note	1003	select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `c`) AS `(SELECT COUNT(a) FROM 
+(SELECT COUNT(b) FROM t1) AS x GROUP BY c
+)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
+DROP TABLE t1;
 End of 5.0 tests
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

=== modified file 'mysql-test/r/upgrade.result'
--- a/mysql-test/r/upgrade.result	2009-04-10 09:25:48 +0000
+++ b/mysql-test/r/upgrade.result	2009-04-30 12:46:49 +0000
@@ -57,6 +57,18 @@ s1
 1
 drop table `txu@0023p@0023p1`;
 drop table `txu#p#p1`;
+#
+# Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
+#
+# copy table created using mysql4.0 into the data dir
+# check the table created using mysql 4.0
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	error	Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+# query the table created using mysql 4.0
+SELECT * FROM t1;
+c1	c2	c3
+DROP TABLE t1;
 truncate t1;
 drop table t1;
 drop database if exists `tabc`;

=== added file 'mysql-test/std_data/bug37631.MYD'

=== added file 'mysql-test/std_data/bug37631.MYI'
Binary files a/mysql-test/std_data/bug37631.MYI	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug37631.MYI	2009-04-30 12:46:49 +0000 differ

=== added file 'mysql-test/std_data/bug37631.frm'
Binary files a/mysql-test/std_data/bug37631.frm	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug37631.frm	2009-04-30 12:46:49 +0000 differ

=== modified file 'mysql-test/suite/rpl/include/rpl_mixed_ddl.inc'
--- a/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc	2007-08-28 00:41:29 +0000
+++ b/mysql-test/suite/rpl/include/rpl_mixed_ddl.inc	2009-04-26 21:21:01 +0000
@@ -83,4 +83,4 @@ sync_slave_with_master;
 # will be created. You will need to go to the mysql-test dir and diff
 # the files your self to see what is not matching
 
---exec diff $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql

=== added file 'mysql-test/suite/rpl/r/rpl_bug38694.result'
--- a/mysql-test/suite/rpl/r/rpl_bug38694.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_bug38694.result	2009-04-30 13:20:38 +0000
@@ -0,0 +1,6 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;

=== removed file 'mysql-test/suite/rpl/t/rpl_000015-slave.sh'
--- a/mysql-test/suite/rpl/t/rpl_000015-slave.sh	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/rpl/t/rpl_000015-slave.sh	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
-rm -f $MYSQLTEST_VARDIR/slave-data/master.info

=== added file 'mysql-test/suite/rpl/t/rpl_bug38694-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_bug38694-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug38694-slave.opt	2009-04-30 13:20:38 +0000
@@ -0,0 +1 @@
+--loose-debug=d,simulate_slave_delay_at_terminate_bug38694

=== added file 'mysql-test/suite/rpl/t/rpl_bug38694.test'
--- a/mysql-test/suite/rpl/t/rpl_bug38694.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug38694.test	2009-04-30 13:20:38 +0000
@@ -0,0 +1,10 @@
+# Testing replication threads stopping concurrency issue
+# at the server shutdown
+# Related bugs: bug#38694, bug#29968, bug#25306
+# The test checks if a delay at the termination phase of slave threads
+# DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
+# could cause any issue.
+
+source include/master-slave.inc;
+
+# End of tests

=== modified file 'mysql-test/suite/rpl/t/rpl_incident.test'
--- a/mysql-test/suite/rpl/t/rpl_incident.test	2008-08-14 09:38:22 +0000
+++ b/mysql-test/suite/rpl/t/rpl_incident.test	2009-05-02 19:28:54 +0000
@@ -14,42 +14,13 @@ REPLACE INTO t1 VALUES (4);
 SELECT * FROM t1;
 
 connection slave;
-source include/wait_for_slave_sql_to_stop.inc;
+# Wait until SQL thread stops with error LOST_EVENT on master
+let $slave_sql_errno= 1590;
+source include/wait_for_slave_sql_error.inc;
 
 # The 4 should not be inserted into the table, since the incident log
 # event should have stop the slave.
 --echo **** On Slave ****
-#### BEGIN DEBUG INFO ADDED BY SVEN 2008-07-18 -- SEE BUG#38077 ####
-let $tables= query_get_value(SHOW TABLES, Tables_in_test, 1);
-if (`SELECT '$tables' != 't1'`)
-{
-  --echo **** TEST CASE BUG! PRINTING DEBUG INFO! ****
-  --echo **** Dear developer, if you see this in the output of a test
-  --echo **** case run, please add all the information below as a
-  --echo **** comment to BUG#38077. If it's a pushbuild failure, please
-  --echo **** include a link to the push page.
-  --echo **** Thank you! /Sven
-  SHOW BINLOG EVENTS;
-  --echo **** master binlog ****
-  --error 0,1
-  --exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001
-  --echo **** slave binlog ****
-  --error 0,1
-  --exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/slave-bin.000001
-  --echo **** slave status ****
-  query_vertical SHOW SLAVE STATUS;
-  --echo **** slave's master status ****
-  SHOW MASTER STATUS;
-  --echo **** slave binlog events ****
-  --echo [on master]
-  connection master;
-  --echo **** master status ****
-  SHOW MASTER STATUS;
-  --echo **** master binlog events ****
-  SHOW BINLOG EVENTS;
-  exit;
-}
-#### END DEBUG INFO ####
 SELECT * FROM t1;
 
 --replace_result $MASTER_MYPORT MASTER_PORT

=== modified file 'mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test'
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test	2008-04-03 19:40:10 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test	2009-04-24 01:02:07 +0000
@@ -244,7 +244,7 @@ connection master;
 
 # We should be gold by the time, so I will get rid of our file.
 
---exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/remote.sql
 ################### End Bug 17654 ######################
 
 # What is the point of this test? It seems entirely pointless. It
@@ -349,9 +349,9 @@ FLUSH LOGS;
 
 --diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql
 
---exec rm $MYSQLTEST_VARDIR/tmp/remote.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/remote.sql
 
---exec rm $MYSQLTEST_VARDIR/tmp/local.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/local.sql
 
 DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; 
 sync_slave_with_master;

=== modified file 'mysql-test/t/ctype_cp932_binlog_stm.test'
--- a/mysql-test/t/ctype_cp932_binlog_stm.test	2007-05-30 10:23:47 +0000
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test	2009-05-05 06:55:22 +0000
@@ -34,4 +34,10 @@ delimiter ;|
 --error 1220
 SHOW BINLOG EVENTS FROM 364;
 
+--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
+CREATE TABLE t1 (a varchar(16)) character set cp932;
+INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
+SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
+DROP TABLE t1;
+
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/ctype_sjis.test'
--- a/mysql-test/t/ctype_sjis.test	2008-02-20 18:49:26 +0000
+++ b/mysql-test/t/ctype_sjis.test	2009-05-05 06:55:22 +0000
@@ -83,3 +83,13 @@ SET NAMES sjis;
 SELECT HEX('�����@�\') FROM DUAL;
 
 # End of 4.1 tests
+
+--echo # Start of 5.1 tests
+
+--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
+CREATE TABLE t1 (a varchar(16)) character set sjis;
+INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
+SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
+DROP TABLE t1;
+
+--echo # End of 5.1 tests

=== modified file 'mysql-test/t/fulltext.test'
--- a/mysql-test/t/fulltext.test	2009-02-12 10:10:07 +0000
+++ b/mysql-test/t/fulltext.test	2009-04-23 11:24:08 +0000
@@ -462,3 +462,12 @@ CREATE TABLE t1(a TEXT);
 --error ER_WRONG_ARGUMENTS
 SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
 DROP TABLE t1;
+
+#
+# BUG#42907 - Multi-term boolean fulltext query containing a single
+#             quote fails in 5.1.x
+#
+CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
+INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
+SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
+DROP TABLE t1;

=== modified file 'mysql-test/t/gis-rtree.test'
--- a/mysql-test/t/gis-rtree.test	2007-10-05 10:43:15 +0000
+++ b/mysql-test/t/gis-rtree.test	2009-04-29 02:59:10 +0000
@@ -41,7 +41,7 @@ while ($1)
   let $2=10;
   while ($2)
   {
-    eval INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))));
+    eval INSERT INTO t2 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)));
     dec $2;
   }
   dec $1;
@@ -61,7 +61,7 @@ while ($1)
   let $2=10;
   while ($2)
   {
-    eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)))));
+    eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))));
     SELECT count(*) FROM t2;
     dec $2;
   }
@@ -235,11 +235,11 @@ DROP TABLE t1;
 # Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection
 #
 CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
-INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
-INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
-INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
-INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
-SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
+INSERT INTO t1 (foo) VALUES (POINT(1,1));
+INSERT INTO t1 (foo) VALUES (POINT(1,0));
+INSERT INTO t1 (foo) VALUES (POINT(0,1));
+INSERT INTO t1 (foo) VALUES (POINT(0,0));
+SELECT 1 FROM t1 WHERE foo != POINT(0,0);
 DROP TABLE t1;
 
 #
@@ -802,35 +802,35 @@ DROP TABLE t1;
 #
 
 create table t1 (a geometry not null, spatial index(a));
-insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
-insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
-insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
-insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
-insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
-insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
-insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
-insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
-insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
-insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
-insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
-insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
-insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
-insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
-insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
-insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
-insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
-insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
-insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
-insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
-insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
-insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
-insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
-insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
-insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
-insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
-insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
-insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
-insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
+insert into t1 values (POINT(1.1517219314031e+164, 131072));
+insert into t1 values (POINT(9.1248812352444e+192, 2.9740338169556e+284));
+insert into t1 values (POINT(4.7783097267365e-299, -0));
+insert into t1 values (POINT(1.49166814624e-154, 2.0880974297595e-53));
+insert into t1 values (POINT(4.0917382598702e+149, 1.2024538023802e+111));
+insert into t1 values (POINT(2.0349165139404e+236, 2.9993936277913e-241));
+insert into t1 values (POINT(2.5243548967072e-29, 1.2024538023802e+111));
+insert into t1 values (POINT(0, 6.9835074892995e-251));
+insert into t1 values (POINT(2.0880974297595e-53, 3.1050361846014e+231));
+insert into t1 values (POINT(2.8728483499323e-188, 2.4600631144627e+260));
+insert into t1 values (POINT(3.0517578125e-05, 2.0349165139404e+236));
+insert into t1 values (POINT(1.1517219314031e+164, 1.1818212630766e-125));
+insert into t1 values (POINT(2.481040258324e-265, 5.7766220027675e-275));
+insert into t1 values (POINT(2.0880974297595e-53, 2.5243548967072e-29));
+insert into t1 values (POINT(5.7766220027675e-275, 9.9464647281957e+86));
+insert into t1 values (POINT(2.2181357552967e+130, 3.7857669957337e-270));
+insert into t1 values (POINT(4.5767114681874e-246, 3.6893488147419e+19));
+insert into t1 values (POINT(4.5767114681874e-246, 3.7537584144024e+255));
+insert into t1 values (POINT(3.7857669957337e-270, 1.8033161362863e-130));
+insert into t1 values (POINT(0, 5.8774717541114e-39));
+insert into t1 values (POINT(1.1517219314031e+164, 2.2761049594727e-159));
+insert into t1 values (POINT(6.243497100632e+144, 3.7857669957337e-270));
+insert into t1 values (POINT(3.7857669957337e-270, 2.6355494858076e-82));
+insert into t1 values (POINT(2.0349165139404e+236, 3.8518598887745e-34));
+insert into t1 values (POINT(4.6566128730774e-10, 2.0880974297595e-53));
+insert into t1 values (POINT(2.0880974297595e-53, 1.8827498946116e-183));
+insert into t1 values (POINT(1.8033161362863e-130, 9.1248812352444e+192));
+insert into t1 values (POINT(4.7783097267365e-299, 2.2761049594727e-159));
+insert into t1 values (POINT(1.94906280228e+289, 1.2338789709327e-178));
 drop table t1;
 
 # End of 4.1 tests

=== modified file 'mysql-test/t/gis.test'
--- a/mysql-test/t/gis.test	2009-02-15 09:47:04 +0000
+++ b/mysql-test/t/gis.test	2009-04-29 02:59:10 +0000
@@ -37,32 +37,32 @@ INSERT INTO gis_point VALUES 
 INSERT INTO gis_line VALUES
 (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
 (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
-(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
+(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
 
 INSERT INTO gis_polygon VALUES
 (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
 (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
-(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
+(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
 
 INSERT INTO gis_multi_point VALUES
 (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
 (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
-(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
+(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
 
 INSERT INTO gis_multi_line VALUES
 (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
 (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
-(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
+(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
 
 
 INSERT INTO gis_multi_polygon VALUES
 (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
 (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
+(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
 
 INSERT INTO gis_geometrycollection VALUES
 (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
-(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
+(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
 
 INSERT into gis_geometry SELECT * FROM gis_point;
 INSERT into gis_geometry SELECT * FROM gis_line;

=== modified file 'mysql-test/t/insert_select.test'
--- a/mysql-test/t/insert_select.test	2007-09-24 13:23:40 +0000
+++ b/mysql-test/t/insert_select.test	2009-05-04 12:45:36 +0000
@@ -324,6 +324,16 @@ SELECT * FROM t2;
 DROP TABLE t1, t2;
 
 #
+# Bug#44306: Assertion fail on duplicate key error in 'INSERT ... SELECT' 
+# statements
+#
+CREATE TABLE t1 ( a INT KEY, b INT );
+INSERT INTO t1 VALUES ( 0, 1 );
+--error ER_DUP_ENTRY
+INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
+DROP TABLE t1;
+
+#
 # Bug #26207: inserts don't work with shortened index
 #
 SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test	2008-09-06 00:51:17 +0000
+++ b/mysql-test/t/myisam.test	2009-04-30 11:03:44 +0000
@@ -1478,5 +1478,30 @@ let $MYSQLD_DATADIR= `select @@datadir`;
 --exec $MYISAMCHK -d $MYSQLD_DATADIR/test/t1
 DROP TABLE t1;
 
+#
+# Bug#43737: Select query return bad result
+#
+CREATE TABLE t1 (
+  c INT,
+  d bit(1),
+  e INT,
+  f VARCHAR(1),
+  g BIT(1),
+  h BIT(1),
+  KEY (h, d, e, g)
+);
+INSERT INTO t1 VALUES
+  (  3, 1, 1, 'a', 0, 0 ),
+  (  3, 1, 5, 'a', 0, 0 ),
+  ( 10, 1, 2, 'a', 0, 1 ),
+  ( 10, 1, 3, 'a', 0, 1 ),
+  ( 10, 1, 4, 'a', 0, 1 );
+
+SELECT f FROM t1 WHERE d = 1 AND e = 2 AND g = 0 AND h = 1;
+
+SELECT h+0, d + 0, e, g + 0 FROM t1;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests
 

=== added file 'mysql-test/t/myisam_debug.test'
--- a/mysql-test/t/myisam_debug.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/myisam_debug.test	2009-04-30 11:03:44 +0000
@@ -0,0 +1,54 @@
+--source include/have_debug.inc
+
+--echo #
+--echo # BUG#40827 - Killing insert-select to MyISAM can cause table corruption
+--echo #
+
+CONNECT (insertConn, localhost, root,,);
+
+CREATE TABLE `t1` (
+`id` BIGINT(20) ,
+`id1` BIGINT(20) AUTO_INCREMENT,
+ KEY(id1), KEY(id)
+) ENGINE=MyISAM;
+
+CREATE TABLE `t2` (
+`id` BIGINT(20) ,
+`id1` BIGINT(20) AUTO_INCREMENT,
+ KEY (id1), KEY(id)
+) ENGINE=MyISAM;
+
+INSERT INTO t2 (id) VALUES (123);
+
+let $i = 10; 
+while ($i)
+{
+  INSERT INTO t2 (id) SELECT id  FROM t2; 
+  dec $i; 
+}
+
+--echo # Switch to insert Connection
+CONNECTION insertConn;
+SET SESSION debug='+d,wait_in_enable_indexes';
+--echo # Send insert data
+SEND INSERT INTO t1(id) SELECT id  FROM t2; 
+
+--echo # Switch to default Connection
+CONNECTION default;
+--echo # Wait for insert data to reach the debug point
+
+let $wait_condition=
+  SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+  WHERE STATE = "wait_in_enable_indexes" AND 
+  INFO = "INSERT INTO t1(id) SELECT id  FROM t2";
+--source include/wait_condition.inc
+
+SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE STATE = 'wait_in_enable_indexes' AND 
+INFO = "INSERT INTO t1(id) SELECT id  FROM t2" 
+INTO @thread_id;
+
+KILL QUERY @thread_id;
+CHECK TABLE t1; 
+DROP TABLE t1,t2;
+DISCONNECT insertConn;

=== modified file 'mysql-test/t/mysqldump.test'
--- a/mysql-test/t/mysqldump.test	2009-04-21 10:25:04 +0000
+++ b/mysql-test/t/mysqldump.test	2009-05-12 17:45:40 +0000
@@ -1396,9 +1396,6 @@ drop user mysqltest_1@localhost;
 
 
 --echo #
---echo # Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the
---echo #           information_schema database.
---echo #
 --echo # Bug#21424 mysqldump failing to export/import views
 --echo #
 
@@ -1464,6 +1461,13 @@ disconnect root;
 --remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql
 use test;
 
+--echo #
+--echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the 
+--echo # information_schema database.
+--echo #
+--echo # Bug #33762: mysqldump can not dump INFORMATION_SCHEMA
+--echo #
+--exec $MYSQL_DUMP --compact --opt -d information_schema tables
 
 --echo #
 --echo # Bug#19745 mysqldump --xml produces invalid xml
@@ -1699,9 +1703,6 @@ DROP TABLE t1;
 # Added for use-thread option
 #
 
-# THIS PART OF THE TEST IS DISABLED UNTIL Bug#32991 IS FIXED
-if ($bug32991_fixed) {
-
 create table t1 (a text , b text);
 create table t2 (a text , b text);
 insert t1 values ("Duck, Duck", "goose");
@@ -1739,8 +1740,6 @@ drop table t2;
 
 drop table words2;
 
-}
-
 --echo #
 --echo # Bug#16853 mysqldump doesn't show events
 --echo #

=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test	2009-04-01 08:58:55 +0000
+++ b/mysql-test/t/sp.test	2009-04-30 09:37:29 +0000
@@ -8270,6 +8270,33 @@ select replace(@full_mode, 'ALLOW_INVALI
 select name from mysql.proc where name = 'p' and sql_mode = @full_mode;
 drop procedure p;
 
+#
+# Bug#43962 "Packets out of order" calling a SHOW TABLE STATUS
+#
+DELIMITER //;
+CREATE DEFINER = 'root'@'localhost' PROCEDURE p1()
+NOT DETERMINISTIC
+CONTAINS SQL
+SQL SECURITY DEFINER
+COMMENT ''
+BEGIN
+ SHOW TABLE STATUS like 't1';
+END;//
+DELIMITER ;//
+
+
+CREATE TABLE t1 (f1 INT);
+--disable_result_log
+let $tab_count= 4;
+while ($tab_count)
+{
+ EVAL CALL p1();
+ dec $tab_count ;
+}
+--enable_result_log
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
 --echo # ------------------------------------------------------------------
 --echo # -- End of 5.1 tests
 --echo # ------------------------------------------------------------------

=== modified file 'mysql-test/t/sp_trans_log.test'
--- a/mysql-test/t/sp_trans_log.test	2007-06-06 17:57:07 +0000
+++ b/mysql-test/t/sp_trans_log.test	2009-04-28 18:42:17 +0000
@@ -8,17 +8,17 @@
 delimiter |;
 
 #
-# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
-# Bug #23333 stored function + non-transac table + transac table =
-#            breaks stmt-based binlog
-# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
+# Bug#13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
+# Bug#23333 stored function + non-transac table + transac table =
+#           breaks stmt-based binlog
+# Bug#27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
 #
 --disable_warnings
 drop function if exists bug23333|
 drop table if exists t1,t2|
 --enable_warnings
- CREATE TABLE t1 (a int  NOT NULL auto_increment primary key) ENGINE=MyISAM|
- CREATE TABLE t2 (a int  NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
+CREATE TABLE t1 (a int  NOT NULL auto_increment primary key) ENGINE=MyISAM|
+CREATE TABLE t2 (a int  NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
 
 insert into t2 values (1,1)|
 

=== modified file 'mysql-test/t/subselect3.test'
--- a/mysql-test/t/subselect3.test	2009-01-28 18:48:41 +0000
+++ b/mysql-test/t/subselect3.test	2009-04-30 19:27:10 +0000
@@ -669,6 +669,25 @@ SELECT ROW(1,2) = (SELECT NULL,    1), R
 SELECT ROW(1,2) = (SELECT    1,    1), ROW(1,2) IN (SELECT    1,    1);
 SELECT ROW(1,2) = (SELECT    1,    2), ROW(1,2) IN (SELECT    1,    2);
 
+#
+# Bug #37362      Crash in do_field_eq
+#
+CREATE TABLE t1 (a INT, b INT, c INT);
+INSERT INTO t1 VALUES (1,1,1), (1,1,1);
+
+--error 1054
+EXPLAIN EXTENDED 
+  SELECT c FROM 
+    ( SELECT 
+      (SELECT COUNT(a) FROM 
+        (SELECT COUNT(b) FROM t1) AS x GROUP BY c
+      ) FROM t1 GROUP BY b
+    ) AS y;
+SHOW WARNINGS;
+
+DROP TABLE t1;
+
+
 --echo End of 5.0 tests
 
 #

=== modified file 'mysql-test/t/upgrade.test'
--- a/mysql-test/t/upgrade.test	2009-04-13 13:09:10 +0000
+++ b/mysql-test/t/upgrade.test	2009-04-30 12:46:49 +0000
@@ -48,6 +48,20 @@ select * from `txu#p#p1`;
 drop table `txu@0023p@0023p1`;
 drop table `txu#p#p1`;
 
+--echo #
+--echo # Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
+--echo #
+--echo # copy table created using mysql4.0 into the data dir
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+copy_file std_data/bug37631.frm $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/bug37631.MYD $MYSQLD_DATADIR/test/t1.MYD;
+copy_file std_data/bug37631.MYI $MYSQLD_DATADIR/test/t1.MYI;
+--echo # check the table created using mysql 4.0
+CHECK TABLE t1;
+--echo # query the table created using mysql 4.0
+SELECT * FROM t1;
+DROP TABLE t1;
+
 #
 # Check if old tables work
 #

=== modified file 'mysys/mf_keycache.c'
--- a/mysys/mf_keycache.c	2009-02-13 16:41:47 +0000
+++ b/mysys/mf_keycache.c	2009-04-29 11:51:10 +0000
@@ -2044,13 +2044,15 @@ restart:
         }
         else
         {
+          size_t block_mem_offset;
           /* There are some never used blocks, take first of them */
           DBUG_ASSERT(keycache->blocks_used <
                       (ulong) keycache->disk_blocks);
           block= &keycache->block_root[keycache->blocks_used];
+          block_mem_offset= 
+           ((size_t) keycache->blocks_used) * keycache->key_cache_block_size;
           block->buffer= ADD_TO_PTR(keycache->block_mem,
-                                    ((ulong) keycache->blocks_used*
-                                     keycache->key_cache_block_size),
+                                    block_mem_offset,
                                     uchar*);
           keycache->blocks_used++;
           DBUG_ASSERT(!block->next_used);

=== modified file 'mysys/safemalloc.c'
--- a/mysys/safemalloc.c	2009-02-13 16:41:47 +0000
+++ b/mysys/safemalloc.c	2009-04-30 13:42:38 +0000
@@ -174,7 +174,7 @@ void *_mymalloc(size_t size, const char 
   data[size + 3]= MAGICEND3;
   irem->filename= (char *) filename;
   irem->linenum= lineno;
-  irem->datasize= (uint32) size;
+  irem->datasize= size;
   irem->prev=	  NULL;
 
   /* Add this remember structure to the linked list */

=== modified file 'scripts/mysql_convert_table_format.sh'
--- a/scripts/mysql_convert_table_format.sh	2007-12-28 00:07:42 +0000
+++ b/scripts/mysql_convert_table_format.sh	2009-04-28 18:47:34 +0000
@@ -23,18 +23,30 @@ $opt_help=$opt_version=$opt_verbose=$opt
 $opt_user=$opt_database=$opt_password=undef;
 $opt_host="localhost";
 $opt_socket="";
-$opt_type="MYISAM";
+$opt_engine="MYISAM";
 $opt_port=0;
 $exit_status=0;
 
-GetOptions("force","help","host=s","password=s","user=s","type=s","verbose","version","socket=s", "port=i") || 
-  usage(0);
+GetOptions(
+  "e|engine|type=s"       => \$opt_type,
+  "f|force"               => \$opt_force,
+  "help|?"               => \$opt_help,
+  "h|host=s"              => \$opt_host,
+  "p|password=s"          => \$opt_password,
+  "u|user=s"              => \$opt_user,
+  "v|verbose"             => \$opt_verbose,
+  "V|version"             => \$opt_version,
+  "S|socket=s"            => \$opt_socket, 
+  "P|port=i"              => \$opt_port
+) || usage(0);
+
 usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version);
+
 $opt_database=shift(@ARGV);
 
-if (uc($opt_type) eq "HEAP")
+if (grep { /^$opt_engine$/i } qw(HEAP MEMORY BLACKHOLE))
 {
-  print "Converting to type HEAP would delete your tables; aborting\n";
+  print "Converting to '$opt_engine' would delete your data; aborting\n";
   exit(1);
 }
 
@@ -54,21 +66,29 @@ $dbh = DBI->connect("DBI:mysql:$opt_data
 		    { PrintError => 0})
   || die "Can't connect to database $opt_database: $DBI::errstr\n";
 
-if ($#ARGV < 0)
+my @tables;
+
+push(@ARGV, "%") if(!@ARGV);
+
+foreach $pattern (@ARGV)
 {
-  # Fetch all table names from the database
   my ($sth,$row);
-  $sth=$dbh->prepare("show tables");
-  $sth->execute || die "Can't get tables from $opt_database; $DBI::errstr\n";
+  $sth=$dbh->prepare("SHOW TABLES LIKE ?");
+  $rv= $sth->execute($pattern);
+  if(!int($rv))
+  {
+    warn "Can't get tables matching '$pattern' from $opt_database; $DBI::errstr\n"; 
+    exit(1) unless $opt_force;
+  }
   while (($row = $sth->fetchrow_arrayref))
   {
-    push(@ARGV,$row->[0]);
+    push(@tables, $row->[0]);
   }
   $sth->finish;
 }
 
 print "Converting tables:\n" if ($opt_verbose);
-foreach $table (@ARGV)
+foreach $table (@tables)
 {
   my ($sth,$row);
 
@@ -76,14 +96,15 @@ foreach $table (@ARGV)
   $sth=$dbh->prepare("show table status like '$table'");  
   if ($sth->execute && ($row = $sth->fetchrow_arrayref))
   {
-    if (uc($row->[1]) eq uc($opt_type))
+    if (uc($row->[1]) eq uc($opt_engine))
     {
-      print "$table is already of type $opt_type;  Ignored\n";
+      print "$table already uses the '$opt_engine' engine;  Ignored\n";
       next;
     }
   }
   print "converting $table\n" if ($opt_verbose);
-  if (!$dbh->do("ALTER TABLE $table ENGINE=$opt_type"))
+  $table=~ s/`/``/g;
+  if (!$dbh->do("ALTER TABLE `$table` ENGINE=$opt_engine"))
   {
     print STDERR "Can't convert $table: Error $DBI::errstr\n";
     exit(1) if (!$opt_force);
@@ -103,43 +124,43 @@ sub usage
 
   print <<EOF;
 
-Conversion of a MySQL tables to other table types.
+Conversion of a MySQL tables to other storage engines
 
- Usage: $0 database [tables]
+ Usage: $0 database [table[ table ...]]
  If no tables has been specifed, all tables in the database will be converted.
+ You can also use wildcards, ie "my%"
 
  The following options are available:
 
---force
+-f, --force
   Continue even if there is some error.
 
---help or --Information
+-?, --help
   Shows this help
 
---host='host name' (Default $opt_host)
-  Host name where the database server is located.
+-e, --engine=ENGINE
+  Converts tables to the given storage engine (Default: $opt_engine)
 
---password='password'
+-h, --host=HOST
+  Host name where the database server is located. (Default: $opt_host)
+
+-p, --password=PASSWORD
   Password for the current user.
 
---port=port
+-P, --port=PORT
   TCP/IP port to connect to if host is not "localhost".
 
---socket='/path/to/socket'
+-S, --socket=SOCKET
   Socket to connect with.
 
---ENGINE='table-type'
-  Converts tables to the given table type (Default: $opt_type)
-  MySQL 3.23 supports at least the BDB, ISAM and MYISAM types.
-
---user='user_name'
+-u, --user=USER
   User name to log into the SQL server.
 
---verbose
+-v, --verbose
   This is a test specific option that is only used when debugging a test.
   Print more information about what is going on.
 
---version
+-V, --version
   Shows the version of this program.
 EOF
   exit(1);

=== modified file 'scripts/mysql_zap.sh'
--- a/scripts/mysql_zap.sh	2006-12-31 00:02:27 +0000
+++ b/scripts/mysql_zap.sh	2009-05-08 00:53:03 +0000
@@ -27,8 +27,8 @@ $opt_f= 0;
 $opt_t= 0;
 $opt_a = "";
 
-$BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4" || $^O eq 'darwin';
-$LINUX = $^O eq 'linux';
+$BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4";
+$LINUX = $^O eq 'linux' || $^O eq 'darwin';
 $pscmd = $BSD ? "/bin/ps -auxww" : $LINUX ? "/bin/ps axuw" : "/bin/ps -ef";
 
 open(TTYIN, "</dev/tty") || die "can't read /dev/tty: $!";

=== modified file 'scripts/mysqld_multi.sh'
--- a/scripts/mysqld_multi.sh	2009-04-02 19:42:29 +0000
+++ b/scripts/mysqld_multi.sh	2009-04-28 18:28:03 +0000
@@ -316,11 +316,11 @@ sub start_mysqlds()
 	$tmp.= " $options[$j]";
       }
     }
-    if ($opt_verbose && $com =~ m/\/safe_mysqld$/ && !$info_sent)
+    if ($opt_verbose && $com =~ m/\/(safe_mysqld|mysqld_safe)$/ && !$info_sent)
     {
-      print "WARNING: safe_mysqld is being used to start mysqld. In this case you ";
+      print "WARNING: $1 is being used to start mysqld. In this case you ";
       print "may need to pass\n\"ledir=...\" under groups [mysqldN] to ";
-      print "safe_mysqld in order to find the actual mysqld binary.\n";
+      print "$1 in order to find the actual mysqld binary.\n";
       print "ledir (library executable directory) should be the path to the ";
       print "wanted mysqld binary.\n\n";
       $info_sent= 1;
@@ -670,9 +670,9 @@ language   = @datadir@/mysql/english
 user       = unix_user1
 
 [mysqld3]
-mysqld     = /path/to/safe_mysqld/safe_mysqld
+mysqld     = /path/to/mysqld_safe
 ledir      = /path/to/mysqld-binary/
-mysqladmin = /path/to/mysqladmin/mysqladmin
+mysqladmin = /path/to/mysqladmin
 socket     = /tmp/mysql.sock3
 port       = 3308
 pid-file   = @localstatedir@3/hostname.pid3

=== modified file 'scripts/mysqld_safe.sh'
--- a/scripts/mysqld_safe.sh	2009-03-16 19:28:06 +0000
+++ b/scripts/mysqld_safe.sh	2009-05-08 00:25:23 +0000
@@ -391,8 +391,8 @@ then
   fi
   # Change the err log to the right user, if it is in use
   if [ $want_syslog -eq 0 ]; then
-    touch $err_log
-    chown $user $err_log
+    touch "$err_log"
+    chown $user "$err_log"
   fi
   if test -n "$open_files"
   then
@@ -509,9 +509,9 @@ fi
 #
 # If there exists an old pid file, check if the daemon is already running
 # Note: The switches to 'ps' may depend on your operating system
-if test -f $pid_file
+if test -f "$pid_file"
 then
-  PID=`cat $pid_file`
+  PID=`cat "$pid_file"`
   if @CHECK_PID@
   then
     if @FIND_PROC@
@@ -520,8 +520,8 @@ then
       exit 1
     fi
   fi
-  rm -f $pid_file
-  if test -f $pid_file
+  rm -f "$pid_file"
+  if test -f "$pid_file"
   then
     log_error "Fatal error: Can't remove the pid file:
 $pid_file
@@ -563,11 +563,11 @@ test -n "$NOHUP_NICENESS" && cmd="$cmd <
 log_notice "Starting $MYSQLD daemon with databases from $DATADIR"
 while true
 do
-  rm -f $safe_mysql_unix_port $pid_file	# Some extra safety
+  rm -f $safe_mysql_unix_port "$pid_file"	# Some extra safety
 
   eval_log_error "$cmd"
 
-  if test ! -f $pid_file		# This is removed if normal shutdown
+  if test ! -f "$pid_file"		# This is removed if normal shutdown
   then
     break
   fi

=== modified file 'scripts/mysqldumpslow.sh'
--- a/scripts/mysqldumpslow.sh	2009-02-24 08:07:40 +0000
+++ b/scripts/mysqldumpslow.sh	2009-05-07 17:40:00 +0000
@@ -20,7 +20,7 @@ GetOptions(\%opt,
     'v|verbose+',# verbose
     'help+',	# write usage info
     'd|debug+',	# debug
-    's=s',	# what to sort by (t, at, l, al, r, ar etc)
+    's=s',	# what to sort by (al, at, ar, c, t, l, r)
     'r!',	# reverse the sort order (largest last instead of first)
     't=i',	# just show the top n queries
     'a!',	# don't abstract all numbers to N and strings to 'S'
@@ -163,7 +163,14 @@ Parse and summarize the MySQL slow query
 
   -v           verbose
   -d           debug
-  -s ORDER     what to sort by (t, at, l, al, r, ar etc), 'at' is default
+  -s ORDER     what to sort by (al, at, ar, c, l, r, t), 'at' is default
+                al: average lock time
+                ar: average rows sent
+                at: average query time
+                 c: count
+                 l: lock time
+                 r: rows sent
+                 t: query time  
   -r           reverse the sort order (largest last instead of first)
   -t NUM       just show the top n queries
   -a           don't abstract all numbers to N and strings to 'S'

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2008-12-10 20:14:50 +0000
+++ b/sql/handler.h	2009-05-04 10:00:15 +0000
@@ -876,9 +876,9 @@ typedef struct {
   ulonglong delete_length;
   ha_rows records;
   ulong mean_rec_length;
-  time_t create_time;
-  time_t check_time;
-  time_t update_time;
+  ulong create_time;
+  ulong check_time;
+  ulong update_time;
   ulonglong check_sum;
 } PARTITION_INFO;
 
@@ -1037,9 +1037,9 @@ public:
   ha_rows records;
   ha_rows deleted;			/* Deleted records */
   ulong mean_rec_length;		/* physical reclength */
-  time_t create_time;			/* When table was created */
-  time_t check_time;
-  time_t update_time;
+  ulong create_time;			/* When table was created */
+  ulong check_time;
+  ulong update_time;
   uint block_size;			/* index block size */
 
   ha_statistics():

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-04-28 00:27:38 +0000
+++ b/sql/item.cc	2009-05-04 20:33:23 +0000
@@ -3390,14 +3390,12 @@ static void mark_as_dependent(THD *thd, 
   current->mark_as_dependent(last);
   if (thd->lex->describe & DESCRIBE_EXTENDED)
   {
-    char warn_buff[MYSQL_ERRMSG_SIZE];
-    sprintf(warn_buff, ER(ER_WARN_FIELD_RESOLVED),
-            db_name, (db_name[0] ? "." : ""),
-            table_name, (table_name [0] ? "." : ""),
-            resolved_item->field_name,
-	    current->select_number, last->select_number);
-    push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
-		 ER_WARN_FIELD_RESOLVED, warn_buff);
+    push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+		 ER_WARN_FIELD_RESOLVED, ER(ER_WARN_FIELD_RESOLVED),
+                 db_name, (db_name[0] ? "." : ""),
+                 table_name, (table_name [0] ? "." : ""),
+                 resolved_item->field_name,
+                 current->select_number, last->select_number);
   }
 }
 

=== modified file 'sql/item_geofunc.cc'
--- a/sql/item_geofunc.cc	2007-12-20 21:11:37 +0000
+++ b/sql/item_geofunc.cc	2009-04-29 02:59:10 +0000
@@ -78,10 +78,17 @@ String *Item_func_geometry_from_wkb::val
 {
   DBUG_ASSERT(fixed == 1);
   String arg_val;
-  String *wkb= args[0]->val_str(&arg_val);
+  String *wkb;
   Geometry_buffer buffer;
   uint32 srid= 0;
 
+  if (args[0]->field_type() == MYSQL_TYPE_GEOMETRY)
+  {
+    return args[0]->val_str(str);
+  }
+
+  wkb= args[0]->val_str(&arg_val);
+
   if ((arg_count == 2) && !args[1]->null_value)
     srid= (uint32)args[1]->val_int();
 
@@ -91,8 +98,8 @@ String *Item_func_geometry_from_wkb::val
   str->length(0);
   str->q_append(srid);
   if ((null_value= 
-       (args[0]->null_value ||
-        !Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length(), str))))
+        (args[0]->null_value ||
+         !Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length(), str))))
     return 0;
   return str;
 }
@@ -345,14 +352,16 @@ String *Item_func_point::val_str(String 
   DBUG_ASSERT(fixed == 1);
   double x= args[0]->val_real();
   double y= args[1]->val_real();
+  uint32 srid= 0;
 
   if ((null_value= (args[0]->null_value ||
 		    args[1]->null_value ||
-		    str->realloc(1 + 4 + SIZEOF_STORED_DOUBLE*2))))
+                    str->realloc(4/*SRID*/ + 1 + 4 + SIZEOF_STORED_DOUBLE*2))))
     return 0;
 
   str->set_charset(&my_charset_bin);
   str->length(0);
+  str->q_append(srid);
   str->q_append((char)Geometry::wkb_ndr);
   str->q_append((uint32)Geometry::wkb_point);
   str->q_append(x);
@@ -376,12 +385,14 @@ String *Item_func_spatial_collection::va
   DBUG_ASSERT(fixed == 1);
   String arg_value;
   uint i;
+  uint32 srid= 0;
 
   str->set_charset(&my_charset_bin);
   str->length(0);
-  if (str->reserve(1 + 4 + 4, 512))
+  if (str->reserve(4/*SRID*/ + 1 + 4 + 4, 512))
     goto err;
 
+  str->q_append(srid);
   str->q_append((char) Geometry::wkb_ndr);
   str->q_append((uint32) coll_type);
   str->q_append((uint32) arg_count);
@@ -399,13 +410,13 @@ String *Item_func_spatial_collection::va
 	In the case of GeometryCollection we don't need any checkings
 	for item types, so just copy them into target collection
       */
-      if (str->append(res->ptr(), len, (uint32) 512))
+      if (str->append(res->ptr() + 4/*SRID*/, len - 4/*SRID*/, (uint32) 512))
         goto err;
     }
     else
     {
       enum Geometry::wkbType wkb_type;
-      const char *data= res->ptr() + 1;
+      const char *data= res->ptr() + 4/*SRID*/ + 1;
 
       /*
 	In the case of named collection we must check that items
@@ -414,7 +425,7 @@ String *Item_func_spatial_collection::va
 
       wkb_type= (Geometry::wkbType) uint4korr(data);
       data+= 4;
-      len-= 5;
+      len-= 5 + 4/*SRID*/;
       if (wkb_type != item_type)
         goto err;
 

=== modified file 'sql/rpl_filter.cc'
--- a/sql/rpl_filter.cc	2007-08-13 13:11:25 +0000
+++ b/sql/rpl_filter.cc	2009-04-29 02:59:10 +0000
@@ -340,8 +340,7 @@ Rpl_filter::add_wild_table_rule(DYNAMIC_
   e->tbl_name= e->db + (dot - table_spec) + 1;
   e->key_len= len;
   memcpy(e->db, table_spec, len);
-  insert_dynamic(a, (uchar*)&e);
-  return 0;
+  return insert_dynamic(a, (uchar*)&e);
 }
 
 

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2009-04-21 08:30:40 +0000
+++ b/sql/slave.cc	2009-05-04 09:59:10 +0000
@@ -143,8 +143,8 @@ static int get_master_version_and_clock(
 static Log_event* next_event(Relay_log_info* rli);
 static int queue_event(Master_info* mi,const char* buf,ulong event_len);
 static int terminate_slave_thread(THD *thd,
-                                  pthread_mutex_t* term_lock,
-                                  pthread_cond_t* term_cond,
+                                  pthread_mutex_t *term_lock,
+                                  pthread_cond_t *term_cond,
                                   volatile uint *slave_running,
                                   bool skip_lock);
 static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info);
@@ -399,24 +399,24 @@ int terminate_slave_threads(Master_info*
   int error,force_all = (thread_mask & SLAVE_FORCE_ALL);
   pthread_mutex_t *sql_lock = &mi->rli.run_lock, *io_lock = &mi->run_lock;
 
-  if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)))
+  if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL))
   {
     DBUG_PRINT("info",("Terminating IO thread"));
     mi->abort_slave=1;
-    if ((error=terminate_slave_thread(mi->io_thd,io_lock,
-                                      &mi->stop_cond,
-                                      &mi->slave_running,
+    if ((error=terminate_slave_thread(mi->io_thd, io_lock,
+				      &mi->stop_cond,
+				      &mi->slave_running,
                                       skip_lock)) &&
         !force_all)
       DBUG_RETURN(error);
   }
-  if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)))
+  if (thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL))
   {
     DBUG_PRINT("info",("Terminating SQL thread"));
     mi->rli.abort_slave=1;
-    if ((error=terminate_slave_thread(mi->rli.sql_thd,sql_lock,
-                                      &mi->rli.stop_cond,
-                                      &mi->rli.slave_running,
+    if ((error=terminate_slave_thread(mi->rli.sql_thd, sql_lock,
+				      &mi->rli.stop_cond,
+				      &mi->rli.slave_running,
                                       skip_lock)) &&
         !force_all)
       DBUG_RETURN(error);
@@ -424,7 +424,6 @@ int terminate_slave_threads(Master_info*
   DBUG_RETURN(0);
 }
 
-
 /**
    Wait for a slave thread to terminate.
 
@@ -452,29 +451,44 @@ int terminate_slave_threads(Master_info*
           the condition. In this case, it is assumed that the calling
           function acquires the lock before calling this function.
 
-   @retval 0 All OK
+   @retval 0 All OK ER_SLAVE_NOT_RUNNING otherwise.
+
+   @note  If the executing thread has to acquire term_lock (skip_lock
+          is false), the negative running status does not represent
+          any issue therefore no error is reported.
+
  */
 static int
 terminate_slave_thread(THD *thd,
-                       pthread_mutex_t* term_lock,
-                       pthread_cond_t* term_cond,
+                       pthread_mutex_t *term_lock,
+                       pthread_cond_t *term_cond,
                        volatile uint *slave_running,
                        bool skip_lock)
 {
-  int error;
-
   DBUG_ENTER("terminate_slave_thread");
-
   if (!skip_lock)
+  {
     pthread_mutex_lock(term_lock);
-
-  safe_mutex_assert_owner(term_lock);
-
+  }
+  else
+  {
+    safe_mutex_assert_owner(term_lock);
+  }
   if (!*slave_running)
   {
     if (!skip_lock)
+    {
+      /*
+        if run_lock (term_lock) is acquired locally then either
+        slave_running status is fine
+      */
       pthread_mutex_unlock(term_lock);
-    DBUG_RETURN(ER_SLAVE_NOT_RUNNING);
+      DBUG_RETURN(0);
+    }
+    else
+    {
+      DBUG_RETURN(ER_SLAVE_NOT_RUNNING);
+    }
   }
   DBUG_ASSERT(thd != 0);
   THD_CHECK_SENTRY(thd);
@@ -486,6 +500,7 @@ terminate_slave_thread(THD *thd,
 
   while (*slave_running)                        // Should always be true
   {
+    int error;
     DBUG_PRINT("loop", ("killing slave thread"));
 
     pthread_mutex_lock(&thd->LOCK_delete);
@@ -627,7 +642,7 @@ int start_slave_threads(bool need_slave_
                              &mi->rli.slave_running, &mi->rli.slave_run_id,
                              mi, 0);
     if (error)
-      terminate_slave_threads(mi, thread_mask & SLAVE_IO, 0);
+      terminate_slave_threads(mi, thread_mask & SLAVE_IO, !need_slave_mutex);
   }
   DBUG_RETURN(error);
 }
@@ -2640,6 +2655,7 @@ err:
     delete the mi structure leading to a crash! (see BUG#25306 for details)
    */ 
   pthread_cond_broadcast(&mi->stop_cond);       // tell the world we are done
+  DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
   pthread_mutex_unlock(&mi->run_lock);
   my_thread_end();
   pthread_exit(0);
@@ -2989,6 +3005,7 @@ the slave SQL thread with \"SLAVE START\
   delete the mi structure leading to a crash! (see BUG#25306 for details)
  */ 
   pthread_cond_broadcast(&rli->stop_cond);
+  DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
   pthread_mutex_unlock(&rli->run_lock);  // tell the world we are done
   
   my_thread_end();

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2009-04-08 23:58:57 +0000
+++ b/sql/sp_head.cc	2009-04-30 09:37:29 +0000
@@ -207,6 +207,7 @@ sp_get_flags_for_command(LEX *lex)
   case SQLCOM_SHOW_STATUS_PROC:
   case SQLCOM_SHOW_STORAGE_ENGINES:
   case SQLCOM_SHOW_TABLES:
+  case SQLCOM_SHOW_TABLE_STATUS:
   case SQLCOM_SHOW_VARIABLES:
   case SQLCOM_SHOW_WARNS:
   case SQLCOM_REPAIR:
@@ -2132,17 +2133,16 @@ sp_head::restore_lex(THD *thd)
 /**
   Put the instruction on the backpatch list, associated with the label.
 */
-void
+int
 sp_head::push_backpatch(sp_instr *i, sp_label_t *lab)
 {
   bp_t *bp= (bp_t *)sql_alloc(sizeof(bp_t));
 
-  if (bp)
-  {
-    bp->lab= lab;
-    bp->instr= i;
-    (void)m_backpatch.push_front(bp);
-  }
+  if (!bp)
+    return 1;
+  bp->lab= lab;
+  bp->instr= i;
+  return m_backpatch.push_front(bp);
 }
 
 /**
@@ -2217,7 +2217,7 @@ sp_head::fill_field_definition(THD *thd,
 }
 
 
-void
+int
 sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
 {
   m_cont_level+= 1;
@@ -2225,15 +2225,17 @@ sp_head::new_cont_backpatch(sp_instr_opt
   {
     /* Use the cont. destination slot to store the level */
     i->m_cont_dest= m_cont_level;
-    (void)m_cont_backpatch.push_front(i);
+    if (m_cont_backpatch.push_front(i))
+      return 1;
   }
+  return 0;
 }
 
-void
+int
 sp_head::add_cont_backpatch(sp_instr_opt_meta *i)
 {
   i->m_cont_dest= m_cont_level;
-  (void)m_cont_backpatch.push_front(i);
+  return m_cont_backpatch.push_front(i);
 }
 
 void
@@ -2469,7 +2471,7 @@ sp_head::show_create_routine(THD *thd, i
   @param instr   Instruction
 */
 
-void sp_head::add_instr(sp_instr *instr)
+int sp_head::add_instr(sp_instr *instr)
 {
   instr->free_list= m_thd->free_list;
   m_thd->free_list= 0;
@@ -2480,7 +2482,7 @@ void sp_head::add_instr(sp_instr *instr)
     entire stored procedure, as their life span is equal.
   */
   instr->mem_root= &main_mem_root;
-  insert_dynamic(&m_instr, (uchar*)&instr);
+  return insert_dynamic(&m_instr, (uchar*)&instr);
 }
 
 

=== modified file 'sql/sp_head.h'
--- a/sql/sp_head.h	2009-02-13 16:41:47 +0000
+++ b/sql/sp_head.h	2009-04-29 02:59:10 +0000
@@ -308,7 +308,7 @@ public:
   bool
   show_create_routine(THD *thd, int type);
 
-  void
+  int
   add_instr(sp_instr *instr);
 
   inline uint
@@ -344,7 +344,7 @@ public:
   restore_lex(THD *thd);
 
   /// Put the instruction on the backpatch list, associated with the label.
-  void
+  int
   push_backpatch(sp_instr *, struct sp_label *);
 
   /// Update all instruction with this label in the backpatch list to
@@ -353,11 +353,11 @@ public:
   backpatch(struct sp_label *);
 
   /// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr.
-  void
+  int
   new_cont_backpatch(sp_instr_opt_meta *i);
 
   /// Add an instruction to the current level
-  void
+  int
   add_cont_backpatch(sp_instr_opt_meta *i);
 
   /// Backpatch (and pop) the current level to the current position.

=== modified file 'sql/sp_pcontext.cc'
--- a/sql/sp_pcontext.cc	2008-03-21 18:08:04 +0000
+++ b/sql/sp_pcontext.cc	2009-04-29 02:59:10 +0000
@@ -265,8 +265,8 @@ sp_pcontext::push_variable(LEX_STRING *n
   p->mode= mode;
   p->offset= current_var_count();
   p->dflt= NULL;
-  insert_dynamic(&m_vars, (uchar*)&p);
-
+  if (insert_dynamic(&m_vars, (uchar*)&p))
+    return NULL;
   return p;
 }
 
@@ -310,18 +310,17 @@ sp_pcontext::find_label(char *name)
   return NULL;
 }
 
-void
+int
 sp_pcontext::push_cond(LEX_STRING *name, sp_cond_type_t *val)
 {
   sp_cond_t *p= (sp_cond_t *)sql_alloc(sizeof(sp_cond_t));
 
-  if (p)
-  {
-    p->name.str= name->str;
-    p->name.length= name->length;
-    p->val= val;
-    insert_dynamic(&m_conds, (uchar*)&p);
-  }
+  if (p == NULL)
+    return 1;
+  p->name.str= name->str;
+  p->name.length= name->length;
+  p->val= val;
+  return insert_dynamic(&m_conds, (uchar *)&p);
 }
 
 /*
@@ -384,7 +383,7 @@ sp_pcontext::find_handler(sp_cond_type_t
   return FALSE;
 }
 
-void
+int
 sp_pcontext::push_cursor(LEX_STRING *name)
 {
   LEX_STRING n;
@@ -393,7 +392,7 @@ sp_pcontext::push_cursor(LEX_STRING *nam
     m_max_cursor_index+= 1;
   n.str= name->str;
   n.length= name->length;
-  insert_dynamic(&m_cursors, (uchar*)&n);
+  return insert_dynamic(&m_cursors, (uchar *)&n);
 }
 
 /*

=== modified file 'sql/sp_pcontext.h'
--- a/sql/sp_pcontext.h	2007-06-10 10:43:57 +0000
+++ b/sql/sp_pcontext.h	2009-04-29 02:59:10 +0000
@@ -323,7 +323,7 @@ public:
   // Conditions
   //
 
-  void
+  int
   push_cond(LEX_STRING *name, sp_cond_type_t *val);
 
   inline void
@@ -365,7 +365,7 @@ public:
   // Cursors
   //
 
-  void
+  int
   push_cursor(LEX_STRING *name);
 
   my_bool

=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2009-02-13 16:41:47 +0000
+++ b/sql/sql_repl.cc	2009-04-30 12:28:07 +0000
@@ -1026,7 +1026,10 @@ int reset_slave(THD *thd, Master_info* m
   if ((error= purge_relay_logs(&mi->rli, thd,
 			       1 /* just reset */,
 			       &errmsg)))
+  {
+    sql_errno= ER_RELAY_LOG_FAIL;
     goto err;
+  }
 
   /*
     Clear master's log coordinates and reset host/user/etc to the values

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-04-01 11:10:03 +0000
+++ b/sql/sql_select.cc	2009-05-04 12:57:42 +0000
@@ -2248,6 +2248,14 @@ JOIN::destroy()
   cond_equal= 0;
 
   cleanup(1);
+ /* Cleanup items referencing temporary table columns */
+  if (!tmp_all_fields3.is_empty())
+  {
+    List_iterator_fast<Item> it(tmp_all_fields3);
+    Item *item;
+    while ((item= it++))
+      item->cleanup();
+  }
   if (exec_tmp_table1)
     free_tmp_table(thd, exec_tmp_table1);
   if (exec_tmp_table2)
@@ -3476,14 +3484,6 @@ add_key_fields(JOIN *join, KEY_FIELD **k
   }
 }
 
-/**
-  Add all keys with uses 'field' for some keypart.
-
-  If field->and_level != and_level then only mark key_part as const_part.
-
-  @todo
-    ft-keys in non-ft queries.   SerG
-*/
 
 static uint
 max_part_bit(key_part_map bits)
@@ -3493,7 +3493,16 @@ max_part_bit(key_part_map bits)
   return found;
 }
 
-static void
+/*
+  Add all keys with uses 'field' for some keypart
+  If field->and_level != and_level then only mark key_part as const_part
+
+  RETURN 
+   0 - OK
+   1 - Out of memory.
+*/
+
+static bool
 add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field)
 {
   Field *field=key_field->field;
@@ -3523,24 +3532,26 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array
 	  keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL;
           keyuse.null_rejecting= key_field->null_rejecting;
           keyuse.cond_guard= key_field->cond_guard;
-	  VOID(insert_dynamic(keyuse_array,(uchar*) &keyuse));
+	  if (insert_dynamic(keyuse_array,(uchar*) &keyuse))
+            return TRUE;
 	}
       }
     }
   }
+  return FALSE;
 }
 
 
 #define FT_KEYPART   (MAX_REF_PARTS+10)
 
-static void
+static bool
 add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
             JOIN_TAB *stat,COND *cond,table_map usable_tables)
 {
   Item_func_match *cond_func=NULL;
 
   if (!cond)
-    return;
+    return FALSE;
 
   if (cond->type() == Item::FUNC_ITEM)
   {
@@ -3574,13 +3585,16 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
     {
       Item *item;
       while ((item=li++))
-        add_ft_keys(keyuse_array,stat,item,usable_tables);
+      {
+        if (add_ft_keys(keyuse_array,stat,item,usable_tables))
+          return TRUE;
+      }
     }
   }
 
   if (!cond_func || cond_func->key == NO_SUCH_KEY ||
       !(usable_tables & cond_func->table->map))
-    return;
+    return FALSE;
 
   KEYUSE keyuse;
   keyuse.table= cond_func->table;
@@ -3590,7 +3604,7 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
   keyuse.used_tables=cond_func->key_item()->used_tables();
   keyuse.optimize= 0;
   keyuse.keypart_map= 0;
-  VOID(insert_dynamic(keyuse_array,(uchar*) &keyuse));
+  return insert_dynamic(keyuse_array,(uchar*) &keyuse);
 }
 
 
@@ -3744,7 +3758,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
                    sargables);
     for (; field != end ; field++)
     {
-      add_key_part(keyuse,field);
+      if (add_key_part(keyuse,field))
+        return TRUE;
       /* Mark that we can optimize LEFT JOIN */
       if (field->val->type() == Item::NULL_ITEM &&
 	  !field->field->real_maybe_null())
@@ -3782,11 +3797,15 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
 
   /* fill keyuse with found key parts */
   for ( ; field != end ; field++)
-    add_key_part(keyuse,field);
+  {
+    if (add_key_part(keyuse,field))
+      return TRUE;
+  }
 
   if (select_lex->ftfunc_list->elements)
   {
-    add_ft_keys(keyuse,join_tab,cond,normal_tables);
+    if (add_ft_keys(keyuse,join_tab,cond,normal_tables))
+      return TRUE;
   }
 
   /*
@@ -3807,7 +3826,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
 	  (qsort_cmp) sort_keyuse);
 
     bzero((char*) &key_end,sizeof(key_end));    /* Add for easy testing */
-    VOID(insert_dynamic(keyuse,(uchar*) &key_end));
+    if (insert_dynamic(keyuse,(uchar*) &key_end))
+      return TRUE;
 
     use=save_pos=dynamic_element(keyuse,0,KEYUSE*);
     prev= &key_end;
@@ -7072,15 +7092,17 @@ return_zero_rows(JOIN *join, select_resu
   if (!(result->send_fields(fields,
                               Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)))
   {
+    bool send_error= FALSE;
     if (send_row)
     {
       List_iterator_fast<Item> it(fields);
       Item *item;
       while ((item= it++))
 	item->no_rows_in_result();
-      result->send_data(fields);
+      send_error= result->send_data(fields);
     }
-    result->send_eof();				// Should be safe
+    if (!send_error)
+      result->send_eof();				// Should be safe
   }
   /* Update results for FOUND_ROWS */
   join->thd->limit_found_rows= join->thd->examined_row_count= 0;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2009-04-23 17:55:32 +0000
+++ b/sql/sql_table.cc	2009-05-04 20:33:23 +0000
@@ -3126,7 +3126,7 @@ static bool prepare_blob_field(THD *thd,
     }
     sql_field->sql_type= MYSQL_TYPE_BLOB;
     sql_field->flags|= BLOB_FLAG;
-    sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name,
+    my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_AUTO_CONVERT), sql_field->field_name,
             (sql_field->charset == &my_charset_bin) ? "VARBINARY" : "VARCHAR",
             (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT");
     push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT,

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2009-04-08 23:42:51 +0000
+++ b/sql/sql_update.cc	2009-05-04 20:33:23 +0000
@@ -818,7 +818,7 @@ int mysql_update(THD *thd,
   if (error < 0)
   {
     char buff[STRING_BUFFER_USUAL_SIZE];
-    sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
+    my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
 	    (ulong) thd->cuted_fields);
     thd->row_count_func=
       (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
@@ -2066,8 +2066,8 @@ bool multi_update::send_eof()
 
   id= thd->arg_of_last_insert_id_function ?
     thd->first_successful_insert_id_in_prev_stmt : 0;
-  sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
-	  (ulong) thd->cuted_fields);
+  my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO),
+              (ulong) found, (ulong) updated, (ulong) thd->cuted_fields);
   thd->row_count_func=
     (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
   ::my_ok(thd, (ulong) thd->row_count_func, id, buff);

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2009-04-03 19:46:00 +0000
+++ b/sql/sql_yacc.yy	2009-04-29 02:59:10 +0000
@@ -280,9 +280,7 @@ int case_stmt_action_expr(LEX *lex, Item
                                 parsing_ctx, case_expr_id, expr, lex);
 
   sp->add_cont_backpatch(i);
-  sp->add_instr(i);
-
-  return 0;
+  return sp->add_instr(i);
 }
 
 /**
@@ -293,7 +291,7 @@ int case_stmt_action_expr(LEX *lex, Item
   @param simple true for simple cases, false for searched cases
 */
 
-void case_stmt_action_when(LEX *lex, Item *when, bool simple)
+int case_stmt_action_when(LEX *lex, Item *when, bool simple)
 {
   sp_head *sp= lex->sphead;
   sp_pcontext *ctx= lex->spcont;
@@ -325,9 +323,10 @@ void case_stmt_action_when(LEX *lex, Ite
     (jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
   */
 
-  sp->push_backpatch(i, ctx->push_label((char *)"", 0));
-  sp->add_cont_backpatch(i);
-  sp->add_instr(i);
+  return !test(i) ||
+         sp->push_backpatch(i, ctx->push_label((char *)"", 0)) ||
+         sp->add_cont_backpatch(i) ||
+         sp->add_instr(i);
 }
 
 /**
@@ -336,13 +335,14 @@ void case_stmt_action_when(LEX *lex, Ite
   @param lex the parser lex context
 */
 
-void case_stmt_action_then(LEX *lex)
+int case_stmt_action_then(LEX *lex)
 {
   sp_head *sp= lex->sphead;
   sp_pcontext *ctx= lex->spcont;
   uint ip= sp->instructions();
   sp_instr_jump *i = new sp_instr_jump(ip, ctx);
-  sp->add_instr(i);
+  if (!test(i) || sp->add_instr(i))
+    return 1;
 
   /*
     BACKPATCH: Resolving forward jump from
@@ -358,7 +358,7 @@ void case_stmt_action_then(LEX *lex)
     (jump from instruction 4 to 12, 7 to 12 ... in the example)
   */
 
-  sp->push_backpatch(i, ctx->last_label());
+  return sp->push_backpatch(i, ctx->last_label());
 }
 
 /**
@@ -2322,10 +2322,9 @@ sp_decl:
                                                  var_type,
                                                  lex,
                                                  (i == num_vars - 1));
-              if (is == NULL)
+              if (is == NULL ||
+                  lex->sphead->add_instr(is))
                 MYSQL_YYABORT;
-
-              lex->sphead->add_instr(is);
             }
 
             pctx->declare_var_boundary(0);
@@ -2339,12 +2338,13 @@ sp_decl:
             LEX *lex= Lex;
             sp_pcontext *spc= lex->spcont;
 
-            if (spc->find_cond(&$2, TRUE))
-            {
-              my_error(ER_SP_DUP_COND, MYF(0), $2.str);
+	    if (spc->find_cond(&$2, TRUE))
+	    {
+	      my_error(ER_SP_DUP_COND, MYF(0), $2.str);
+	      MYSQL_YYABORT;
+	    }
+	    if(YYTHD->lex->spcont->push_cond(&$2, $5))
               MYSQL_YYABORT;
-            }
-            YYTHD->lex->spcont->push_cond(&$2, $5);
             $$.vars= $$.hndlrs= $$.curs= 0;
             $$.conds= 1;
           }
@@ -2358,11 +2358,11 @@ sp_decl:
             sp_pcontext *ctx= lex->spcont;
             sp_instr_hpush_jump *i=
               new sp_instr_hpush_jump(sp->instructions(), ctx, $2,
-                                      ctx->current_var_count());
-            if (i == NULL)
+	                              ctx->current_var_count());
+            if (i == NULL ||
+	        sp->add_instr(i) ||
+                sp->push_backpatch(i, ctx->push_label((char *)"", 0)))
               MYSQL_YYABORT;
-            sp->add_instr(i);
-            sp->push_backpatch(i, ctx->push_label((char *)"", 0));
           }
           sp_hcond_list sp_proc_stmt
           {
@@ -2376,17 +2376,17 @@ sp_decl:
             {
               i= new sp_instr_hreturn(sp->instructions(), ctx,
                                       ctx->current_var_count());
-              if (i == NULL)
+              if (i == NULL ||
+	          sp->add_instr(i))
                 MYSQL_YYABORT;
-              sp->add_instr(i);
             }
             else
             {  /* EXIT or UNDO handler, just jump to the end of the block */
               i= new sp_instr_hreturn(sp->instructions(), ctx, 0);
-              if (i == NULL)
+              if (i == NULL ||
+	          sp->add_instr(i) ||
+	          sp->push_backpatch(i, lex->spcont->last_label())) /* Block end */
                 MYSQL_YYABORT;
-              sp->add_instr(i);
-              sp->push_backpatch(i, lex->spcont->last_label()); /* Block end */
             }
             lex->sphead->backpatch(hlab);
 
@@ -2412,10 +2412,10 @@ sp_decl:
             }
             i= new sp_instr_cpush(sp->instructions(), ctx, $5,
                                   ctx->current_cursor_count());
-            if (i == NULL)
+	    if (i == NULL ||
+                sp->add_instr(i) ||
+	        ctx->push_cursor(&$2))
               MYSQL_YYABORT;
-            sp->add_instr(i);
-            ctx->push_cursor(&$2);
             $$.vars= $$.conds= $$.hndlrs= 0;
             $$.curs= 1;
           }
@@ -2652,10 +2652,11 @@ sp_proc_stmt_statement:
                 i->m_query.length= lip->get_ptr() - sp->m_tmp_query;
               else
                 i->m_query.length= lip->get_tok_end() - sp->m_tmp_query;
-              i->m_query.str= strmake_root(thd->mem_root,
-                                           sp->m_tmp_query,
-                                           i->m_query.length);
-              sp->add_instr(i);
+              if (!(i->m_query.str= strmake_root(thd->mem_root,
+                                                 sp->m_tmp_query,
+                                                 i->m_query.length)) ||
+                    sp->add_instr(i))
+                MYSQL_YYABORT;
             }
             sp->restore_lex(thd);
           }
@@ -2680,9 +2681,9 @@ sp_proc_stmt_return:
 
               i= new sp_instr_freturn(sp->instructions(), lex->spcont, $3,
                                       sp->m_return_field_def.sql_type, lex);
-              if (i == NULL)
+              if (i == NULL ||
+	          sp->add_instr(i))
                 MYSQL_YYABORT;
-              sp->add_instr(i);
               sp->m_flags|= sp_head::HAS_RETURN;
             }
             sp->restore_lex(YYTHD);
@@ -2779,22 +2780,22 @@ sp_proc_stmt_iterate:
               if (n)
               {
                 sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n);
-                if (hpop == NULL)
+                if (hpop == NULL ||
+                    sp->add_instr(hpop))
                   MYSQL_YYABORT;
-                sp->add_instr(hpop);
               }
               n= ctx->diff_cursors(lab->ctx, FALSE);  /* Inclusive the dest. */
               if (n)
               {
                 sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n);
-                if (cpop == NULL)
+                if (cpop == NULL ||
+                    sp->add_instr(cpop))
                   MYSQL_YYABORT;
-                sp->add_instr(cpop);
               }
               i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
-              if (i == NULL)
+              if (i == NULL ||
+                  sp->add_instr(i))
                 MYSQL_YYABORT;
-              sp->add_instr(i);
             }
           }
         ;
@@ -2813,9 +2814,9 @@ sp_proc_stmt_open:
               MYSQL_YYABORT;
             }
             i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
-            if (i == NULL)
+            if (i == NULL ||
+                sp->add_instr(i))
               MYSQL_YYABORT;
-            sp->add_instr(i);
           }
         ;
 
@@ -2833,9 +2834,9 @@ sp_proc_stmt_fetch:
               MYSQL_YYABORT;
             }
             i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
-            if (i == NULL)
+            if (i == NULL ||
+                sp->add_instr(i))
               MYSQL_YYABORT;
-            sp->add_instr(i);
           }
           sp_fetch_list
           {}
@@ -2855,9 +2856,9 @@ sp_proc_stmt_close:
               MYSQL_YYABORT;
             }
             i= new sp_instr_cclose(sp->instructions(), lex->spcont,  offset);
-            if (i == NULL)
+            if (i == NULL ||
+                sp->add_instr(i))
               MYSQL_YYABORT;
-            sp->add_instr(i);
           }
         ;
 
@@ -2920,12 +2921,11 @@ sp_if:
             uint ip= sp->instructions();
             sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, ctx,
                                                                $2, lex);
-            if (i == NULL)
+            if (i == NULL ||
+	        sp->push_backpatch(i, ctx->push_label((char *)"", 0)) ||
+                sp->add_cont_backpatch(i) ||
+                sp->add_instr(i))
               MYSQL_YYABORT;
-
-            sp->push_backpatch(i, ctx->push_label((char *)"", 0));
-            sp->add_cont_backpatch(i);
-            sp->add_instr(i);
             sp->restore_lex(YYTHD);
           }
           sp_proc_stmts1
@@ -2934,10 +2934,9 @@ sp_if:
             sp_pcontext *ctx= Lex->spcont;
             uint ip= sp->instructions();
             sp_instr_jump *i = new sp_instr_jump(ip, ctx);
-            if (i == NULL)
+            if (i == NULL ||
+                sp->add_instr(i))
               MYSQL_YYABORT;
-
-            sp->add_instr(i);
             sp->backpatch(ctx->pop_label());
             sp->push_backpatch(i, ctx->push_label((char *)"", 0));
           }
@@ -3021,14 +3020,16 @@ simple_when_clause:
             /* Simple case: <caseval> = <whenval> */
 
             LEX *lex= Lex;
-            case_stmt_action_when(lex, $3, true);
+            if (case_stmt_action_when(lex, $3, true))
+              MYSQL_YYABORT;
             lex->sphead->restore_lex(YYTHD); /* For expr $3 */
           }
           THEN_SYM
           sp_proc_stmts1
           {
             LEX *lex= Lex;
-            case_stmt_action_then(lex);
+            if (case_stmt_action_then(lex))
+              MYSQL_YYABORT;
           }
         ;
 
@@ -3040,14 +3041,16 @@ searched_when_clause:
           expr
           {
             LEX *lex= Lex;
-            case_stmt_action_when(lex, $3, false);
+            if (case_stmt_action_when(lex, $3, false))
+              MYSQL_YYABORT;
             lex->sphead->restore_lex(YYTHD); /* For expr $3 */
           }
           THEN_SYM
           sp_proc_stmts1
           {
             LEX *lex= Lex;
-            case_stmt_action_then(lex);
+            if (case_stmt_action_then(lex))
+              MYSQL_YYABORT;
           }
         ;
 
@@ -3059,9 +3062,9 @@ else_clause_opt:
             uint ip= sp->instructions();
             sp_instr_error *i= new sp_instr_error(ip, lex->spcont,
                                                   ER_SP_CASE_NOT_FOUND);
-            if (i == NULL)
+            if (i == NULL ||
+                sp->add_instr(i))
               MYSQL_YYABORT;
-            sp->add_instr(i);
           }
         | ELSE sp_proc_stmts1
         ;
@@ -3175,16 +3178,16 @@ sp_block_content:
             if ($3.hndlrs)
             {
               i= new sp_instr_hpop(sp->instructions(), ctx, $3.hndlrs);
-              if (i == NULL)
+              if (i == NULL ||
+                  sp->add_instr(i))
                 MYSQL_YYABORT;
-              sp->add_instr(i);
             }
             if ($3.curs)
             {
               i= new sp_instr_cpop(sp->instructions(), ctx, $3.curs);
-              if (i == NULL)
+              if (i == NULL ||
+                  sp->add_instr(i))
                 MYSQL_YYABORT;
-              sp->add_instr(i);
             }
             lex->spcont= ctx->pop_context();
           }
@@ -3198,10 +3201,10 @@ sp_unlabeled_control:
             uint ip= lex->sphead->instructions();
             sp_label_t *lab= lex->spcont->last_label();  /* Jumping back */
             sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
-            if (i == NULL)
+            if (i == NULL ||
+                lex->sphead->add_instr(i))
               MYSQL_YYABORT;
-            lex->sphead->add_instr(i);
-          }
+	  }
         | WHILE_SYM 
           { Lex->sphead->reset_lex(YYTHD); }
           expr DO_SYM
@@ -3211,12 +3214,12 @@ sp_unlabeled_control:
             uint ip= sp->instructions();
             sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont,
                                                                $3, lex);
-            if (i == NULL)
+            if (i == NULL ||
+	    /* Jumping forward */
+                sp->push_backpatch(i, lex->spcont->last_label()) ||
+                sp->new_cont_backpatch(i) ||
+                sp->add_instr(i))
               MYSQL_YYABORT;
-            /* Jumping forward */
-            sp->push_backpatch(i, lex->spcont->last_label());
-            sp->new_cont_backpatch(i);
-            sp->add_instr(i);
             sp->restore_lex(YYTHD);
           }
           sp_proc_stmts1 END WHILE_SYM
@@ -3225,9 +3228,9 @@ sp_unlabeled_control:
             uint ip= lex->sphead->instructions();
             sp_label_t *lab= lex->spcont->last_label();  /* Jumping back */
             sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
-            if (i == NULL)
+            if (i == NULL ||
+                lex->sphead->add_instr(i))
               MYSQL_YYABORT;
-            lex->sphead->add_instr(i);
             lex->sphead->do_cont_backpatch();
           }
         | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM 
@@ -3240,9 +3243,9 @@ sp_unlabeled_control:
             sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont,
                                                                $5, lab->ip,
                                                                lex);
-            if (i == NULL)
+            if (i == NULL ||
+                lex->sphead->add_instr(i))
               MYSQL_YYABORT;
-            lex->sphead->add_instr(i);
             lex->sphead->restore_lex(YYTHD);
             /* We can shortcut the cont_backpatch here */
             i->m_cont_dest= ip+1;
@@ -11751,7 +11754,8 @@ option_type_value:
                         qbuff.length);
                 qbuff.length+= 4;
                 i->m_query= qbuff;
-                sp->add_instr(i);
+                if (sp->add_instr(i))
+                  MYSQL_YYABORT;
               }
               lex->sphead->restore_lex(thd);
             }
@@ -11843,7 +11847,8 @@ sys_option_value:
                                                  (uchar **) &trg_fld->
                                                    next_trg_field);
 
-              lex->sphead->add_instr(sp_fld);
+              if (lex->sphead->add_instr(sp_fld))
+                MYSQL_YYABORT;
             }
             else if ($2.var)
             { /* System variable */
@@ -11882,9 +11887,9 @@ sys_option_value:
               }
               sp_set= new sp_instr_set(lex->sphead->instructions(), ctx,
                                        spv->offset, it, spv->type, lex, TRUE);
-              if (sp_set == NULL)
+              if (sp_set == NULL ||
+                  lex->sphead->add_instr(sp_set))
                 MYSQL_YYABORT;
-              lex->sphead->add_instr(sp_set);
             }
           }
         | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types

=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc	2009-03-17 20:29:24 +0000
+++ b/sql/unireg.cc	2009-05-04 20:33:23 +0000
@@ -37,8 +37,7 @@ static bool pack_header(uchar *forminfo,
 			List<Create_field> &create_fields,
 			uint info_length, uint screens, uint table_options,
 			ulong data_offset, handler *file);
-static uint get_interval_id(uint *int_count,List<Create_field> &create_fields,
-			    Create_field *last_field);
+static uint get_interval_id(uint *,List<Create_field> &, Create_field *);
 static bool pack_fields(File file, List<Create_field> &create_fields,
                         ulong data_offset);
 static bool make_empty_rec(THD *thd, int file, enum legacy_db_type table_type,

=== modified file 'storage/ibmdb2i/Makefile.am'
--- a/storage/ibmdb2i/Makefile.am	2009-02-15 02:18:30 +0000
+++ b/storage/ibmdb2i/Makefile.am	2009-04-01 20:18:49 +0000
@@ -27,6 +27,7 @@ DEFS =                  @DEFS@
 noinst_HEADERS =	ha_ibmdb2i.h db2i_collationSupport.h db2i_file.h \
 			db2i_ioBuffers.h db2i_blobCollection.h \
 			db2i_global.h db2i_misc.h db2i_charsetSupport.h db2i_errors.h \
+			db2i_iconv.h db2i_myconv.h db2i_safeString.h db2i_sqlStatementStream.h \
 			db2i_ileBridge.h db2i_validatedPointer.h
 
 EXTRA_LTLIBRARIES =	ha_ibmdb2i.la

=== modified file 'storage/ibmdb2i/db2i_charsetSupport.cc'
--- a/storage/ibmdb2i/db2i_charsetSupport.cc	2009-03-09 21:20:14 +0000
+++ b/storage/ibmdb2i/db2i_charsetSupport.cc	2009-05-05 09:33:52 +0000
@@ -268,8 +268,15 @@ static int32 getNewTextDesc(const int32 
       RESULT_INT32);
   if (unlikely(arguments->base.result.s_int32.r_int32 < 0))
   {
-     getErrTxt(DB2I_ERR_ILECALL,"QlgCvtTextDescToDesc",arguments->base.result.s_int32.r_int32);
-     DBUG_RETURN(DB2I_ERR_ILECALL);
+    if (arguments->base.result.s_int32.r_int32 == Qlg_InDescriptorNotFound)
+    {
+      DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET);
+    }
+    else
+    {
+      getErrTxt(DB2I_ERR_ILECALL,"QlgCvtTextDescToDesc",arguments->base.result.s_int32.r_int32);
+      DBUG_RETURN(DB2I_ERR_ILECALL);
+    }
   }
   
   // Store the conversion information into a cache entry
@@ -428,8 +435,13 @@ int32 convertIANAToDb2Ccsid(const char* 
   int aixEncodingScheme;
   int db2EncodingScheme;
   rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAS400CCSID, parmIANADesc, aixCcsidString);
-  if (rc != 0)
+  if (unlikely(rc))
+  {
+    if (rc == DB2I_ERR_UNSUPP_CHARSET)
+      getErrTxt(DB2I_ERR_UNSUPP_CHARSET, parmIANADesc);
+    
     return rc;
+  }
   aixCcsid = atoi(aixCcsidString);
   rc = getEncodingScheme(aixCcsid, aixEncodingScheme);     
   if (rc != 0) 
@@ -646,32 +658,38 @@ static int32 openNewConversion(enum_conv
      there equivalent iconv descriptions.
   */
   rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAix41, mysqlCSName, mysqlAix41Desc);
-  if (rc)
+  if (unlikely(rc))
+  {
+    if (rc == DB2I_ERR_UNSUPP_CHARSET)
+      getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
+    
     DBUG_RETURN(rc);
+  }
   CHARSET_INFO *cs= &my_charset_bin;
   (uint)(cs->cset->long10_to_str)(cs,db2CcsidString,sizeof(db2CcsidString), 10, db2CCSID);  
   rc = convertTextDesc(Qlg_TypeAS400CCSID, Qlg_TypeAix41, db2CcsidString, db2Aix41Desc);
-  if (rc)
-      DBUG_RETURN(rc);
+  if (unlikely(rc))
+  {
+    if (rc == DB2I_ERR_UNSUPP_CHARSET)
+      getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
+    
+    DBUG_RETURN(rc);
+  }
   
   /* Call iconv to open the conversion. */
   if (direction == toDB2)
   {
     newConversion = iconv_open(db2Aix41Desc, mysqlAix41Desc);
-    if (newConversion == (iconv_t) -1)
-    {
-       getErrTxt(DB2I_ERR_ICONV_OPEN, mysqlAix41Desc, db2Aix41Desc,  errno);
-       DBUG_RETURN(DB2I_ERR_ICONV_OPEN);
-    }
   }
   else
   {
     newConversion = iconv_open(mysqlAix41Desc, db2Aix41Desc);
-    if (newConversion == (iconv_t) -1)
-    {
-       getErrTxt(DB2I_ERR_ICONV_OPEN, db2Aix41Desc, mysqlAix41Desc, errno);
-       DBUG_RETURN(DB2I_ERR_ICONV_OPEN);
-    }
+  }
+
+  if (unlikely(newConversion == (iconv_t) -1))
+  {
+    getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
+    DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET);
   }
  
   /* Insert the new conversion into the cache. */

=== modified file 'storage/ibmdb2i/db2i_conversion.cc'
--- a/storage/ibmdb2i/db2i_conversion.cc	2009-03-09 21:20:14 +0000
+++ b/storage/ibmdb2i/db2i_conversion.cc	2009-05-05 09:33:52 +0000
@@ -151,7 +151,7 @@ int ha_ibmdb2i::convertFieldChars(enum_c
   
   if (unlikely(conversion == (iconv_t)(-1)))
   {
-    return (DB2I_ERR_ICONV_OPEN);
+    return (DB2I_ERR_UNSUPP_CHARSET);
   }
 
   size_t initOLen= olen;
@@ -670,6 +670,13 @@ int ha_ibmdb2i::getFieldTypeMapping(Fiel
               if (rtnCode)
                 return rtnCode;
             }
+            
+            // Check whether there is a character conversion available.
+            iconv_t temp;
+            int32 rc = getConversion(toDB2, fieldCharSet, db2Ccsid, temp);
+            if (unlikely(rc))
+              return rc;
+            
             sprintf(stringBuildBuffer, " CCSID %d ", db2Ccsid);
             mapping.append(stringBuildBuffer);
           }

=== modified file 'storage/ibmdb2i/db2i_errors.cc'
--- a/storage/ibmdb2i/db2i_errors.cc	2009-03-09 21:20:14 +0000
+++ b/storage/ibmdb2i/db2i_errors.cc	2009-05-05 09:33:52 +0000
@@ -52,7 +52,7 @@ static const char* engineErrors[MAX_MSGS
   {"Error opening codeset conversion from %.64s to %.64s (errno = %d)"},      
   {"Invalid %-.10s name '%-.128s'"},                                          
   {"Unsupported move from '%-.128s' to '%-.128s' on RENAME TABLE statement"}, 
-  {"Unsupported schema '%-.128s' specified on RENAME TABLE statement"},       
+  {"The %-.64s character set is not supported."},       
   {"Auto_increment is not allowed for a partitioned table"},                  
   {"Character set conversion error due to unknown encoding scheme %d"},       
   {""}, 

=== modified file 'storage/ibmdb2i/db2i_errors.h'
--- a/storage/ibmdb2i/db2i_errors.h	2009-03-09 21:20:14 +0000
+++ b/storage/ibmdb2i/db2i_errors.h	2009-05-05 09:33:52 +0000
@@ -54,7 +54,7 @@ enum DB2I_errors
   DB2I_ERR_ICONV_OPEN,
   DB2I_ERR_INVALID_NAME,
   DB2I_ERR_RENAME_MOVE,
-  DB2I_ERR_RENAME_QTEMP,
+  DB2I_ERR_UNSUPP_CHARSET,
   DB2I_ERR_PART_AUTOINC,
   DB2I_ERR_UNKNOWN_ENCODING,
   DB2I_ERR_RESERVED,

=== modified file 'storage/ibmdb2i/ha_ibmdb2i.cc'
--- a/storage/ibmdb2i/ha_ibmdb2i.cc	2009-04-13 11:35:40 +0000
+++ b/storage/ibmdb2i/ha_ibmdb2i.cc	2009-04-29 11:21:14 +0000
@@ -898,6 +898,8 @@ int ha_ibmdb2i::index_init(uint idx, boo
       releaseIndexFile(idx);
   }
   
+  rrnAssocHandle= 0;
+
   DBUG_RETURN(rc); 
 }
 
@@ -1154,6 +1156,8 @@ int ha_ibmdb2i::rnd_init(bool scan)
       releaseDataFile();
   }
   
+  rrnAssocHandle= 0;
+
   DBUG_RETURN(0); // MySQL sometimes does not check the return code, causing 
                   // an assert in ha_rnd_end later on if we return a non-zero
                   // value here. 
@@ -1251,7 +1255,8 @@ int ha_ibmdb2i::rnd_pos(uchar * buf, uch
   
   int rc = 0;
 
-  if (activeHandle != rrnAssocHandle) 
+  if (rrnAssocHandle &&
+      (activeHandle != rrnAssocHandle))
   {
     if (activeHandle) releaseActiveHandle();
     rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle);    

=== modified file 'storage/myisam/ft_boolean_search.c'
--- a/storage/myisam/ft_boolean_search.c	2008-12-09 09:27:46 +0000
+++ b/storage/myisam/ft_boolean_search.c	2009-04-23 11:24:08 +0000
@@ -335,7 +335,23 @@ static int _ftb_no_dupes_cmp(void* not_u
   return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b)));
 }
 
-/* returns 1 if the search was finished (must-word wasn't found) */
+/*
+  When performing prefix search (a word with truncation operator), we
+  must preserve original prefix to ensure that characters which may be
+  expanded/contracted do not break the prefix. This is done by storing
+  newly found key immediatly after the original word in ftbw->word
+  buffer.
+
+  ftbw->word= LENGTH WORD [ LENGTH1 WORD1 ] WEIGHT REFERENCE
+  LENGTH - 1 byte, length of the WORD
+  WORD - LENGTH bytes, the word itself
+  LENGTH1 - 1 byte, length of the WORD1, present in case of prefix search
+  WORD1 - LENGTH bytes, the word itself, present in case of prefix search
+  WEIGHT - 4 bytes (HA_FT_WLEN), either weight or number of subkeys
+  REFERENCE - rec_reflength bytes, pointer to the record
+
+  returns 1 if the search was finished (must-word wasn't found)
+*/
 static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
 {
   int r;
@@ -369,7 +385,8 @@ static int _ft2_search(FTB *ftb, FTB_WOR
     if (ftbw->docid[0] < max_docid)
     {
       sflag|= SEARCH_SAME;
-      _mi_dpointer(info, (uchar *)(ftbw->word + ftbw->len + HA_FT_WLEN),
+      _mi_dpointer(info, (uchar*) (lastkey_buf + HA_FT_WLEN +
+                                   (ftbw->off ? 0 : lastkey_buf[0] + 1)),
                    max_docid);
     }
     r=_mi_search(info, ftbw->keyinfo, (uchar*) lastkey_buf,

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2009-04-08 06:55:19 +0000
+++ b/storage/myisam/ha_myisam.cc	2009-04-30 12:52:48 +0000
@@ -43,6 +43,28 @@ TYPELIB myisam_stats_method_typelib= {
   array_elements(myisam_stats_method_names) - 1, "",
   myisam_stats_method_names, NULL};
 
+#ifndef DBUG_OFF
+/**
+  Causes the thread to wait in a spin lock for a query kill signal.
+  This function is used by the test frame work to identify race conditions.
+
+  The signal is caught and ignored and the thread is not killed.
+*/
+
+static void debug_wait_for_kill(const char *info)
+{
+  DBUG_ENTER("debug_wait_for_kill");
+  const char *prev_info;
+  THD *thd;
+  thd= current_thd;
+  prev_info= thd_proc_info(thd, info);
+  while(!thd->killed)
+    my_sleep(1000);
+  DBUG_PRINT("info", ("Exit debug_wait_for_kill"));
+  thd_proc_info(thd, prev_info);
+  DBUG_VOID_RETURN;
+}
+#endif
 
 /*****************************************************************************
 ** MyISAM tables
@@ -392,7 +414,7 @@ int check_definition(MI_KEYDEF *t1_keyin
                             test(t2_keyinfo[i].flag & HA_SPATIAL)));
        DBUG_RETURN(1);
     }
-    if ((mysql_40_compat &&
+    if ((!mysql_40_compat &&
         t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg) ||
         t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs)
     {
@@ -424,7 +446,7 @@ int check_definition(MI_KEYDEF *t1_keyin
           t1_keysegs_j__type= HA_KEYTYPE_VARBINARY1; /* purecov: inspected */
       }
 
-      if ((mysql_40_compat &&
+      if ((!mysql_40_compat &&
           t1_keysegs[j].language != t2_keysegs[j].language) ||
           t1_keysegs_j__type != t2_keysegs[j].type ||
           t1_keysegs[j].null_bit != t2_keysegs[j].null_bit ||
@@ -1395,6 +1417,9 @@ int ha_myisam::enable_indexes(uint mode)
 {
   int error;
 
+  DBUG_EXECUTE_IF("wait_in_enable_indexes",
+                  debug_wait_for_kill("wait_in_enable_indexes"); );
+
   if (mi_is_all_keys_active(file->s->state.key_map, file->s->base.keys))
   {
     /* All indexes are enabled already. */
@@ -1508,8 +1533,9 @@ void ha_myisam::start_bulk_insert(ha_row
     /*
       Only disable old index if the table was empty and we are inserting
       a lot of rows.
-      We should not do this for only a few rows as this is slower and
-      we don't want to update the key statistics based of only a few rows.
+      Note that in end_bulk_insert() we may truncate the table if
+      enable_indexes() failed, thus it's essential that indexes are
+      disabled ONLY for an empty table.
     */
     if (file->state->records == 0 && can_enable_indexes &&
         (!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES))
@@ -1541,8 +1567,27 @@ int ha_myisam::end_bulk_insert()
 {
   mi_end_bulk_insert(file);
   int err=mi_extra(file, HA_EXTRA_NO_CACHE, 0);
-  return err ? err : can_enable_indexes ?
-                     enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE) : 0;
+  if (!err)
+  {
+    if (can_enable_indexes)
+    {
+      /* 
+        Truncate the table when enable index operation is killed. 
+        After truncating the table we don't need to enable the 
+        indexes, because the last repair operation is aborted after 
+        setting the indexes as active and  trying to recreate them. 
+     */
+   
+      if (((err= enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE)) != 0) && 
+                                                  current_thd->killed)
+      {
+        delete_all_rows();
+        /* not crashed, despite being killed during repair */
+        file->s->state.changed&= ~(STATE_CRASHED|STATE_CRASHED_ON_REPAIR);
+      }
+    } 
+  }
+  return err;
 }
 
 

=== modified file 'storage/myisam/mi_delete.c'
--- a/storage/myisam/mi_delete.c	2008-03-29 08:02:54 +0000
+++ b/storage/myisam/mi_delete.c	2009-04-29 02:59:10 +0000
@@ -250,7 +250,11 @@ static int d_search(register MI_INFO *in
       if (info->ft1_to_ft2)
       {
         /* we're in ft1->ft2 conversion mode. Saving key data */
-        insert_dynamic(info->ft1_to_ft2, (lastkey+off));
+        if (insert_dynamic(info->ft1_to_ft2, (lastkey+off)))
+        {
+          DBUG_PRINT("error",("Out of memory"));
+          DBUG_RETURN(-1);
+        }
       }
       else
       {

=== modified file 'storage/myisam/mi_open.c'
--- a/storage/myisam/mi_open.c	2009-02-13 16:41:47 +0000
+++ b/storage/myisam/mi_open.c	2009-04-29 12:00:34 +0000
@@ -1160,7 +1160,8 @@ uchar *mi_keyseg_read(uchar *ptr, HA_KEY
    keyseg->null_pos	= mi_uint4korr(ptr);  ptr +=4;
    keyseg->charset=0;				/* Will be filled in later */
    if (keyseg->null_bit)
-     keyseg->bit_pos= (uint16)(keyseg->null_pos + (keyseg->null_bit == 7));
+     /* We adjust bit_pos if null_bit is last in the byte */
+     keyseg->bit_pos= (uint16)(keyseg->null_pos + (keyseg->null_bit == (1 << 7)));
    else
    {
      keyseg->bit_pos= (uint16)keyseg->null_pos;

=== modified file 'storage/myisam/mi_write.c'
--- a/storage/myisam/mi_write.c	2008-03-31 07:40:39 +0000
+++ b/storage/myisam/mi_write.c	2009-04-29 02:59:10 +0000
@@ -562,7 +562,14 @@ int _mi_insert(register MI_INFO *info, r
              we cannot easily dispatch an empty page here */
           b+=blen+ft2len+2;
           for (a=anc_buff+a_length ; b < a ; b+=ft2len+2)
-            insert_dynamic(info->ft1_to_ft2, b);
+          {
+            if (insert_dynamic(info->ft1_to_ft2, b))
+            {
+              mi_print_error(info->s, HA_ERR_OUT_OF_MEM);
+              my_errno= HA_ERR_OUT_OF_MEM;
+              DBUG_RETURN(-1);
+            }
+          }
 
           /* fixing the page's length - it contains only one key now */
           mi_putint(anc_buff,2+blen+ft2len+2,0);

=== modified file 'storage/ndb/src/kernel/blocks/backup/read.cpp'
--- a/storage/ndb/src/kernel/blocks/backup/read.cpp	2006-12-23 19:20:40 +0000
+++ b/storage/ndb/src/kernel/blocks/backup/read.cpp	2009-04-28 18:21:47 +0000
@@ -50,7 +50,7 @@ main(int argc, const char * argv[]){
 
   ndb_init();
   if(argc <= 1){
-    printf("Usage: %s <filename>", argv[0]);
+    printf("Usage: %s <filename>\n", argv[0]);
     exit(1);
   }
   FILE * f = fopen(argv[1], "rb");

=== modified file 'strings/ctype-cp932.c'
--- a/strings/ctype-cp932.c	2007-11-29 10:35:15 +0000
+++ b/strings/ctype-cp932.c	2009-05-05 06:55:22 +0000
@@ -5489,10 +5489,10 @@ static MY_CHARSET_HANDLER my_charset_han
   my_mb_wc_cp932,	/* mb_wc */
   my_wc_mb_cp932,	/* wc_mb */
   my_mb_ctype_mb,
-  my_caseup_str_8bit,
-  my_casedn_str_8bit,
-  my_caseup_8bit,
-  my_casedn_8bit,
+  my_caseup_str_mb,
+  my_casedn_str_mb,
+  my_caseup_mb,
+  my_casedn_mb,
   my_snprintf_8bit,
   my_long10_to_str_8bit,
   my_longlong10_to_str_8bit,

=== modified file 'strings/ctype-sjis.c'
--- a/strings/ctype-sjis.c	2007-10-04 07:10:15 +0000
+++ b/strings/ctype-sjis.c	2009-05-05 06:55:22 +0000
@@ -4650,10 +4650,10 @@ static MY_CHARSET_HANDLER my_charset_han
   my_mb_wc_sjis,	/* mb_wc */
   my_wc_mb_sjis,	/* wc_mb */
   my_mb_ctype_mb,
-  my_caseup_str_8bit,
-  my_casedn_str_8bit,
-  my_caseup_8bit,
-  my_casedn_8bit,
+  my_caseup_str_mb,
+  my_casedn_str_mb,
+  my_caseup_mb,
+  my_casedn_mb,
   my_snprintf_8bit,
   my_long10_to_str_8bit,
   my_longlong10_to_str_8bit,

=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c	2009-03-24 13:58:52 +0000
+++ b/tests/mysql_client_test.c	2009-04-30 07:54:45 +0000
@@ -16555,61 +16555,6 @@ static void test_change_user()
   DBUG_VOID_RETURN;
 }
 
-#ifdef HAVE_SPATIAL
-/**
-  Bug#37956 memory leak and / or crash with geometry and prepared statements! 
-*/
-
-static void test_bug37956(void)
-{
-  const char *query="select point(?,?)";
-  MYSQL_STMT *stmt=NULL;
-  ulong val=0;
-  MYSQL_BIND bind_param[2];
-  unsigned char buff[2]= { 134, 211 };
-  DBUG_ENTER("test_bug37956");
-  myheader("test_bug37956");
-
-  stmt= mysql_simple_prepare(mysql, query);
-  check_stmt(stmt);
-
-  val=1;
-  mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void *)&val);
-  val=CURSOR_TYPE_READ_ONLY;
-  mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void *)&val);
-  val=0;
-  mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS, (void *)&val);
-
-  memset(bind_param, 0, sizeof(bind_param));
-  bind_param[0].buffer_type=MYSQL_TYPE_TINY;
-  bind_param[0].buffer= (void *)buff;
-  bind_param[0].is_null=NULL;
-  bind_param[0].error=NULL;
-  bind_param[0].is_unsigned=1;
-  bind_param[1].buffer_type=MYSQL_TYPE_TINY;
-  bind_param[1].buffer= (void *)(buff+1);
-  bind_param[1].is_null=NULL;
-  bind_param[1].error=NULL;
-  bind_param[1].is_unsigned=1;
-
-  if (mysql_stmt_bind_param(stmt, bind_param))
-  {
-    mysql_stmt_close(stmt);
-    DIE_UNLESS(0);
-  }
-
-  if (mysql_stmt_execute(stmt))
-  {
-    mysql_stmt_close(stmt);
-    DBUG_VOID_RETURN;
-  }
-  /* Should never reach here: execution returns an error. */
-  mysql_stmt_close(stmt);
-  DIE_UNLESS(0);
-  DBUG_VOID_RETURN;
-}
-#endif
-
 /*
   Bug#27592 (stack overrun when storing datetime value using prepared statements)
 */
@@ -18145,9 +18090,6 @@ static struct my_tests_st my_tests[]= {
   { "test_wl4166_2", test_wl4166_2 },
   { "test_bug38486", test_bug38486 },
   { "test_bug40365", test_bug40365 },
-#ifdef HAVE_SPATIAL
-  { "test_bug37956", test_bug37956 },
-#endif
 #ifdef HAVE_QUERY_CACHE
   { "test_bug36326", test_bug36326 },
 #endif

Thread
bzr push into mysql-5.1-bugteam branch (jimw:2875 to 2894) Bug#32991Jim Winstead12 May