List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:October 13 2005 2:33am
Subject:bk commit into 5.0 tree (jimw:1.2044)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2044 05/10/12 17:33:11 jimw@stripped +20 -0
  Merge mysql.com:/home/jimw/my/mysql-4.1-clean
  into  mysql.com:/home/jimw/my/mysql-5.0-clean

  sql/sql_select.cc
    1.379 05/10/12 17:33:07 jimw@stripped +1 -2
    Resolve conflict

  sql/sql_lex.cc
    1.171 05/10/12 17:33:07 jimw@stripped +1 -1
    Resolve conflict

  sql/mysqld.cc
    1.513 05/10/12 17:33:07 jimw@stripped +0 -0
    Resolve conflict

  sql/item.cc
    1.188 05/10/12 17:33:07 jimw@stripped +15 -19
    Resolve conflict

  mysql-test/t/select.test
    1.83 05/10/12 17:33:07 jimw@stripped +91 -0
    Resolve conflict

  mysql-test/r/select.result
    1.100 05/10/12 17:33:07 jimw@stripped +243 -10
    Resolve conflict

  mysql-test/r/cast.result
    1.34 05/10/12 17:33:07 jimw@stripped +0 -0
    Resolve conflict

  vio/viosocket.c
    1.36 05/10/12 17:26:28 jimw@stripped +0 -0
    Auto merged

  vio/vio.c
    1.24 05/10/12 17:26:28 jimw@stripped +0 -0
    Auto merged

  strings/xml.c
    1.8 05/10/12 17:26:28 jimw@stripped +0 -0
    Auto merged

  sql/sql_lex.h
    1.200 05/10/12 17:26:28 jimw@stripped +0 -0
    Auto merged

  sql/item_strfunc.cc
    1.258 05/10/12 17:26:28 jimw@stripped +0 -0
    Auto merged

  sql/item.h
    1.174 05/10/12 17:26:27 jimw@stripped +0 -0
    Auto merged

  mysys/thr_alarm.c
    1.48 05/10/12 17:26:27 jimw@stripped +0 -0
    Auto merged

  mysys/my_pthread.c
    1.43 05/10/12 17:26:27 jimw@stripped +0 -0
    Auto merged

  mysql-test/t/kill.test
    1.17 05/10/12 17:26:27 jimw@stripped +0 -0
    Auto merged

  mysql-test/t/cast.test
    1.26 05/10/12 17:26:27 jimw@stripped +0 -0
    Auto merged

  include/my_pthread.h
    1.87 05/10/12 17:26:27 jimw@stripped +0 -0
    Auto merged

  include/config-win.h
    1.68 05/10/12 17:26:27 jimw@stripped +0 -0
    Auto merged

  configure.in
    1.353 05/10/12 17:26:27 jimw@stripped +0 -0
    Auto merged

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-clean/RESYNC

--- 1.352/configure.in	2005-10-10 08:50:12 -07:00
+++ 1.353/configure.in	2005-10-12 17:26:27 -07:00
@@ -1021,7 +1021,7 @@
   *darwin5*)
     if test "$ac_cv_prog_gcc" = "yes"
     then
-      FLAGS="-traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE
-DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
+      FLAGS="-traditional-cpp -DHAVE_DARWIN5_THREADS -D_P1003_1B_VISIBLE
-DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
       CFLAGS="$CFLAGS $FLAGS"
       CXXFLAGS="$CXXFLAGS $FLAGS"
       MAX_C_OPTIMIZE="-O"
@@ -1031,23 +1031,13 @@
   *darwin6*)
     if test "$ac_cv_prog_gcc" = "yes"
     then
-      FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE
-DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
+      FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ
-DHAVE_BROKEN_REALPATH"
       CFLAGS="$CFLAGS $FLAGS"
       CXXFLAGS="$CXXFLAGS $FLAGS"
       MAX_C_OPTIMIZE="-O"
     fi
     ;;
-  *darwin[[7-8]]*)
-    # don't forget to escape [] like above
-    if test "$ac_cv_prog_gcc" = "yes"
-    then
-      FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE
-DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT"
-      CFLAGS="$CFLAGS $FLAGS"
-      CXXFLAGS="$CXXFLAGS $FLAGS"
-      MAX_C_OPTIMIZE="-O"
-    fi
-    ;;
-  *darwin9*)
+  *darwin*)
     if test "$ac_cv_prog_gcc" = "yes"
     then
       FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ
