From 8ee6d33bdd49978b68a78126653d3b4aaa60a4ca Mon Sep 17 00:00:00 2001 From: "dlenev@brandersnatch.localdomain" <> Date: Sat, 30 Apr 2005 20:23:40 +0400 Subject: [PATCH 01/15] Fix for Bug #9913 "udf_deinit is not called after execution of PS" (aka "deinit is not called when calling udf from trigger"). We should call udf_deinit() function during cleanup phase after prepared (or ordinary) statement execution instead of calling it from Item's desctructor. No test case is provided since it is hard to test UDF's from our test suite. --- sql/item_func.cc | 15 +++++++++++++++ sql/item_func.h | 1 + sql/item_sum.cc | 11 +++++++++++ sql/item_sum.h | 1 + sql/sql_udf.h | 1 + 5 files changed, 29 insertions(+) diff --git a/sql/item_func.cc b/sql/item_func.cc index 2b38584fe23..d1d89b70d10 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1617,6 +1617,13 @@ longlong Item_func_bit_count::val_int() #ifdef HAVE_DLOPEN udf_handler::~udf_handler() +{ + /* Everything should be properly cleaned up by this moment. */ + DBUG_ASSERT(not_original || !(initialized || buffers)); +} + + +void udf_handler::cleanup() { if (!not_original) { @@ -1629,9 +1636,11 @@ udf_handler::~udf_handler() (*deinit)(&initid); } free_udf(u_d); + initialized= FALSE; } if (buffers) // Because of bug in ecc delete [] buffers; + buffers= 0; } } @@ -1871,6 +1880,12 @@ String *udf_handler::val_str(String *str,String *save_str) } +void Item_udf_func::cleanup() +{ + udf.cleanup(); + Item_func::cleanup(); +} + double Item_func_udf_float::val() { diff --git a/sql/item_func.h b/sql/item_func.h index 3a309f4ae99..7244fc73a42 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -786,6 +786,7 @@ public: fixed= 1; return res; } + void cleanup(); Item_result result_type () const { return udf.result_type(); } table_map not_null_tables() const { return 0; } }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 7e9c5d09136..dd4cda4ff91 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1449,6 +1449,17 @@ bool Item_udf_sum::add() DBUG_RETURN(0); } +void Item_udf_sum::cleanup() +{ + /* + udf_handler::cleanup() nicely handles case when we have not + original item but one created by copy_or_same() method. + */ + udf.cleanup(); + Item_sum::cleanup(); +} + + Item *Item_sum_udf_float::copy_or_same(THD* thd) { return new (thd->mem_root) Item_sum_udf_float(thd, this); diff --git a/sql/item_sum.h b/sql/item_sum.h index dab136e4716..040d9395e3a 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -550,6 +550,7 @@ public: bool add(); void reset_field() {}; void update_field() {}; + void cleanup(); }; diff --git a/sql/sql_udf.h b/sql/sql_udf.h index d1f99a6d232..acb04e949a3 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -67,6 +67,7 @@ class udf_handler :public Sql_alloc bool get_arguments(); bool fix_fields(THD *thd,struct st_table_list *tlist,Item_result_field *item, uint arg_count,Item **args); + void cleanup(); double val(my_bool *null_value) { if (get_arguments()) From 5b5565c30a8678ab69b1089aef3c05c8bba29d08 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Wed, 4 May 2005 15:05:56 +0200 Subject: [PATCH 02/15] BUG#10241 cygwin port: invalid pragma interface directives - Introduce ifdefs so we can control when to use #pragma interface on cygwin --- include/my_global.h | 5 +++++ include/raid.h | 2 +- sql/examples/ha_archive.h | 2 +- sql/examples/ha_example.h | 2 +- sql/field.h | 2 +- sql/ha_berkeley.h | 2 +- sql/ha_blackhole.h | 2 +- sql/ha_heap.h | 2 +- sql/ha_innodb.h | 2 +- sql/ha_isam.h | 2 +- sql/ha_isammrg.h | 2 +- sql/ha_myisam.h | 2 +- sql/ha_myisammrg.h | 2 +- sql/ha_ndbcluster.h | 2 +- sql/handler.h | 2 +- sql/item.h | 2 +- sql/item_cmpfunc.h | 2 +- sql/item_func.h | 2 +- sql/item_geofunc.h | 2 +- sql/item_strfunc.h | 3 ++- sql/item_subselect.h | 2 +- sql/item_sum.h | 2 +- sql/item_timefunc.h | 2 +- sql/opt_range.h | 2 +- sql/procedure.h | 2 +- sql/protocol.h | 2 +- sql/set_var.h | 2 +- sql/sql_class.h | 2 +- sql/sql_list.h | 2 +- sql/sql_select.h | 2 +- sql/sql_string.h | 2 +- sql/sql_udf.h | 2 +- sql/tztime.h | 2 +- 33 files changed, 38 insertions(+), 32 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index bf6f3b52c4b..865078927fb 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -43,6 +43,11 @@ #define HAVE_ERRNO_AS_DEFINE #endif /* __CYGWIN__ */ +/* Determine when to use "#pragma interface" */ +#if !defined(__CYGWIN__) && !defined(__ICC) && (__GNUC__ < 3) +#define USE_PRAGMA_INTERFACE +#endif + #if defined(i386) && !defined(__i386__) #define __i386__ #endif diff --git a/include/raid.h b/include/raid.h index 04c54393e54..c840afcbaab 100644 --- a/include/raid.h +++ b/include/raid.h @@ -89,7 +89,7 @@ extern "C" { #ifdef __cplusplus } -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h index 855d756368d..7ab463b6661 100644 --- a/sql/examples/ha_archive.h +++ b/sql/examples/ha_archive.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h index 3c6ce4220ee..ae72e5bb275 100644 --- a/sql/examples/ha_example.h +++ b/sql/examples/ha_example.h @@ -21,7 +21,7 @@ that you can implement. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/field.h b/sql/field.h index f19771c3f9c..1d7669d540d 100644 --- a/sql/field.h +++ b/sql/field.h @@ -20,7 +20,7 @@ variables must declare the size_of() member function. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 25d3e128502..1d4823bbdc0 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_blackhole.h b/sql/ha_blackhole.h index b6f924e94b9..84a386e17f8 100644 --- a/sql/ha_blackhole.h +++ b/sql/ha_blackhole.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_heap.h b/sql/ha_heap.h index f36e9f31c55..60e2e84c5d2 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index edf428669d8..d336811a1eb 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -21,7 +21,7 @@ Innodb */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_isam.h b/sql/ha_isam.h index b3e932696cb..1f9b8eb28fe 100644 --- a/sql/ha_isam.h +++ b/sql/ha_isam.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h index 657e5060272..82a2e312ca3 100644 --- a/sql/ha_isammrg.h +++ b/sql/ha_isammrg.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h index 1e6cf2f4ada..b256d4777f9 100644 --- a/sql/ha_myisam.h +++ b/sql/ha_myisam.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index 6058c32c805..3bc9c11d4be 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 7de5dd503e7..439b4855147 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -21,7 +21,7 @@ /* The class defining a handle to an NDB Cluster table */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/handler.h b/sql/handler.h index d2f77c4149a..df623afcd79 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -17,7 +17,7 @@ /* Definitions for parameters to do with handler-routines */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item.h b/sql/item.h index d576fbbc60a..cbb65857027 100644 --- a/sql/item.h +++ b/sql/item.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 37b0674a094..bea8250de9d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -17,7 +17,7 @@ /* compare and test functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_func.h b/sql/item_func.h index 288db3a148c..398efa837bd 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -17,7 +17,7 @@ /* Function items used by mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 79e4f804a04..5f060416ff3 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -19,7 +19,7 @@ #ifdef HAVE_SPATIAL -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 323b52b826c..e576b2c2a7e 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -17,7 +17,8 @@ /* This file defines all string functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE +#error PRAGMA #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_subselect.h b/sql/item_subselect.h index a6e005d5d26..20ba838e61c 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -16,7 +16,7 @@ /* subselect Item */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_sum.h b/sql/item_sum.h index dab136e4716..22f57712694 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -17,7 +17,7 @@ /* classes for sum functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index cc2709bf555..1a30b24b7ce 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -17,7 +17,7 @@ /* Function items used by mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/opt_range.h b/sql/opt_range.h index 5a2044a59f4..edecdcc6282 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -20,7 +20,7 @@ #ifndef _opt_range_h #define _opt_range_h -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/procedure.h b/sql/procedure.h index abe50bdc0a0..0a1e9ddfa2f 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -17,7 +17,7 @@ /* When using sql procedures */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/protocol.h b/sql/protocol.h index a3b6da55da3..32d6acccddf 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/set_var.h b/sql/set_var.h index 080a2a95ae0..d452ba03367 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -16,7 +16,7 @@ /* Classes to support the SET command */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_class.h b/sql/sql_class.h index 703bb030ab9..fbd60373498 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -17,7 +17,7 @@ /* Classes in mysql */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_list.h b/sql/sql_list.h index be3e29b0c62..45a6b5066eb 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_select.h b/sql/sql_select.h index caf4574fbec..7e69eca4683 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -17,7 +17,7 @@ /* classes to use when handling where clause */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_string.h b/sql/sql_string.h index 8dff5558120..31cdd6efb8a 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_udf.h b/sql/sql_udf.h index d1f99a6d232..54d2267cac5 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -17,7 +17,7 @@ /* This file defines structures needed by udf functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface #endif diff --git a/sql/tztime.h b/sql/tztime.h index 2214c1b29d6..e1ff71b6703 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class interface */ #endif From 39f4e5755d6c7cde9da0140bb662ebe9aa449326 Mon Sep 17 00:00:00 2001 From: "brian@brian-akers-computer.local" <> Date: Sat, 7 May 2005 09:49:39 -0700 Subject: [PATCH 03/15] Patch for --insert-ignore --- client/client_priv.h | 2 +- client/mysqldump.c | 19 +++++--- mysql-test/r/mysqldump.result | 88 +++++++++++++++++++++++++++++++++++ mysql-test/t/mysqldump.test | 10 ++++ 4 files changed, 111 insertions(+), 8 deletions(-) diff --git a/client/client_priv.h b/client/client_priv.h index 95f4d105156..45806349d7d 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -49,5 +49,5 @@ enum options_client #ifdef HAVE_NDBCLUSTER_DB ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING #endif - ,OPT_IGNORE_TABLE + ,OPT_IGNORE_TABLE,OPT_INSERT_IGNORE }; diff --git a/client/mysqldump.c b/client/mysqldump.c index 2573c812067..67b89ea4bc2 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -83,7 +83,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1, opt_autocommit=0,opt_disable_keys=1,opt_xml=0, opt_delete_master_logs=0, tty_password=0, opt_single_transaction=0, opt_comments= 0, opt_compact= 0, - opt_hex_blob=0, opt_order_by_primary=0; + opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, @@ -255,6 +255,9 @@ static struct my_option my_long_options[] = "use the directive multiple times, once for each table. Each table must " "be specified with both database and table names, e.g. --ignore-table=database.table", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.", + (gptr*) &opt_ignore, (gptr*) &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, + 0, 0}, {"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...", (gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1096,13 +1099,15 @@ static uint getTableStructure(char *table, char* db) my_bool init=0; uint numFields; char *strpos, *result_table, *opt_quoted_table; - const char *delayed; + const char *insert_option; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3]; FILE *sql_file = md_result_file; DBUG_ENTER("getTableStructure"); - delayed= opt_delayed ? " DELAYED " : ""; + insert_option= (opt_delayed && opt_ignore) ? " DELAYED IGNORE " : + opt_delayed ? " DELAYED " : + opt_ignore ? " IGNORE " : ""; if (verbose) fprintf(stderr, "-- Retrieving table structure for table %s...\n", table); @@ -1177,11 +1182,11 @@ static uint getTableStructure(char *table, char* db) if (cFlag) my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (", - delayed, opt_quoted_table); + insert_option, opt_quoted_table); else { my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ", - delayed, opt_quoted_table); + insert_option, opt_quoted_table); if (!extended_insert) strcat(insert_pat,"("); } @@ -1245,11 +1250,11 @@ static uint getTableStructure(char *table, char* db) } if (cFlag) my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s (", - delayed, result_table); + insert_option, result_table); else { my_snprintf(insert_pat, sizeof(insert_pat), "INSERT %sINTO %s VALUES ", - delayed, result_table); + insert_option, result_table); if (!extended_insert) strcat(insert_pat,"("); } diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 69ca9486d2f..bcd690bf681 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -560,3 +560,91 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; +CREATE TABLE t1 (a decimal(240, 20)); +INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), +("0987654321098765432109876543210987654321"); +-- MySQL dump 10.9 +-- +-- Host: localhost Database: test +-- ------------------------------------------------------ +-- Server version 4.1.12-debug-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `t1` +-- + +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` decimal(240,20) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `t1` +-- + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +LOCK TABLES `t1` WRITE; +INSERT IGNORE INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); +UNLOCK TABLES; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- MySQL dump 10.9 +-- +-- Host: localhost Database: test +-- ------------------------------------------------------ +-- Server version 4.1.12-debug-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `t1` +-- + +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` decimal(240,20) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Dumping data for table `t1` +-- + + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT DELAYED IGNORE INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index c321fb9c6b7..98ed45f98f6 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -185,3 +185,13 @@ INSERT INTO `t1` VALUES (0x602010000280100005E71A); --exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 DROP TABLE t1; +# +# Test for --insert-ignore +# + +CREATE TABLE t1 (a decimal(240, 20)); +INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), +("0987654321098765432109876543210987654321"); +--exec $MYSQL_DUMP --insert-ignore test t1 +--exec $MYSQL_DUMP --insert-ignore --delayed-insert test t1 +DROP TABLE t1; From b8a94814c9f7b49973e1315e8ab4551c7e806415 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Mon, 9 May 2005 00:35:48 +0200 Subject: [PATCH 04/15] - added cmd-line-utils/libedit/vis.h to the source distribution --- cmd-line-utils/libedit/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index 9ff005c7156..03f3eb65fbc 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h noinst_HEADERS = chared.h el.h el_term.h histedit.h key.h parse.h refresh.h sig.h \ sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \ - search.h tty.h libedit_term.h + search.h tty.h libedit_term.h vis.h EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c From 1b198a78b21e639af4f77641abf85dfd40845b0e Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Mon, 9 May 2005 00:47:47 +0200 Subject: [PATCH 05/15] - fix the range test to pass when InnoDB is note enabled (e.g. in the "-classic" build) --- mysql-test/t/range.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 3d3d4748fe3..b8412b6624e 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1,3 +1,5 @@ +-- source include/have_innodb.inc + # # Problem with range optimizer # From 1092c4d8b44e9bc2b8184e26843c7f627341bf94 Mon Sep 17 00:00:00 2001 From: "ramil@ram-book.(none)" <> Date: Mon, 9 May 2005 11:43:52 +0500 Subject: [PATCH 06/15] Fix for bug #9798: Rollup crash with InnoDB in setup_sum_funcs(). --- mysql-test/r/group_min_max.result | 7 +++++++ mysql-test/t/group_min_max.test | 11 +++++++++++ sql/opt_range.cc | 7 ++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 766e43b2299..3037047b513 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -1961,3 +1961,10 @@ a varchar(30), b varchar(30), primary key(a), key(b) select distinct a from t1; a drop table t1; +create table t1(a int, key(a)) engine=innodb; +insert into t1 values(1); +select a, count(a) from t1 group by a with rollup; +a count(a) +1 1 +NULL 1 +drop table t1; diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index d85b3395853..9feb4f33682 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -610,3 +610,14 @@ create table t1 ( --enable_warnings select distinct a from t1; drop table t1; + +# +# Bug #9798: group by with rollup +# + +--disable_warnings +create table t1(a int, key(a)) engine=innodb; +--enable_warnings +insert into t1 values(1); +select a, count(a) from t1 group by a with rollup; +drop table t1; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 85b5e7270ec..b81a083d9b3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -6670,6 +6670,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, - NGA = QA - (GA union C) = {NG_1, ..., NG_m} - the ones not in GROUP BY and not referenced by MIN/MAX functions. with the following properties specified below. + B3. If Q has a GROUP BY WITH ROLLUP clause the access method is not + applicable. SA1. There is at most one attribute in SA referenced by any number of MIN and/or MAX functions which, which if present, is denoted as C. @@ -6754,6 +6756,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, other field as in: "select min(a) from t1 group by a" ? - We assume that the general correctness of the GROUP-BY query was checked before this point. Is this correct, or do we have to check it completely? + - Lift the limitation in condition (B3), that is, make this access method + applicable to ROLLUP queries. RETURN If mem_root != NULL @@ -6793,7 +6797,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) DBUG_RETURN(NULL); /* This is not a select statement. */ if ((join->tables != 1) || /* The query must reference one table. */ ((!join->group_list) && /* Neither GROUP BY nor a DISTINCT query. */ - (!join->select_distinct))) + (!join->select_distinct)) || + (thd->lex->select_lex.olap == ROLLUP_TYPE)) /* Check (B3) for ROLLUP */ DBUG_RETURN(NULL); if (table->s->keys == 0) /* There are no indexes to use. */ DBUG_RETURN(NULL); From 2d21a31b6050054fda1da67b8482703fc8ac1870 Mon Sep 17 00:00:00 2001 From: "ramil@ram-book.(none)" <> Date: Mon, 9 May 2005 12:21:19 +0500 Subject: [PATCH 07/15] Brian's mysqldump test modifications made on Ramil's laptop. --- mysql-test/r/mysqldump.result | 42 ++++++----------------------------- mysql-test/t/mysqldump.test | 10 ++++----- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index cf911a1e8a5..6d03e8603cb 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -631,14 +631,9 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; -CREATE TABLE t1 (a decimal(240, 20)); -INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), -("0987654321098765432109876543210987654321"); --- MySQL dump 10.9 --- --- Host: localhost Database: test --- ------------------------------------------------------ --- Server version 4.1.12-debug-log +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t1 VALUES (4),(5),(6); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -648,24 +643,15 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `t1` --- - DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( - `a` decimal(240,20) default NULL + `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; --- --- Dumping data for table `t1` --- - /*!40000 ALTER TABLE `t1` DISABLE KEYS */; LOCK TABLES `t1` WRITE; -INSERT IGNORE INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); +INSERT IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6); UNLOCK TABLES; /*!40000 ALTER TABLE `t1` ENABLE KEYS */; @@ -677,11 +663,6 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- MySQL dump 10.9 --- --- Host: localhost Database: test --- ------------------------------------------------------ --- Server version 4.1.12-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -691,23 +672,14 @@ UNLOCK TABLES; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `t1` --- - DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( - `a` decimal(240,20) default NULL + `a` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; --- --- Dumping data for table `t1` --- - /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); +INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 5d2ca044701..ceae60c4577 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -209,9 +209,9 @@ DROP TABLE t1; # Test for --insert-ignore # -CREATE TABLE t1 (a decimal(240, 20)); -INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), -("0987654321098765432109876543210987654321"); ---exec $MYSQL_DUMP --insert-ignore test t1 ---exec $MYSQL_DUMP --insert-ignore --delayed-insert test t1 +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t1 VALUES (4),(5),(6); +--exec $MYSQL_DUMP --skip-comments --insert-ignore test t1 +--exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1 DROP TABLE t1; From b1edf499520e0dbce658ebab13ba2ef4e99a7eba Mon Sep 17 00:00:00 2001 From: "serg@sergbook.mylan" <> Date: Mon, 9 May 2005 09:24:05 +0200 Subject: [PATCH 08/15] don't use tmp file for such a triviality --- scripts/mysql_install_db.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 0b82e02761e..8dd95da11e3 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -11,7 +11,6 @@ in_rpm=0 windows=0 defaults="" user="" -tmp_file=/tmp/mysql_install_db.$$ case "$1" in --no-defaults|--defaults-file=*|--defaults-extra-file=*) @@ -223,10 +222,8 @@ then then echo "Fill help tables" fi - echo "use mysql;" > $tmp_file - cat $tmp_file $fill_help_tables | eval "$mysqld_install_cmd_line" + (echo "use mysql;"; cat $fill_help_tables) | eval "$mysqld_install_cmd_line" res=$? - rm $tmp_file if test $res != 0 then echo "" From 5cdf15a919a13ab0f0655b2caf16b550b9bfff14 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Mon, 9 May 2005 09:25:47 +0200 Subject: [PATCH 09/15] - added "--skip-comments" to the "mysqldump" test to avoid printing comments that include version-dependent information (which causes test failures when running the test with a different version string) --- mysql-test/r/mysqldump.result | 28 ---------------------------- mysql-test/t/mysqldump.test | 4 ++-- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index bcd690bf681..80c6cad5bbf 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -563,11 +563,6 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(240, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); --- MySQL dump 10.9 --- --- Host: localhost Database: test --- ------------------------------------------------------ --- Server version 4.1.12-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -577,20 +572,11 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `t1` --- - DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` decimal(240,20) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; --- --- Dumping data for table `t1` --- - /*!40000 ALTER TABLE `t1` DISABLE KEYS */; LOCK TABLES `t1` WRITE; @@ -606,11 +592,6 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- MySQL dump 10.9 --- --- Host: localhost Database: test --- ------------------------------------------------------ --- Server version 4.1.12-debug-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -620,20 +601,11 @@ UNLOCK TABLES; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `t1` --- - DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` decimal(240,20) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; --- --- Dumping data for table `t1` --- - /*!40000 ALTER TABLE `t1` DISABLE KEYS */; INSERT DELAYED IGNORE INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000'); diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 98ed45f98f6..b89b482a0f9 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -192,6 +192,6 @@ DROP TABLE t1; CREATE TABLE t1 (a decimal(240, 20)); INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), ("0987654321098765432109876543210987654321"); ---exec $MYSQL_DUMP --insert-ignore test t1 ---exec $MYSQL_DUMP --insert-ignore --delayed-insert test t1 +--exec $MYSQL_DUMP --insert-ignore --skip-comments test t1 +--exec $MYSQL_DUMP --insert-ignore --skip-comments --delayed-insert test t1 DROP TABLE t1; From ed39121c9acf99afb70cb6d6fb487a0ff2b74e9c Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 9 May 2005 11:30:20 +0200 Subject: [PATCH 10/15] After review fixes --- include/my_global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/my_global.h b/include/my_global.h index 865078927fb..4c87e621f25 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -44,7 +44,7 @@ #endif /* __CYGWIN__ */ /* Determine when to use "#pragma interface" */ -#if !defined(__CYGWIN__) && !defined(__ICC) && (__GNUC__ < 3) +#if !defined(__CYGWIN__) && !defined(__ICC) && defined(__GNUC__) && (__GNUC__ < 3) #define USE_PRAGMA_INTERFACE #endif From f5ba5ab02462749f2fb77c727ab7890e2e57f6c1 Mon Sep 17 00:00:00 2001 From: "mwagner@ultrafly.mysql.com" <> Date: Mon, 9 May 2005 12:05:13 +0200 Subject: [PATCH 11/15] make_binary_distribution.sh: - Print the platform name for the build logs. --- scripts/make_binary_distribution.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 6c0487aee40..48461135b44 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -312,6 +312,10 @@ system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'` # Change the distribution to a long descriptive name NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX + +# Print the platform name for build logs +echo "PLATFORM NAME: $system-$machine" + BASE2=$TMP/$NEW_NAME rm -r -f $BASE2 mv $BASE $BASE2 From 5ddaf35c26ed3459c9662b43687ba7ce1494edd2 Mon Sep 17 00:00:00 2001 From: "holyfoot@hf-ibm.(none)" <> Date: Mon, 9 May 2005 16:26:06 +0500 Subject: [PATCH 12/15] Fix for bug #9632 (strict.test fails in -embedded-server mode) --- libmysqld/libmysqld.c | 13 ++++++++----- sql/sql_parse.cc | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index 6fa41fb3fd0..70074e44c6f 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -199,6 +199,14 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, unix_socket=0; db_name = db ? my_strdup(db,MYF(MY_WME)) : NULL; + /* Send client information for access check */ + client_flag|=CLIENT_CAPABILITIES; + if (client_flag & CLIENT_MULTI_STATEMENTS) + client_flag|= CLIENT_MULTI_RESULTS; + client_flag&= ~CLIENT_COMPRESS; + if (db) + client_flag|=CLIENT_CONNECT_WITH_DB; + mysql->thd= create_embedded_thd(client_flag, db_name); init_embedded_mysql(mysql, client_flag, db_name); @@ -209,11 +217,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, if (mysql_init_charset(mysql)) goto error; - /* Send client information for access check */ - client_flag|=CLIENT_CAPABILITIES; - client_flag&= ~CLIENT_COMPRESS; - if (db) - client_flag|=CLIENT_CONNECT_WITH_DB; mysql->server_status= SERVER_STATUS_AUTOCOMMIT; if (mysql->options.init_commands) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e9bdce95091..8c8dcc938cb 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1433,9 +1433,6 @@ bool do_command(THD *thd) } else { - if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA) - thd->killed= THD::NOT_KILLED; - packet=(char*) net->read_pos; command = (enum enum_server_command) (uchar) packet[0]; if (command >= COM_END) @@ -1482,6 +1479,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, bool error= 0; DBUG_ENTER("dispatch_command"); + if (thd->killed == THD::KILL_QUERY || thd->killed == THD::KILL_BAD_DATA) + thd->killed= THD::NOT_KILLED; + thd->command=command; /* Commands which will always take a long time should be marked with From 58409db4c95b86aac1d65ee869a067d252afa452 Mon Sep 17 00:00:00 2001 From: "mwagner@ultrafly.mysql.com" <> Date: Mon, 9 May 2005 14:57:45 +0200 Subject: [PATCH 13/15] make_binary_distribution.sh: - Add --machine override --- scripts/make_binary_distribution.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 48461135b44..1f28b8e4538 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -15,6 +15,7 @@ MV="mv" STRIP=1 DEBUG=0 SILENT=0 +MACHINE= TMP=/tmp SUFFIX="" NDBCLUSTER= @@ -26,6 +27,7 @@ parse_arguments() { --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; --no-strip) STRIP=0 ;; + --machine) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;; --silent) SILENT=1 ;; --with-ndbcluster) NDBCLUSTER=1 ;; *) @@ -38,6 +40,8 @@ parse_arguments() { parse_arguments "$@" + + #make # This should really be integrated with automake and not duplicate the @@ -310,6 +314,11 @@ system=`echo $system | sed -e 's/linux-gnu/linux/g'` system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'` system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'` +# Use the override --machine if present +if [ $MACHINE != "" ] ; then + machine= $MACHINE +fi + # Change the distribution to a long descriptive name NEW_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version-$system-$machine$SUFFIX From 12085567de690f8b047fc09c1f7c0cadae1ac04d Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com" <> Date: Mon, 9 May 2005 16:22:49 +0000 Subject: [PATCH 14/15] Fix for bug #9404: information_schema: Weird error messages with SELECT SUM() ... GROUP BY queries --- heap/hp_hash.c | 13 ++++++------- mysql-test/r/information_schema.result | 4 ++++ mysql-test/t/information_schema.test | 8 +++++++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 52a250bd7af..7f02eb587a8 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -635,13 +635,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) key+= 2; /* skip key pack length */ if (cs->mbmaxlen > 1) { - uint char_length= seg->length / cs->mbmaxlen; - char_length_key= my_charpos(cs, key, key + char_length_key, - char_length); - set_if_smaller(char_length_key, seg->length); - char_length_rec= my_charpos(cs, pos, pos + char_length_rec, - char_length); - set_if_smaller(char_length_rec, seg->length); + uint char_length1, char_length2; + char_length1= char_length2= seg->length / cs->mbmaxlen; + char_length1= my_charpos(cs, key, key + char_length_key, char_length1); + set_if_smaller(char_length_key, char_length1); + char_length2= my_charpos(cs, pos, pos + char_length_rec, char_length2); + set_if_smaller(char_length_rec, char_length2); } if (cs->coll->strnncollsp(seg->charset, diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 0aa5e759207..6104fc772b4 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -734,3 +734,7 @@ x_real NULL NULL x_float NULL NULL x_double_precision NULL NULL drop table t1; +SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA; +table_schema count(*) +information_schema 15 +mysql 17 diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 1739604372a..2da814526a2 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1,4 +1,4 @@ -# This test uses grants, which can't get tested for embedded server +# This test uses grants, which can't get tested for embedded server -- source include/not_embedded.inc # Test for information_schema.schemata & @@ -473,3 +473,9 @@ SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME= 't1'; drop table t1; + +# +# Bug #9404 information_schema: Weird error messages +# with SELECT SUM() ... GROUP BY queries +# +SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA; From 828237909faea64bb4cb74b19921de2a555d3a77 Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com" <> Date: Mon, 9 May 2005 18:18:59 +0000 Subject: [PATCH 15/15] after merge fix --- mysql-test/r/information_schema.result | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index b85a2e86769..0b993d681e3 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -749,7 +749,6 @@ KEY_COLUMN_USAGE TABLE_NAME select delete from mysql.user where user='mysqltest_4'; flush privileges; SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA; -table_schema count(*) -information_schema 15 -mysql 17 - +table_schema count(*) +information_schema 15 +mysql 17