List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:July 14 2008 8:28pm
Subject:bzr commit into mysql-5.0 branch (sergefp:2648)
View as plain text  
#At file:///home/psergey/dev/mysql-5.0-opt-look/

 2648 Sergey Petrunia	2008-07-14 [merge]
      won't push
added:
  mysql-test/r/lowercase_utf8.result
  mysql-test/t/lowercase_utf8-master.opt
  mysql-test/t/lowercase_utf8.test
modified:
  configure.in
  include/config-win.h
  include/my_global.h
  mysql-test/r/ctype_utf8.result
  mysql-test/r/func_math.result
  mysql-test/r/myisam.result
  mysql-test/r/sp.result
  mysql-test/t/ctype_utf8.test
  mysql-test/t/func_math.test
  mysql-test/t/myisam.test
  sql/mysqld.cc
  sql/sql_show.cc
  sql/sql_table.cc
  sql/sql_yacc.yy

=== modified file 'configure.in'
--- a/configure.in	2008-07-09 06:23:30 +0000
+++ b/configure.in	2008-07-14 18:27:39 +0000
@@ -819,7 +819,7 @@ AC_TYPE_SIZE_T
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
+AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h ieeefp.h limits.h \
  memory.h pwd.h select.h \
  stdlib.h stddef.h \
  strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
@@ -2052,7 +2052,7 @@ AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
 
 AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
-  fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
+  fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
   getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
   getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
   localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \

=== modified file 'include/config-win.h'
--- a/include/config-win.h	2008-03-27 22:35:56 +0000
+++ b/include/config-win.h	2008-07-14 18:27:39 +0000
@@ -31,7 +31,6 @@ functions */
 
 #include <sys/locking.h>
 #include <windows.h>
-#include <math.h>			/* Because of rint() */
 #include <fcntl.h>
 #include <io.h>
 #include <malloc.h>
@@ -223,13 +222,6 @@ typedef uint rf_SetTimer;
 #define inline __inline
 #endif /* __cplusplus */
 
-inline double rint(double nr)
-{
-  double f = floor(nr);
-  double c = ceil(nr);
-  return (((c-nr) >= (nr-f)) ? f :c);
-}
-
 #ifdef _WIN64
 #define ulonglong2double(A) ((double) (ulonglong) (A))
 #define my_off_t2double(A)  ((double) (my_off_t) (A))