-DIGNORE_SIGHUP_SIGQUIT"

--- 1.67/include/config-win.h	2005-08-01 15:04:34 -07:00
+++ 1.68/include/config-win.h	2005-10-12 17:26:27 -07:00
@@ -193,7 +193,7 @@
 
 /* Convert some simple functions to Posix */
 
-#define sigset(A,B) signal((A),(B))
+#define my_sigset(A,B) signal((A),(B))
 #define finite(A) _finite(A)
 #define sleep(A)  Sleep((A)*1000)
 #define popen(A) popen(A,B) _popen((A),(B))

--- 1.86/include/my_pthread.h	2005-10-08 07:39:38 -07:00
+++ 1.87/include/my_pthread.h	2005-10-12 17:26:27 -07:00
@@ -292,8 +292,6 @@
 #undef HAVE_PTHREAD_RWLOCK_RDLOCK
 #undef HAVE_SNPRINTF
 
-#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
-#define signal(A,B) pthread_signal((A),(void (*)(int)) (B))
 #define my_pthread_attr_setprio(A,B)
 #endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
 
@@ -325,14 +323,26 @@
 #if !defined(HAVE_SIGWAIT) && !defined(HAVE_mit_thread) &&
!defined(HAVE_rts_threads) && !defined(sigwait) &&
!defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) &&
!defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
 int sigwait(sigset_t *setp, int *sigp);		/* Use our implemention */
 #endif
-#if !defined(HAVE_SIGSET) && !defined(HAVE_mit_thread) &&
!defined(sigset)
-#define sigset(A,B) do { struct sigaction s; sigset_t set;              \
-                         sigemptyset(&set);                             \
-                         s.sa_handler = (B);                            \
-                         s.sa_mask    = set;                            \
-                         s.sa_flags   = 0;                              \
-                         sigaction((A), &s, (struct sigaction *) NULL); \
-                       } while (0)
+
+
+/*
+  We define my_sigset() and use that instead of the system sigset() so that
+  we can favor an implementation based on sigaction(). On some systems, such
+  as Mac OS X, sigset() results in flags such as SA_RESTART being set, and
+  we want to make sure that no such flags are set.
+*/
+#if defined(HAVE_SIGACTION) && !defined(my_sigset)
+#define my_sigset(A,B) do { struct sigaction s; sigset_t set;              \
+                            sigemptyset(&set);                             \
+                            s.sa_handler = (B);                            \
+                            s.sa_mask    = set;                            \
+                            s.sa_flags   = 0;                              \
+                            sigaction((A), &s, (struct sigaction *) NULL); \
+                          } while (0)
+#elif defined(HAVE_SIGSET) && !defined(my_sigset)
+#define my_sigset(A,B) sigset((A),(B))
+#elif !defined(my_sigset)
+#define my_sigset(A,B) signal((A),(B))
 #endif
 
 #ifndef my_pthread_setprio
@@ -412,16 +422,13 @@
 #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ;
pthread_detach(&tmp); }
 #endif
 
-#ifdef HAVE_DARWIN_THREADS
+#ifdef HAVE_DARWIN5_THREADS
 #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
 #define pthread_kill(A,B) pthread_dummy(0)
 #define pthread_condattr_init(A) pthread_dummy(0)
 #define pthread_condattr_destroy(A) pthread_dummy(0)
-#define pthread_signal(A,B) pthread_dummy(0)
 #undef	pthread_detach_this_thread
 #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ;
pthread_detach(tmp); }
-#undef sigset
-#define sigset(A,B) pthread_signal((A),(void (*)(int)) (B))
 #endif
 
 #if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) ||
defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)

--- 1.42/mysys/my_pthread.c	2004-07-06 04:34:13 -07:00
+++ 1.43/mysys/my_pthread.c	2005-10-12 17:26:27 -07:00
@@ -404,23 +404,6 @@
 #endif /* DONT_USE_SIGSUSPEND */
 #endif /* HAVE_SIGWAIT */
 
