summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Docs/manual.texi3
-rw-r--r--include/my_pthread.h7
-rw-r--r--include/violite.h3
-rw-r--r--innobase/buf/buf0buf.c2
-rw-r--r--libmysqld/lib_sql.cc11
-rw-r--r--mysql-test/r/distinct.result30
-rw-r--r--mysql-test/t/distinct.test24
-rw-r--r--mysys/my_pthread.c31
-rw-r--r--sql/gen_lex_hash.cc12
-rw-r--r--sql/mysqld.cc8
-rw-r--r--sql/sql_select.cc6
-rw-r--r--vio/vio.c2
-rw-r--r--vio/viossl.c10
13 files changed, 121 insertions, 28 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 35bc4e1c21e..33a5e28b6a4 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -50257,6 +50257,9 @@ each individual 4.0.x release.
@itemize @bullet
@item
+Fixed bug in @code{SELECT DISTINCT ... FROM many_tables ORDER BY
+not-used-column}.
+@item
Added @code{QUOTE()} function that performs SQL quoting to produce values
that can be used as data values in queries.
@item
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 9cf337702f7..aac0222c136 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -430,11 +430,14 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#undef pthread_cond_timedwait
-#undef pthread_mutex_trylock
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
-#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime);
+#endif
+
+#if defined(HAVE_POSIX1003_4a_MUTEX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
+#undef pthread_mutex_trylock
+#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif
diff --git a/include/violite.h b/include/violite.h
index 6b73dbcb943..6dd7b765071 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -137,8 +137,6 @@ void vio_ssl_delete(Vio* vio);
int vio_ssl_read(Vio* vio,gptr buf, int size);
int vio_ssl_write(Vio* vio,const gptr buf,int size);
-int vio_ssl_blocking(Vio* vio,my_bool onoff);
-my_bool vio_ssl_is_blocking(Vio* vio);
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */
int vio_ssl_fastsend(Vio* vio);
@@ -152,6 +150,7 @@ int vio_ssl_close(Vio* vio);
int vio_ssl_errno(Vio *vio);
my_bool vio_ssl_peer_addr(Vio* vio, char *buf);
void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
+int vio_ssl_blocking(Vio * vio, my_bool set_blocking_mode, my_bool *old_mode);
/* Single copy for server */
enum vio_ssl_acceptorfd_state
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index 8b946f4b2a1..ee8e8b91f8d 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -285,7 +285,7 @@ buf_page_print(
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Page dump in ascii and hex (%u bytes):\n%s",
+ " InnoDB: Page dump in ascii and hex (%lu bytes):\n%s",
(ulint)UNIV_PAGE_SIZE, buf);
fprintf(stderr, "InnoDB: End of page dump\n");
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 8922b8326d3..0774254baa7 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -551,9 +551,14 @@ int STDCALL mysql_server_init(int argc, char **argv, char **groups)
sql_print_error("Warning: Can't create thread to manage maintenance");
}
- /* Update mysqld variables from client variables */
- global_system_variables.max_allowed_packet=max_allowed_packet;
- global_system_variables.net_buffer_length=net_buffer_length;
+ /*
+ Update mysqld variables from client variables if set
+ The client variables are set also by get_one_option() in mysqld.cc
+ */
+ if (max_allowed_packet)
+ global_system_variables.max_allowed_packet= max_allowed_packet;
+ if (net_buffer_length)
+ global_system_variables.net_buffer_length= net_buffer_length;
return 0;
}
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index e347a95b037..312e7893949 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -349,3 +349,33 @@ select distinct a from t1 where a >= '1' order by a desc;
a
1
drop table t1;
+CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered
+DATETIME);
+CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
+INSERT INTO t1 (email, infoID, dateentered) VALUES
+('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
+('test1@testdomain.com', 1, '2002-07-27 22:58:16'),
+('test2@testdomain.com', 1, '2002-06-19 15:22:19'),
+('test2@testdomain.com', 2, '2002-06-18 14:23:47'),
+('test3@testdomain.com', 1, '2002-05-19 22:17:32');
+INSERT INTO t2(infoID, shipcode) VALUES
+(1, 'Z001'),
+(2, 'R002');
+SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
+email shipcode
+test1@testdomain.com Z001
+test2@testdomain.com Z001
+test3@testdomain.com Z001
+test2@testdomain.com R002
+SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
+email
+test1@testdomain.com
+test2@testdomain.com
+test3@testdomain.com
+SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
+email shipcode
+test1@testdomain.com Z001
+test2@testdomain.com Z001
+test2@testdomain.com R002
+test3@testdomain.com Z001
+drop table t1,t2;
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index b850ec5d562..e4503b0cf72 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -218,3 +218,27 @@ select * from t1 where a >= '1';
select distinct a from t1 order by a desc;
select distinct a from t1 where a >= '1' order by a desc;
drop table t1;
+
+#
+# Test when using a not previously used column in ORDER BY
+#
+
+CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered
+DATETIME);
+CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
+
+INSERT INTO t1 (email, infoID, dateentered) VALUES
+ ('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
+ ('test1@testdomain.com', 1, '2002-07-27 22:58:16'),
+ ('test2@testdomain.com', 1, '2002-06-19 15:22:19'),
+ ('test2@testdomain.com', 2, '2002-06-18 14:23:47'),
+ ('test3@testdomain.com', 1, '2002-05-19 22:17:32');
+
+INSERT INTO t2(infoID, shipcode) VALUES
+ (1, 'Z001'),
+ (2, 'R002');
+
+SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
+SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
+SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
+drop table t1,t2;
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index d9487de638e..9abe5d22c92 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -17,6 +17,7 @@
/* Functions to get threads more portable */
#define DONT_REMAP_PTHREAD_FUNCTIONS
+
#include "mysys_priv.h"
#ifdef THREAD
#include <signal.h>
@@ -372,16 +373,33 @@ int pthread_signal(int sig, void (*func)())
sigaction(sig, &sact, (struct sigaction*) 0);
return 0;
}
-
#endif
+/****************************************************************************
+ The following functions fixes that all pthread functions should work
+ according to latest posix standard
+****************************************************************************/
+
+/* Undefined wrappers set my_pthread.h so that we call os functions */
+#undef pthread_mutex_init
+#undef pthread_mutex_lock
+#undef pthread_mutex_unlock
+#undef pthread_mutex_destroy
+#undef pthread_mutex_wait
+#undef pthread_mutex_timedwait
+#undef pthread_mutex_t
+#undef pthread_cond_wait
+#undef pthread_cond_timedwait
+#undef pthread_mutex_trylock
+#undef pthread_mutex_t
+#undef pthread_cond_t
+
+
/*****************************************************************************
** Patches for AIX and DEC OSF/1 3.2
*****************************************************************************/
#if (defined(HAVE_NONPOSIX_PTHREAD_MUTEX_INIT) && !defined(HAVE_UNIXWARE7_THREADS)) || defined(HAVE_DEC_3_2_THREADS)
-#undef pthread_mutex_init
-#undef pthread_cond_init
#include <netdb.h>
@@ -419,7 +437,6 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
****************************************************************************/
#if defined(HPUX) || defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
-#undef pthread_cond_timedwait
int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime)
@@ -462,13 +479,13 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
RETURN VALUES
0 If we are able successfully lock the mutex.
EBUSY Mutex was locked by another thread
- != errno set by pthread_mutex_trylock()
+ # Other error number returned by pthread_mutex_trylock()
+ (Not likely)
*/
-#undef pthread_mutex_trylock
int my_pthread_mutex_trylock(pthread_mutex_t *mutex)
{
- int error=pthread_mutex_trylock(mutex);
+ int error= pthread_mutex_trylock(mutex);
if (error == 1)
return 0; /* Got lock on mutex */
if (error == 0) /* Someon else is locking mutex */
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index c61a75ab880..bd48c65586a 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -73,15 +73,6 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"version", 'V', "Output version information and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"rnd1", 'r', "Set 1 part of rnd value for hash generator",
- (gptr*) &best_t1, (gptr*) &best_t1, 0, GET_ULONG, REQUIRED_ARG, 5075635L,
- 0, 0, 0, 0, 0},
- {"rnd2", 'R', "Set 2 part of rnd value for hash generator",
- (gptr*) &best_t2, (gptr*) &best_t2, 0, GET_ULONG, REQUIRED_ARG, 1345933L,
- 0, 0, 0, 0, 0},
- {"type", 't', "Set type of char table to generate",
- (gptr*) &best_type, (gptr*) &best_type, 0, GET_UINT, REQUIRED_ARG, 4, 0, 0,
- 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -478,8 +469,7 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
-
- start_value=3807640L; /* mode=6971 add=3 type: 0 */
+ start_value=7281255L; best_t1=4459515L; best_t2=321142L; best_type=2; /* mode=5953 add=7 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 705f843dec0..d94d702cdc8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3970,6 +3970,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
safemalloc_mem_limit = atoi(argument);
#endif
break;
+#ifdef EMBEDDED_LIBRARY
+ case OPT_MAX_ALLOWED_PACKET:
+ max_allowed_packet= atoi(argument);
+ break;
+ case OPT_NET_BUFFER_LENGTH:
+ net_buffer_length= atoi(argument);
+ break;
+#endif
case 'v':
case 'V':
print_version();
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ab9cbaae8e7..6adf680b6f1 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -641,6 +641,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
DBUG_PRINT("info",("Creating tmp table"));
thd->proc_info="Creating tmp table";
+ join.tmp_table_param.hidden_field_count=(all_fields.elements-
+ fields.elements);
if (!(tmp_table =
create_tmp_table(thd,&join.tmp_table_param,all_fields,
((!simple_group && !procedure &&
@@ -3862,6 +3864,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
'param->hidden_field_count' extra columns, whose null bits are stored
in the first 'hidden_null_pack_length' bytes of the row.
*/
+ DBUG_PRINT("info",("hidden_field_count: %d", param->hidden_field_count));
+
null_pack_length-=hidden_null_pack_length;
keyinfo->key_parts= ((field_count-param->hidden_field_count)+
test(null_pack_length));
@@ -3884,7 +3888,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
goto err;
table->key_info=keyinfo;
keyinfo->key_part=key_part_info;
- keyinfo->flags=HA_NOSAME|HA_NULL_ARE_EQUAL;
+ keyinfo->flags=HA_NOSAME | HA_NULL_ARE_EQUAL;
keyinfo->key_length=(uint16) reclength;
keyinfo->name=(char*) "tmp";
if (null_pack_length)
diff --git a/vio/vio.c b/vio/vio.c
index bb97f195110..445aec3e3a7 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -60,7 +60,7 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
vio->vioclose =vio_ssl_close;
vio->peer_addr =vio_ssl_peer_addr;
vio->in_addr =vio_ssl_in_addr;
- vio->vioblocking =vio_blocking;
+ vio->vioblocking =vio_ssl_blocking;
vio->is_blocking =vio_is_blocking;
}
else /* default is VIO_TYPE_TCPIP */
diff --git a/vio/viossl.c b/vio/viossl.c
index 7365bdc3daf..6d4f5450148 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -362,4 +362,14 @@ void sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* vio, long timeout)
DBUG_VOID_RETURN;
}
+
+int vio_ssl_blocking(Vio * vio __attribute__((unused)),
+ my_bool set_blocking_mode,
+ my_bool *old_mode)
+{
+ /* Return error if we try to change to non_blocking mode */
+ *old_mode=1; /* Mode is always blocking */
+ return set_blocking_mode ? 0 : 1;
+}
+
#endif /* HAVE_OPENSSL */