@@ -272,7 +264,6 @@ inline double ulonglong2double(ulonglong
 #define HAVE_FLOAT_H
 #define HAVE_LIMITS_H
 #define HAVE_STDDEF_H
-#define HAVE_RINT		/* defined in this file */
 #define NO_FCNTL_NONBLOCK	/* No FCNTL */
 #define HAVE_ALLOCA
 #define HAVE_STRPBRK

=== modified file 'include/my_global.h'
--- a/include/my_global.h	2008-04-28 18:58:32 +0000
+++ b/include/my_global.h	2008-07-14 18:27:39 +0000
@@ -483,9 +483,42 @@ typedef unsigned short ushort;
 #define test_all_bits(a,b) (((a) & (b)) == (b))
 #define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
 #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
+
 #ifndef HAVE_RINT
-#define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5))
-#endif
+/**
+  All integers up to this number can be represented exactly as double precision
+  values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
+*/
+#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1)
+
+/**
+  rint(3) implementation for platforms that do not have it.
+  Always rounds to the nearest integer with ties being rounded to the nearest
+  even integer to mimic glibc's rint() behavior in the "round-to-nearest"
+  FPU mode. Hardware-specific optimizations are possible (frndint on x86).
+  Unlike this implementation, hardware will also honor the FPU rounding mode.
+*/
+
+static inline double rint(double x)
+{
+  double f, i;
+  f = modf(x, &i);
+
+  /*
+    All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
+    no need to check it.
+  */
+  if (x > 0.0)
+    i += (double) ((f > 0.5) || (f == 0.5 &&
+                                 i <= (double) MAX_EXACT_INTEGER &&
+                                 (longlong) i % 2));
+  else
+    i -= (double) ((f < -0.5) || (f == -0.5 &&
+                                  i >= (double) -MAX_EXACT_INTEGER &&
+                                  (longlong) i % 2));
+  return i;
+}
+#endif /* HAVE_RINT */
 
 /* Define some general constants */
 #ifndef TRUE

=== modified file 'mysql-test/r/ctype_utf8.result'
--- a/mysql-test/r/ctype_utf8.result	2007-10-30 08:21:44 +0000
+++ b/mysql-test/r/ctype_utf8.result	2008-04-07 13:41:43 +0000
@@ -1506,6 +1506,41 @@ substr(Z.a,-1)	a
 3	123
 6	456
 drop table t1;
+SET CHARACTER SET utf8;
+SHOW VARIABLES LIKE 'character\_set\_%';
+Variable_name	Value
+character_set_client	utf8
+character_set_connection	latin1
+character_set_database	latin1
+character_set_filesystem	binary
+character_set_results	utf8
+character_set_server	latin1
+character_set_system	utf8
+CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+USE crashtest;
+CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8;
+INSERT INTO crashtest VALUES ('35'), ('36'), ('37');
+SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
+crash
+35
+36
+37
+INSERT INTO crashtest VALUES ('-1000');
+EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	crashtest	ALL	NULL	NULL	NULL	NULL	4	Using filesort
+SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
+crash
+-1000
+35
+36
+37
+Warnings:
+Warning	1300	Invalid utf8 character string: 'FFFFFC'
+DROP TABLE crashtest;
+DROP DATABASE crashtest;
+USE test;
+SET CHARACTER SET default;
 CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
 INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
 SELECT id FROM t1;

=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2007-10-01 09:51:59 +0000
+++ b/mysql-test/r/func_math.result	2008-04-07 15:50:40 +0000
@@ -360,4 +360,34 @@ SELECT a DIV 2 FROM t1 UNION SELECT a DI
 a DIV 2
 0
 DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (-1.1), (1.1),
+(-1.5), (1.5),
+(-1.9), (1.9),
+(-2.1), (2.1),
+(-2.5), (2.5),
+(-2.9), (2.9),
+# Check numbers with absolute values > 2^53 - 1 
+# (see comments for MAX_EXACT_INTEGER)
+(-1e16 - 0.5), (1e16 + 0.5),
+(-1e16 - 1.5), (1e16 + 1.5);
+SELECT a, ROUND(a) FROM t1;
+a	ROUND(a)
+-1.1	-1
+1.1	1
+-1.5	-2
+1.5	2
+-1.9	-2
+1.9	2
+-2.1	-2
+2.1	2
+-2.5	-2
+2.5	2
+-2.9	-3
+2.9	3
+-1e+16	-10000000000000000
+1e+16	10000000000000000
+-1e+16	-10000000000000002
+1e+16	10000000000000002
+DROP TABLE t1;
 End of 5.0 tests

=== added file 'mysql-test/r/lowercase_utf8.result'
--- a/mysql-test/r/lowercase_utf8.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/lowercase_utf8.result	2008-07-14 18:27:39 +0000
@@ -0,0 +1,9 @@
+set names utf8;
+create table `��` (id int);
+show tables from test like '��';
+Tables_in_test (��)
+��
+show tables from test like '�`;

=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result	2008-05-06 16:43:46 +0000
+++ b/mysql-test/r/myisam.result	2008-07-14 18:27:39 +0000
@@ -1861,4 +1861,19 @@ id	ref
 3	2
 4	5
 DROP TABLE t1, t2;
+CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
+INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
+checksum table t1;
+Table	Checksum
+test.t1	326284887
+CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
+INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
+checksum table t2;
+Table	Checksum
+test.t2	326284887
+CREATE TABLE t3 select * from t1;
+checksum table t3;
+Table	Checksum
+test.t3	326284887
+drop table t1,t2,t3;
 End of 5.0 tests

=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result	2008-02-17 11:37:39 +0000
+++ b/mysql-test/r/sp.result	2008-07-14 18:27:39 +0000
@@ -2451,6 +2451,8 @@ show tables like 'foo';
 show variables like 'foo';
 show warnings;
 end|
+Warnings:
+Warning	1287	'SHOW COLUMN TYPES' is deprecated; use 'HELP 'DATA TYPES'' instead
 call bug4902()|
 Charset	Description	Default collation	Maxlen
 Collation	Charset	Id	Default	Compiled	Sortlen
@@ -2503,6 +2505,9 @@ Variable_name	Value
 Tables_in_test (foo)
 Variable_name	Value
 Level	Code	Message
+Warning	1287	'SHOW COLUMN TYPES' is deprecated; use 'HELP 'DATA TYPES'' instead
+Warnings:
+Warning	1287	'SHOW COLUMN TYPES' is deprecated; use 'HELP 'DATA TYPES'' instead
 call bug4902()|
 Charset	Description	Default collation	Maxlen
 Collation	Charset	Id	Default	Compiled	Sortlen

=== modified file 'mysql-test/t/ctype_utf8.test'
--- a/mysql-test/t/ctype_utf8.test	2007-10-30 08:21:44 +0000
+++ b/mysql-test/t/ctype_utf8.test	2008-04-07 13:22:54 +0000
@@ -1184,6 +1184,27 @@ explain
   select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
 select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
 drop table t1;
+
+#
+# Bug #34349: Passing invalid parameter to CHAR() in an ORDER BY causes
+# MySQL to hang
+#
+
+SET CHARACTER SET utf8;
+SHOW VARIABLES LIKE 'character\_set\_%';
+CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
+USE crashtest;
+CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8;
+INSERT INTO crashtest VALUES ('35'), ('36'), ('37');
+SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
+INSERT INTO crashtest VALUES ('-1000');
+EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
+SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
+DROP TABLE crashtest;
+DROP DATABASE crashtest;
+USE test;
+SET CHARACTER SET default;
+
 # End of 4.1 tests
 
 #

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2007-10-01 09:51:59 +0000
+++ b/mysql-test/t/func_math.test	2008-04-07 15:50:40 +0000
@@ -229,5 +229,25 @@ INSERT INTO t1 VALUES ('a');
 SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
 DROP TABLE t1;
 
+#
+# Bug #15936: "round" differs on Windows to Unix
+#
+
+CREATE TABLE t1 (a DOUBLE);
+
+INSERT INTO t1 VALUES (-1.1), (1.1),
+                      (-1.5), (1.5),
+                      (-1.9), (1.9),
+                      (-2.1), (2.1),
+                      (-2.5), (2.5),
+                      (-2.9), (2.9),
+# Check numbers with absolute values > 2^53 - 1 
+# (see comments for MAX_EXACT_INTEGER)
+                      (-1e16 - 0.5), (1e16 + 0.5),
+                      (-1e16 - 1.5), (1e16 + 1.5);
+
+SELECT a, ROUND(a) FROM t1;
+
+DROP TABLE t1;
 
 --echo End of 5.0 tests

=== added file 'mysql-test/t/lowercase_utf8-master.opt'
--- a/mysql-test/t/lowercase_utf8-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/lowercase_utf8-master.opt	2008-07-14 18:27:39 +0000
@@ -0,0 +1,4 @@
+--lower-case-table-names=1 --character-set-server=utf8
+
+
+

=== added file 'mysql-test/t/lowercase_utf8.test'
--- a/mysql-test/t/lowercase_utf8.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/lowercase_utf8.test	2008-07-14 18:27:39 +0000
@@ -0,0 +1,9 @@
+#
+# Bug#25830 SHOW TABLE STATUS behaves differently depending on table name
+#
+set names utf8;
+create table `��` (id int);
+show tables from test like '��';
+show tables from test like '��';
+drop table `��`;
+

=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test	2008-01-16 11:15:57 +0000
+++ b/mysql-test/t/myisam.test	2008-07-14 18:27:39 +0000
@@ -1210,4 +1210,19 @@ SELECT * FROM t1;
 
 DROP TABLE t1, t2;
 
+#
+# Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field
+# (same content / differen checksum)
+#
+
+CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
+INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
+checksum table t1;
+CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
+INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
+checksum table t2;
+CREATE TABLE t3 select * from t1;
+checksum table t3;
+drop table t1,t2,t3;
+ 
 --echo End of 5.0 tests

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-06-03 10:12:37 +0000
+++ b/sql/mysqld.cc	2008-07-14 18:27:39 +0000
@@ -186,39 +186,47 @@ int initgroups(const char *,unsigned int
 #ifdef HAVE_FP_EXCEPT				// Fix type conflict
 typedef fp_except fp_except_t;
 #endif
+#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
 
-  /* We can't handle floating point exceptions with threads, so disable
-     this on freebsd
-  */
+#ifdef HAVE_FENV_H
+#include <fenv.h>
+#endif
 
-inline void set_proper_floating_point_mode()
+#ifdef HAVE_SYS_FPU_H
+/* for IRIX to use set_fpc_csr() */
+#include <sys/fpu.h>
+#endif
+
+inline void setup_fpu()
 {
-  /* Don't fall for overflow, underflow,divide-by-zero or loss of precision */
+#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
+  /*
+     We can't handle floating point exceptions with threads, so disable
+     this on freebsd.
+     Don't fall for overflow, underflow,divide-by-zero or loss of precision
+  */
 #if defined(__i386__)
   fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
 	      FP_X_IMP));
 #else
- fpsetmask(~(FP_X_INV |             FP_X_OFL | FP_X_UFL | FP_X_DZ |
-	     FP_X_IMP));
-#endif
-}
-#elif defined(__sgi)
-/* for IRIX to use set_fpc_csr() */
-#include <sys/fpu.h>
+  fpsetmask(~(FP_X_INV |             FP_X_OFL | FP_X_UFL | FP_X_DZ |
+              FP_X_IMP));
+#endif /* __i386__ */
+#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
 