-/*****************************************************************************
-** Implement pthread_signal for systems that can't use signal() with threads
-** Currently this is only used with BSDI 3.0
-*****************************************************************************/
-
-#ifdef USE_PTHREAD_SIGNAL
-
-int pthread_signal(int sig, void (*func)())
-{
-  struct sigaction sact;
-  sact.sa_flags= 0;
-  sact.sa_handler= func;
-  sigemptyset(&sact.sa_mask);
-  sigaction(sig, &sact, (struct sigaction*) 0);
-  return 0;
-}
-#endif
 
 /****************************************************************************
  The following functions fixes that all pthread functions should work

--- 1.47/mysys/thr_alarm.c	2005-07-03 03:03:15 -07:00
+++ 1.48/mysys/thr_alarm.c	2005-10-12 17:26:27 -07:00
@@ -80,17 +80,7 @@
   pthread_mutex_init(&LOCK_alarm,MY_MUTEX_INIT_FAST);
   pthread_cond_init(&COND_alarm,NULL);
 #if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
-#if defined(HAVE_mit_thread)
-  sigset(THR_CLIENT_ALARM,thread_alarm);	/* int. thread system calls */
-#else
-  {
-    struct sigaction sact;
-    sact.sa_flags = 0;
-    bzero((char*) &sact, sizeof(sact));
-    sact.sa_handler = thread_alarm;
-    sigaction(THR_CLIENT_ALARM, &sact, (struct sigaction*) 0);
-  }
-#endif
+  my_sigset(THR_CLIENT_ALARM,thread_alarm);
 #endif
   sigemptyset(&s);
   sigaddset(&s, THR_SERVER_ALARM);
@@ -110,12 +100,12 @@
 #elif defined(USE_ONE_SIGNAL_HAND)
   pthread_sigmask(SIG_BLOCK, &s, NULL);		/* used with sigwait() */
 #if THR_SERVER_ALARM == THR_CLIENT_ALARM
-  sigset(THR_CLIENT_ALARM,process_alarm);	/* Linuxthreads */
+  my_sigset(THR_CLIENT_ALARM,process_alarm);	/* Linuxthreads */
   pthread_sigmask(SIG_UNBLOCK, &s, NULL);
 #endif
 #else
+  my_sigset(THR_SERVER_ALARM, process_alarm);
   pthread_sigmask(SIG_UNBLOCK, &s, NULL);
-  sigset(THR_SERVER_ALARM,process_alarm);
 #endif
   DBUG_VOID_RETURN;
 }
@@ -290,7 +280,7 @@
     printf("thread_alarm\n"); fflush(stdout);
 #endif
 #ifdef DONT_REMEMBER_SIGNAL
-    sigset(THR_CLIENT_ALARM,process_alarm);	/* int. thread system calls */
+    my_sigset(THR_CLIENT_ALARM,process_alarm);	/* int. thread system calls */
 #endif
     return;
   }
@@ -310,7 +300,7 @@
   process_alarm_part2(sig);
 #ifndef USE_ALARM_THREAD
 #if defined(DONT_REMEMBER_SIGNAL) && !defined(USE_ONE_SIGNAL_HAND)
-  sigset(THR_SERVER_ALARM,process_alarm);
+  my_sigset(THR_SERVER_ALARM,process_alarm);
 #endif
   pthread_mutex_unlock(&LOCK_alarm);
   pthread_sigmask(SIG_SETMASK,&old_mask,NULL);
@@ -512,7 +502,7 @@
   printf("thread_alarm\n"); fflush(stdout);
 #endif
 #ifdef DONT_REMEMBER_SIGNAL
-  sigset(sig,thread_alarm);		/* int. thread system calls */
+  my_sigset(sig,thread_alarm);		/* int. thread system calls */
 #endif
 }
 #endif
@@ -916,7 +906,7 @@
   printf("Warning: Got signal %d from thread %s\n",sig,my_thread_name());
   fflush(stdout);
 #ifdef DONT_REMEMBER_SIGNAL
-  sigset(sig,print_signal_warning);		/* int. thread system calls */
+  my_sigset(sig,print_signal_warning);		/* int. thread system calls */
 #endif
 #ifndef OS2
   if (sig == SIGALRM)