-inline void set_proper_floating_point_mode()
-{
+#ifdef HAVE_FESETROUND
+  /* Set FPU rounding mode to "round-to-nearest" */
+  fesetround(FE_TONEAREST);
+#endif /* HAVE_FESETROUND */
+
+#if defined(__sgi) && defined(HAVE_SYS_FPU_H)
   /* Enable denormalized DOUBLE values support for IRIX */
-  {
-    union fpc_csr n;
-    n.fc_word = get_fpc_csr();
-    n.fc_struct.flush = 0;
-    set_fpc_csr(n.fc_word);
-  }
+  union fpc_csr n;
+  n.fc_word = get_fpc_csr();
+  n.fc_struct.flush = 0;
+  set_fpc_csr(n.fc_word);
+#endif
 }
-#else
-#define set_proper_floating_point_mode()
-#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
 
 } /* cplusplus */
 
@@ -3273,7 +3281,7 @@ static int init_server_components()
   query_cache_init();
   query_cache_resize(query_cache_size);
   randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
-  set_proper_floating_point_mode();
+  setup_fpu();
   init_thr_lock();
 #ifdef HAVE_REPLICATION
   init_slave_list();

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2008-03-19 13:32:28 +0000
+++ b/sql/sql_show.cc	2008-07-14 18:27:39 +0000
@@ -287,11 +287,16 @@ find_files(THD *thd, List<char> *files, 
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   uint col_access=thd->col_access;
 #endif
+  uint wild_length= 0;
   TABLE_LIST table_list;
   DBUG_ENTER("find_files");
 
-  if (wild && !wild[0])
-    wild=0;
+  if (wild)
+  {
+    wild_length= strlen(wild);
+    if (!wild[0])
+      wild= 0;
+  }
 
   bzero((char*) &table_list,sizeof(table_list));
 
@@ -340,8 +345,11 @@ find_files(THD *thd, List<char> *files, 
       {
 	if (lower_case_table_names)
 	{
-	  if (wild_case_compare(files_charset_info, file->name, wild))
-	    continue;
+          if (my_wildcmp(files_charset_info,
+                         file->name, file->name + strlen(file->name),
+                         wild, wild + wild_length,
+                         wild_prefix, wild_one,wild_many))
+            continue;
 	}
 	else if (wild_compare(file->name,wild,0))
 	  continue;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2008-05-12 16:01:13 +0000
+++ b/sql/sql_table.cc	2008-07-14 18:27:39 +0000
@@ -4376,8 +4376,14 @@ bool mysql_checksum_table(THD *thd, TABL
 	    for (uint i= 0; i < t->s->fields; i++ )
 	    {
 	      Field *f= t->field[i];
-	      if ((f->type() == FIELD_TYPE_BLOB) ||
-                  (f->type() == MYSQL_TYPE_VARCHAR))
+              enum_field_types field_type= f->type();
+              /*
+                BLOB and VARCHAR have pointers in their field, we must convert
+                to string; GEOMETRY is implemented on top of BLOB.
+              */
+	      if ((field_type == MYSQL_TYPE_BLOB) ||
+                  (field_type == MYSQL_TYPE_VARCHAR) ||
+                  (field_type == MYSQL_TYPE_GEOMETRY))
 	      {
 		String tmp;
 		f->val_str(&tmp);

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2008-07-07 16:00:08 +0000
+++ b/sql/sql_yacc.yy	2008-07-14 18:27:39 +0000
@@ -7130,6 +7130,7 @@ show_param:
 	  {
 	    LEX *lex=Lex;
 	    lex->sql_command= SQLCOM_SHOW_COLUMN_TYPES;
+            WARN_DEPRECATED("SHOW COLUMN TYPES", "HELP 'DATA TYPES'");
 	  }
 	| TABLE_SYM TYPES_SYM
 	  {

Thread
bzr commit into mysql-5.0 branch (sergefp:2648) Sergey Petrunia14 Jul