--- 1.173/sql/item.h	2005-10-11 14:58:18 -07:00
+++ 1.174/sql/item.h	2005-10-12 17:26:27 -07:00
@@ -1331,6 +1331,14 @@
   longlong val_int()
   {
     DBUG_ASSERT(fixed == 1);
+    if (value <= (double) LONGLONG_MIN)
+    {
+       return LONGLONG_MIN;
+    }
+    else if (value >= (double) (ulonglong) LONGLONG_MAX)
+    {
+      return LONGLONG_MAX;
+    }
     return (longlong) (value+(value > 0 ? 0.5 : -0.5));
   }
   String *val_str(String*);

--- 1.257/sql/item_strfunc.cc	2005-10-11 14:58:18 -07:00
+++ 1.258/sql/item_strfunc.cc	2005-10-12 17:26:28 -07:00
@@ -1504,7 +1504,13 @@
     salt_ptr= salt_str->c_ptr();
   }
   pthread_mutex_lock(&LOCK_crypt);
-  char *tmp=crypt(res->c_ptr(),salt_ptr);
+  char *tmp= crypt(res->c_ptr(),salt_ptr);
+  if (!tmp)
+  {
+    pthread_mutex_unlock(&LOCK_crypt);
+    null_value= 1;
+    return 0;
+  }
   str->set(tmp,(uint) strlen(tmp),res->charset());
   str->copy();
   pthread_mutex_unlock(&LOCK_crypt);

--- 1.512/sql/mysqld.cc	2005-10-12 01:17:29 -07:00
+++ 1.513/sql/mysqld.cc	2005-10-12 17:33:07 -07:00
@@ -928,7 +928,7 @@
     RETURN_FROM_KILL_SERVER;
   kill_in_progress=TRUE;
   abort_loop=1;					// This should be set
-  signal(sig,SIG_IGN);
+  my_sigset(sig,SIG_IGN);
   if (sig == MYSQL_KILL_SIGNAL || sig == 0)
     sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname);
   else
@@ -977,11 +977,6 @@
 }
 #endif
 
-#if defined(__amiga__)
-#undef sigset
-#define sigset signal
-#endif
-
 extern "C" sig_handler print_signal_warning(int sig)
 {
   if (!DBUG_IN_USE)
@@ -991,7 +986,7 @@
 		      sig,my_thread_id());
   }
 #ifdef DONT_REMEMBER_SIGNAL
-  sigset(sig,print_signal_warning);		/* int. thread system calls */
+  my_sigset(sig,print_signal_warning);		/* int. thread system calls */
 #endif
 #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
   if (sig == SIGALRM)
@@ -1642,23 +1637,6 @@
 }
 
 
-/*
-  Aborts a thread nicely. Commes here on SIGPIPE
-  TODO: One should have to fix that thr_alarm know about this
-  thread too.
-*/
-
-#ifdef THREAD_SPECIFIC_SIGPIPE
-extern "C" sig_handler abort_thread(int sig __attribute__((unused)))
-{
-  THD *thd=current_thd;
-  DBUG_ENTER("abort_thread");
-  if (thd)
-    thd->killed= THD::KILL_CONNECTION;
-  DBUG_VOID_RETURN;
-}
-#endif
-
 /******************************************************************************
   Setup a signal thread with handles all signals.
   Because Linux doesn't support schemas use a mutex to check that
@@ -2074,8 +2052,8 @@
   DBUG_ENTER("init_signals");
 
   if (test_flags & TEST_SIGINT)
-    sigset(THR_KILL_SIGNAL,end_thread_signal);
-  sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
+    my_sigset(THR_KILL_SIGNAL,end_thread_signal);
+  my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
 
   if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL))
   {
@@ -2109,13 +2087,8 @@
   }
 #endif
   (void) sigemptyset(&set);
-#ifdef THREAD_SPECIFIC_SIGPIPE
-  sigset(SIGPIPE,abort_thread);
-  sigaddset(&set,SIGPIPE);
-#else
-  (void) signal(SIGPIPE,SIG_IGN);		// Can't know which thread
+  my_sigset(SIGPIPE,SIG_IGN);
   sigaddset(&set,SIGPIPE);
-#endif
   sigaddset(&set,SIGINT);
 #ifndef IGNORE_SIGHUP_SIGQUIT
   sigaddset(&set,SIGQUIT);

--- 1.170/sql/sql_lex.cc	2005-09-28 02:34:49 -07:00
+++ 1.171/sql/sql_lex.cc	2005-10-12 17:33:07 -07:00
@@ -1136,6 +1136,7 @@
   first_execution= 1;
   first_cond_optimization= 1;
   parsing_place= NO_MATTER;
+  is_item_list_lookup= 0;
   exclude_from_table_unique_test= no_wrap_view_item= FALSE;
   link_next= 0;
 }
@@ -1165,6 +1166,7 @@
   select_limit= 0;      /* denotes the default limit = HA_POS_ERROR */
   offset_limit= 0;      /* denotes the default offset = 0 */
   with_sum_func= 0;
+
 }
 
 /*

--- 1.199/sql/sql_lex.h	2005-09-22 13:46:50 -07:00
+++ 1.200/sql/sql_lex.h	2005-10-12 17:26:28 -07:00
@@ -482,6 +482,7 @@
   List<Item>          item_list;  /* list of fields & expressions */
   List<String>        interval_list, use_index, *use_index_ptr,
 		      ignore_index, *ignore_index_ptr;
+  bool	              is_item_list_lookup;
   /* 
     Usualy it is pointer to ftfunc_list_alloc, but in union used to create fake
     select_lex for calling mysql_select under results of union

--- 1.378/sql/sql_select.cc	2005-10-11 14:59:48 -07:00
+++ 1.379/sql/sql_select.cc	2005-10-12 17:33:07 -07:00
@@ -11895,12 +11895,16 @@
     We check order_item->fixed because Item_func_group_concat can put
     arguments for which fix_fields already was called.
   */
+  thd->lex->current_select->is_item_list_lookup= 1;
   if (!order_item->fixed &&
       (order_item->fix_fields(thd, order->item) ||
        (order_item= *order->item)->check_cols(1) ||
        thd->is_fatal_error))
+  {
+    thd->lex->current_select->is_item_list_lookup= 0;
     return TRUE; /* Wrong field. */
-
+  }
+  thd->lex->current_select->is_item_list_lookup= 0;
   uint el= all_fields.elements;
   all_fields.push_front(order_item); /* Add new field to field list. */
   ref_pointer_array[el]= order_item;

--- 1.7/strings/xml.c	2005-07-03 17:42:24 -07:00
+++ 1.8/strings/xml.c	2005-10-12 17:26:28 -07:00
@@ -81,7 +81,7 @@
   a->beg=p->cur;
   a->end=p->cur;
   
-  if (!bcmp(p->cur,"<!--",4))
+  if ((p->end - p->cur > 3) && !bcmp(p->cur,"<!--",4))
   {
     for( ; (p->cur < p->end) && bcmp(p->cur, "-->", 3);
p->cur++)
     {}

--- 1.99/mysql-test/r/select.result	2005-10-10 10:38:25 -07:00
+++ 1.100/mysql-test/r/select.result	2005-10-12 17:33:07 -07:00
@@ -2737,6 +2737,249 @@
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	
 1	SIMPLE	t2	ref	a	a	23	test.t1.a	2	
 DROP TABLE t1, t2;
+CREATE TABLE t1 ( city char(30) );
+INSERT INTO t1 VALUES ('London');
+INSERT INTO t1 VALUES ('Paris');
+SELECT * FROM t1 WHERE city='London';
+city
+London
+SELECT * FROM t1 WHERE city='london';
+city
+London
+EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
+SELECT * FROM t1 WHERE city='London' AND city='london';
+city
+London
+EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
+SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
+city
+London
+DROP TABLE t1;
+create table t1 (a int(11) unsigned, b int(11) unsigned);
+insert into t1 values (1,0), (1,1), (1,2);
+select a-b  from t1 order by 1;
+a-b
+0
+1
+18446744073709551615
+select a-b , (a-b < 0)  from t1 order by 1;
+a-b	(a-b < 0)
+0	0
+1	0
+18446744073709551615	0
+select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
+d	(a-b >= 0)	b
+1	1	0
+0	1	1
+18446744073709551615	1	2
+select cast((a - b) as unsigned) from t1 order by 1;
+cast((a - b) as unsigned)
+0
+1
+18446744073709551615
+drop table t1;
+create table t1 (a int(11));
+select all all * from t1;
+a
+select distinct distinct * from t1;
+a
+select all distinct * from t1;
+ERROR HY000: Incorrect usage of ALL and DISTINCT
+select distinct all * from t1;
+ERROR HY000: Incorrect usage of ALL and DISTINCT
+drop table t1;
+CREATE TABLE t1 (
+kunde_intern_id int(10) unsigned NOT NULL default '0',
+kunde_id int(10) unsigned NOT NULL default '0',
+FK_firma_id int(10) unsigned NOT NULL default '0',
+aktuell enum('Ja','Nein') NOT NULL default 'Ja',
+vorname varchar(128) NOT NULL default '',
+nachname varchar(128) NOT NULL default '',
+geloescht enum('Ja','Nein') NOT NULL default 'Nein',
+firma varchar(128) NOT NULL default ''
+);
+INSERT INTO t1 VALUES 
+(3964,3051,1,'Ja','Vorname1','1Nachname','Nein','Print Schau XXXX'),
+(3965,3051111,1,'Ja','Vorname1111','1111Nachname','Nein','Print Schau XXXX');
+SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname, geloescht FROM t1
+WHERE
+(
+(
+( '' != '' AND firma LIKE CONCAT('%', '', '%'))
+OR
+(vorname LIKE CONCAT('%', 'Vorname1', '%') AND 
+nachname LIKE CONCAT('%', '1Nachname', '%') AND 
+'Vorname1' != '' AND 'xxxx' != '')
+)
+AND
+(
+aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
+)
+)
+;
+kunde_id	FK_firma_id	aktuell	vorname	nachname	geloescht
+SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname,
+geloescht FROM t1
+WHERE
+(
+(
+aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
+)
+AND
+(
+( '' != '' AND firma LIKE CONCAT('%', '', '%')  )
+OR
+(  vorname LIKE CONCAT('%', 'Vorname1', '%') AND
+nachname LIKE CONCAT('%', '1Nachname', '%') AND 'Vorname1' != '' AND
+'xxxx' != '')
+)
+)
+;
+kunde_id	FK_firma_id	aktuell	vorname	nachname	geloescht
+SELECT COUNT(*) FROM t1 WHERE 
+( 0 OR (vorname LIKE '%Vorname1%' AND nachname LIKE '%1Nachname%' AND 1)) 
+AND FK_firma_id = 2;
+COUNT(*)
+0
+drop table t1;
+CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b));
+INSERT INTO t1 VALUES (0x8000000000000000);
+SELECT b FROM t1 WHERE b=0x8000000000000000;
+b
+9223372036854775808
+DROP TABLE t1;
+CREATE TABLE `t1` ( `gid` int(11) default NULL, `uid` int(11) default NULL);
+CREATE TABLE `t2` ( `ident` int(11) default NULL, `level` char(16) default NULL);
+INSERT INTO `t2` VALUES (0,'READ');
+CREATE TABLE `t3` ( `id` int(11) default NULL, `name` char(16) default NULL);
+INSERT INTO `t3` VALUES (1,'fs');
+select * from t3 left join t1 on t3.id = t1.uid, t2 where t2.ident in (0, t1.gid, t3.id,
0);
+id	name	gid	uid	ident	level
+1	fs	NULL	NULL	0	READ
+drop table t1,t2,t3;
+CREATE TABLE t1 (
+acct_id int(11) NOT NULL default '0',
+profile_id smallint(6) default NULL,
+UNIQUE KEY t1$acct_id (acct_id),
+KEY t1$profile_id (profile_id)
+);
+INSERT INTO t1 VALUES (132,17),(133,18);
+CREATE TABLE t2 (
+profile_id smallint(6) default NULL,
+queue_id int(11) default NULL,
+seq int(11) default NULL,
+KEY t2$queue_id (queue_id)
+);
+INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1);
+CREATE TABLE t3 (
+id int(11) NOT NULL default '0',
+qtype int(11) default NULL,
+seq int(11) default NULL,
+warn_lvl int(11) default NULL,
+crit_lvl int(11) default NULL,
+rr1 tinyint(4) NOT NULL default '0',
+rr2 int(11) default NULL,
+default_queue tinyint(4) NOT NULL default '0',
+KEY t3$qtype (qtype),
+KEY t3$id (id)
+);
+INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0),
+(36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0);
+SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q 
+WHERE 
+(pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND 
+(pq.queue_id = q.id) AND (q.rr1 <> 1);
+COUNT(*)
+4
+drop table t1,t2,t3;
+create table t1 (f1 int);
+insert into t1 values (1),(NULL);
+create table t2 (f2 int, f3 int, f4 int);
+create index idx1 on t2 (f4);
+insert into t2 values (1,2,3),(2,4,6);
+select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
+from  t2 C where A.f4 = C.f4) or A.f3 IS NULL;
+f2
+1
+NULL
+drop table t1,t2;
+create table t2 (a tinyint unsigned);
+create index t2i on t2(a);
+insert into t2 values (0), (254), (255);
+explain select * from t2 where a > -1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	index	t2i	t2i	2	NULL	3	Using where; Using index
+select * from t2 where a > -1;
+a
+0
+254
+255
+drop table t2;
+CREATE TABLE t1 (a int, b int, c int);
+INSERT INTO t1
+SELECT 50, 3, 3 FROM DUAL
+WHERE NOT EXISTS
+(SELECT * FROM t1 WHERE a = 50 AND b = 3);
+SELECT * FROM t1;
+a	b	c
+50	3	3
+INSERT INTO t1
+SELECT 50, 3, 3 FROM DUAL
+WHERE NOT EXISTS
+(SELECT * FROM t1 WHERE a = 50 AND b = 3);
+select found_rows();
+found_rows()
+0
+SELECT * FROM t1;
+a	b	c
+50	3	3
+select count(*) from t1;
+count(*)
+1
+select found_rows();
+found_rows()
+1
+select count(*) from t1 limit 2,3;
+count(*)
+select found_rows();
+found_rows()
+0
+select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3;
+count(*)
+select found_rows();
+found_rows()
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+(SELECT a, b AS c FROM t1) ORDER BY c+1;
+a	c
+(SELECT a, b AS c FROM t1) ORDER BY b+1;
+a	c
+SELECT a, b AS c FROM t1 ORDER BY c+1;
+a	c
+SELECT a, b AS c FROM t1 ORDER BY b+1;
+a	c
+drop table t1;
+create table t1(f1 int, f2 int);
+create table t2(f3 int);
+select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
+f1
+select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
+f1
+select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
+f1
+insert into t1 values(1,1),(2,null);
+insert into t2 values(2);
+select * from t1,t2 where f1=f3 and (f1,f2) = (2,null);
+f1	f2	f3
+select * from t1,t2 where f1=f3 and (f1,f2) <=> (2,null);
+f1	f2	f3
+2	NULL	2
+drop table t1,t2;
 create table t1 (a int, b int);
 create table t2 like t1;
 select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1;

--- 1.82/mysql-test/t/select.test	2005-10-10 08:12:23 -07:00
+++ 1.83/mysql-test/t/select.test	2005-10-12 17:33:07 -07:00
@@ -2070,6 +2070,7 @@
 drop table t1;
 
 #
+#
 # Test for Bug#8009, SELECT failed on bigint unsigned when using HEX
 #
 
@@ -2180,6 +2181,63 @@
 select found_rows();
 
 DROP TABLE t1;
+
+# Bug #11482 4.1.12 produces different resultset for a complex query than in
+# previous 4.1.x
+create table t1 (f1 int);
+insert into t1 values (1),(NULL);
+create table t2 (f2 int, f3 int, f4 int);
+create index idx1 on t2 (f4);
+insert into t2 values (1,2,3),(2,4,6);
+select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
+from  t2 C where A.f4 = C.f4) or A.f3 IS NULL; 
+drop table t1,t2;
+
+#
+# Bug #11521 Negative integer keys incorrectly substituted for 0 during
+#            range analysis.
+
+create table t2 (a tinyint unsigned);
+create index t2i on t2(a);
+insert into t2 values (0), (254), (255);
+explain select * from t2 where a > -1;
+select * from t2 where a > -1;
+drop table t2;
+
+#
+# Bug #11745: SELECT ... FROM DUAL with WHERE condition
+#
+
+CREATE TABLE t1 (a int, b int, c int);
+INSERT INTO t1
+  SELECT 50, 3, 3 FROM DUAL
+    WHERE NOT EXISTS
+      (SELECT * FROM t1 WHERE a = 50 AND b = 3);
+SELECT * FROM t1;
+INSERT INTO t1
+  SELECT 50, 3, 3 FROM DUAL
+    WHERE NOT EXISTS
+      (SELECT * FROM t1 WHERE a = 50 AND b = 3);
+select found_rows();
+SELECT * FROM t1;
+select count(*) from t1;
+select found_rows();
+select count(*) from t1 limit 2,3;
+select found_rows();
+select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3;
+select found_rows();
+
+DROP TABLE t1;
+
+#
+# Bug 7672 Unknown column error in order clause
+#
+CREATE TABLE t1 (a INT, b INT);
+(SELECT a, b AS c FROM t1) ORDER BY c+1;
+(SELECT a, b AS c FROM t1) ORDER BY b+1;
+SELECT a, b AS c FROM t1 ORDER BY c+1;
+SELECT a, b AS c FROM t1 ORDER BY b+1;
+drop table t1;
 
 #
 # Bug #13356 assertion failed in resolve_const_item()

--- 1.33/mysql-test/r/cast.result	2005-09-28 04:29:09 -07:00
+++ 1.34/mysql-test/r/cast.result	2005-10-12 17:33:07 -07:00
@@ -334,6 +334,9 @@
 -7335632962598440505
 Warnings:
 Warning	1105	Cast to signed converted positive out-of-range integer to it's negative
complement
+select cast(1.0e+300 as signed int);
+cast(1.0e+300 as signed int)
+9223372036854775807
 select cast('1.2' as decimal(3,2));
 cast('1.2' as decimal(3,2))
 1.20

--- 1.25/mysql-test/t/cast.test	2005-09-28 02:34:49 -07:00
+++ 1.26/mysql-test/t/cast.test	2005-10-12 17:26:27 -07:00
@@ -160,6 +160,11 @@
 select cast(repeat('1',20) as unsigned);
 select cast(repeat('1',20) as signed);
 
+#
+# Bug #13344: cast of large decimal to signed int not handled correctly
+#
+select cast(1.0e+300 as signed int);
+
 # End of 4.1 tests
 
 

--- 1.16/mysql-test/t/kill.test	2005-09-01 08:04:16 -07:00
+++ 1.17/mysql-test/t/kill.test	2005-10-12 17:26:27 -07:00
@@ -25,6 +25,7 @@
 kill @id;
 
 connection con1;
+--sleep 1
 
 # this statement should fail
 --error 2006,2013

--- 1.23/vio/vio.c	2005-09-12 16:55:43 -07:00
+++ 1.24/vio/vio.c	2005-10-12 17:26:28 -07:00
@@ -149,10 +149,18 @@
 	    vio->sd);
 #if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
 #if !defined(NO_FCNTL_NONBLOCK)
-#if defined(__FreeBSD__)
-    fcntl(sd, F_SETFL, vio->fcntl_mode); /* Yahoo! FreeBSD patch */
-#endif
-    vio->fcntl_mode = fcntl(sd, F_GETFL);
+    /*
+      We call fcntl() to set the flags and then immediately read them back
+      to make sure that we and the system are in agreement on the state of
+      things.
+
+      An example of why we need to do this is FreeBSD (and apparently some
+      other BSD-derived systems, like Mac OS X), where the system sometimes
+      reports that the socket is set for non-blocking when it really will
+      block.
+    */
+    fcntl(sd, F_SETFL, vio->fcntl_mode);
+    vio->fcntl_mode= fcntl(sd, F_GETFL);
 #elif defined(HAVE_SYS_IOCTL_H)			/* hpux */
     /* Non blocking sockets doesn't work good on HPUX 11.0 */
     (void) ioctl(sd,FIOSNBIO,0);

--- 1.35/vio/viosocket.c	2005-09-15 11:54:58 -07:00
+++ 1.36/vio/viosocket.c	2005-10-12 17:26:28 -07:00
@@ -138,7 +138,14 @@
     else
       vio->fcntl_mode |= O_NONBLOCK; /* set bit */
     if (old_fcntl != vio->fcntl_mode)
-      r = fcntl(vio->sd, F_SETFL, vio->fcntl_mode);
+    {
+      r= fcntl(vio->sd, F_SETFL, vio->fcntl_mode);
+      if (r == -1)
+      {
+        DBUG_PRINT("info", ("fcntl failed, errno %d", errno));
+        vio->fcntl_mode= old_fcntl;
+      }
+    }
   }
 #else
   r= set_blocking_mode ? 0 : 1;
Thread
bk commit into 5.0 tree (jimw:1.2044)Jim Winstead13 Oct