1 diff -urN mysql-4.1.23/BK/keys mysql-4.1/BK/keys
2 --- mysql-4.1.23/BK/keys 2007-12-02 20:38:52.000000000 +0100
3 +++ mysql-4.1/BK/keys 2007-11-29 23:23:39.000000000 +0100
5 ROOTKEY=3985cf0cwNRCED_XNSCA7RvkLPer2Q
6 -TIPKEY=466e5874F5N8tMqwd_kEmlTPE9UlnA
7 +TIPKEY=47448694WzdmhSoqwUkknsFfid9jmw
8 diff -urN mysql-4.1.23/client/mysqldump.c mysql-4.1/client/mysqldump.c
9 --- mysql-4.1.23/client/mysqldump.c 2007-12-02 20:38:26.000000000 +0100
10 +++ mysql-4.1/client/mysqldump.c 2007-10-04 08:27:01.000000000 +0200
11 @@ -2428,6 +2428,18 @@
12 need the REPEATABLE READ level (not anything lower, for example READ
13 COMMITTED would give one new consistent read per dumped table).
15 + if ((mysql_get_server_version(mysql_con) < 40100) && opt_master_data)
17 + fprintf(stderr, "-- %s: the combination of --single-transaction and "
18 + "--master-data requires a MySQL server version of at least 4.1 "
19 + "(current server's version is %s). %s\n",
20 + ignore_errors ? "Warning" : "Error",
21 + mysql_con->server_version ? mysql_con->server_version : "unknown",
22 + ignore_errors ? "Continuing due to --force, backup may not be consistent across all tables!" : "Aborting.");
27 return (mysql_query_with_error_report(mysql_con, 0,
28 "SET SESSION TRANSACTION ISOLATION "
29 "LEVEL REPEATABLE READ") ||
30 diff -urN mysql-4.1.23/client/mysqltest.c mysql-4.1/client/mysqltest.c
31 --- mysql-4.1.23/client/mysqltest.c 2007-12-02 20:38:52.000000000 +0100
32 +++ mysql-4.1/client/mysqltest.c 2007-06-01 19:57:26.000000000 +0200
33 @@ -1125,6 +1125,50 @@
38 + Remove surrounding chars from string
40 + Return 1 if first character is found but not last
42 +static int strip_surrounding(char* str, char c1, char c2)
46 + /* Check if the first non space character is c1 */
47 + while(*ptr && my_isspace(charset_info, *ptr))
51 + /* Replace it with a space */
54 + /* Last non space charecter should be c2 */
56 + while(*ptr && my_isspace(charset_info, *ptr))
60 + /* Replace it with \0 */
65 + /* Mismatch detected */
73 +static void strip_parentheses(struct st_command *command)
75 + if (strip_surrounding(command->first_argument, '(', ')'))
76 + die("%.*s - argument list started with '%c' must be ended with '%c'",
77 + command->first_word_len, command->query, '(', ')');
81 static byte *get_var_key(const byte* var, uint* len,
82 my_bool __attribute__((unused)) t)
84 @@ -1380,12 +1424,11 @@
85 init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
86 do_eval(&ds_query, query, end, FALSE);
88 - if (mysql_real_query(mysql, ds_query.str, ds_query.length) ||
89 - !(res = mysql_store_result(mysql)))
91 + if (mysql_real_query(mysql, ds_query.str, ds_query.length))
92 die("Error running query '%s': %d %s", ds_query.str,
93 mysql_errno(mysql), mysql_error(mysql));
95 + if (!(res= mysql_store_result(mysql)))
96 + die("Query '%s' didn't return a result set", ds_query.str);
97 dynstr_free(&ds_query);
99 if ((row = mysql_fetch_row(res)) && row[0])
100 @@ -1440,6 +1483,130 @@
105 + Set variable from the result of a field in a query
107 + This function is useful when checking for a certain value
108 + in the output from a query that can't be restricted to only
109 + return some values. A very good example of that is most SHOW
113 + var_set_query_get_value()
116 + let $variable= query_get_value(<query to run>,<column name>,<row no>);
118 + <query to run> - The query that should be sent to the server
119 + <column name> - Name of the column that holds the field be compared
120 + against the expected value
121 + <row no> - Number of the row that holds the field to be
122 + compared against the expected value
126 +void var_set_query_get_value(struct st_command *command, VAR *var)
131 + MYSQL* mysql= &cur_con->mysql;
133 + static DYNAMIC_STRING ds_query;
134 + static DYNAMIC_STRING ds_col;
135 + static DYNAMIC_STRING ds_row;
136 + const struct command_arg query_get_value_args[] = {
137 + "query", ARG_STRING, TRUE, &ds_query, "Query to run",
138 + "column name", ARG_STRING, TRUE, &ds_col, "Name of column",
139 + "row number", ARG_STRING, TRUE, &ds_row, "Number for row",
142 + DBUG_ENTER("var_set_query_get_value");
145 + strip_parentheses(command);
146 + DBUG_PRINT("info", ("query: %s", command->query));
147 + check_command_args(command, command->first_argument, query_get_value_args,
148 + sizeof(query_get_value_args)/sizeof(struct command_arg),
151 + DBUG_PRINT("info", ("query: %s", ds_query.str));
152 + DBUG_PRINT("info", ("col: %s", ds_col.str));
154 + /* Convert row number to int */
155 + if (!str2int(ds_row.str, 10, (long) 0, (long) INT_MAX, &row_no))
156 + die("Invalid row number: '%s'", ds_row.str);
157 + DBUG_PRINT("info", ("row: %s, row_no: %ld", ds_row.str, row_no));
158 + dynstr_free(&ds_row);
160 + /* Remove any surrounding "'s from the query - if there is any */
161 + if (strip_surrounding(ds_query.str, '"', '"'))
162 + die("Mismatched \"'s around query '%s'", ds_query.str);
164 + /* Run the query */
165 + if (mysql_real_query(mysql, ds_query.str, ds_query.length))
166 + die("Error running query '%s': %d %s", ds_query.str,
167 + mysql_errno(mysql), mysql_error(mysql));
168 + if (!(res= mysql_store_result(mysql)))
169 + die("Query '%s' didn't return a result set", ds_query.str);
172 + /* Find column number from the given column name */
174 + uint num_fields= mysql_num_fields(res);
175 + MYSQL_FIELD *fields= mysql_fetch_fields(res);
177 + for (i= 0; i < num_fields; i++)
179 + if (strcmp(fields[i].name, ds_col.str) == 0 &&
180 + strlen(fields[i].name) == ds_col.length)
188 + mysql_free_result(res);
189 + die("Could not find column '%s' in the result of '%s'",
190 + ds_col.str, ds_query.str);
192 + DBUG_PRINT("info", ("Found column %d with name '%s'",
193 + i, fields[i].name));
195 + dynstr_free(&ds_col);
198 + /* Get the value */
201 + const char* value= "No such row";
203 + while ((row= mysql_fetch_row(res)))
205 + if (++rows == row_no)
208 + DBUG_PRINT("info", ("At row %ld, column %d is '%s'",
209 + row_no, col_no, row[col_no]));
210 + /* Found the row to get */
212 + value= row[col_no];
219 + eval_expr(var, value, 0);
221 + dynstr_free(&ds_query);
222 + mysql_free_result(res);
228 void var_copy(VAR *dest, VAR *src)
230 dest->int_val= src->int_val;
231 @@ -1463,26 +1630,47 @@
233 void eval_expr(VAR *v, const char *p, const char **p_end)
235 - static int MIN_VAR_ALLOC= 32; /* MASV why 32? */
238 + DBUG_ENTER("eval_expr");
239 + DBUG_PRINT("enter", ("p: '%s'", p));
244 if ((vp= var_get(p, p_end, 0, 0)))
251 - else if (*p == '`')
255 var_query_set(v, p, p_end);
261 + /* Check if this is a "let $var= query_get_value()" */
262 + const char* get_value_str= "query_get_value";
263 + const size_t len= strlen(get_value_str);
264 + if (strncmp(p, get_value_str, len)==0)
266 + struct st_command command;
267 + memset(&command, 0, sizeof(command));
268 + command.query= (char*)p;
269 + command.first_word_len= len;
270 + command.first_argument= command.query + len;
271 + command.end= (char*)*p_end;
272 + var_set_query_get_value(&command, v);
278 int new_val_len = (p_end && *p_end) ?
279 (int) (*p_end - p) : (int) strlen(p);
280 if (new_val_len + 1 >= v->alloced_len)
282 + static int MIN_VAR_ALLOC= 32;
283 v->alloced_len = (new_val_len < MIN_VAR_ALLOC - 1) ?
284 MIN_VAR_ALLOC : new_val_len + 1;
286 @@ -1495,9 +1683,10 @@
287 memcpy(v->str_val, p, new_val_len);
288 v->str_val[new_val_len] = 0;
290 + DBUG_PRINT("info", ("atoi on '%s', returns: %d", p, v->int_val));
298 @@ -3432,7 +3621,6 @@
301 bool con_ssl= 0, con_compress= 0;
304 static DYNAMIC_STRING ds_connection_name;
305 static DYNAMIC_STRING ds_host;
306 @@ -3460,20 +3648,7 @@
307 DBUG_ENTER("do_connect");
308 DBUG_PRINT("enter",("connect: %s", command->first_argument));
310 - /* Remove parenteses around connect arguments */
311 - if ((ptr= strstr(command->first_argument, "(")))
313 - /* Replace it with a space */
315 - if ((ptr= strstr(command->first_argument, ")")))
317 - /* Replace it with \0 */
321 - die("connect - argument list started with '(' must be ended with ')'");
324 + strip_parentheses(command);
325 check_command_args(command, command->first_argument, connect_args,
326 sizeof(connect_args)/sizeof(struct command_arg),
328 @@ -4173,16 +4348,12 @@
331 if (!(*command_ptr= command=
332 - (struct st_command*) my_malloc(sizeof(*command), MYF(MY_WME))) ||
333 + (struct st_command*) my_malloc(sizeof(*command),
334 + MYF(MY_WME|MY_ZEROFILL))) ||
335 insert_dynamic(&q_lines, (gptr) &command))
338 - command->require_file[0]= 0;
339 - command->first_word_len= 0;
340 - command->query_len= 0;
342 command->type= Q_UNKNOWN;
343 - command->query_buf= command->query= 0;
345 read_command_buf[0]= 0;
346 if (read_line(read_command_buf, sizeof(read_command_buf)))
348 diff -urN mysql-4.1.23/cmd-line-utils/libedit/el_term.h mysql-4.1/cmd-line-utils/libedit/el_term.h
349 --- mysql-4.1.23/cmd-line-utils/libedit/el_term.h 2007-12-02 20:38:26.000000000 +0100
350 +++ mysql-4.1/cmd-line-utils/libedit/el_term.h 2007-06-04 16:42:35.000000000 +0200
352 extern char* tgetstr(char*, char**);
356 +#if !HAVE_DECL_TGOTO
358 + 'tgoto' is not declared in the system header files, this causes
359 + problems on 64-bit systems. The function returns a 64 bit pointer
360 + but caller see it as "int" and it's thus truncated to 32-bit
362 +extern char* tgoto(const char*, int, int);
365 protected void term_move_to_line(EditLine *, int);
366 protected void term_move_to_char(EditLine *, int);
367 protected void term_clear_EOL(EditLine *, int);
368 diff -urN mysql-4.1.23/configure.in mysql-4.1/configure.in
369 --- mysql-4.1.23/configure.in 2007-12-02 20:38:26.000000000 +0100
370 +++ mysql-4.1/configure.in 2007-06-18 22:10:51.000000000 +0200
371 @@ -1960,6 +1960,19 @@
373 AC_SUBST(TERMCAP_LIB)
375 +# Check if the termcap function 'tgoto' is already declared in
376 +# system header files or if it need to be declared locally
377 +AC_CHECK_DECLS(tgoto,,,[
378 +#ifdef HAVE_CURSES_H
379 +# include <curses.h>
380 +#elif HAVE_NCURSES_H
381 +# include <ncurses.h>
389 AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
390 AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
391 diff -urN mysql-4.1.23/Docs/INSTALL-BINARY mysql-4.1/Docs/INSTALL-BINARY
392 --- mysql-4.1.23/Docs/INSTALL-BINARY 1970-01-01 01:00:00.000000000 +0100
393 +++ mysql-4.1/Docs/INSTALL-BINARY 2007-11-02 01:29:32.000000000 +0100
396 +You can find information about how to install binary distributions at
398 + http://dev.mysql.com/doc/refman/4.1/en/quick-standard-installation.html
400 +The MySQL Reference Manual is also available in various formats on
401 +http://dev.mysql.com/doc; if you're interested in the DocBook XML
402 +sources go to http://svn.mysql.com.
403 diff -urN mysql-4.1.23/Docs/Makefile.am mysql-4.1/Docs/Makefile.am
404 --- mysql-4.1.23/Docs/Makefile.am 2007-12-02 20:38:26.000000000 +0100
405 +++ mysql-4.1/Docs/Makefile.am 2007-11-02 13:13:51.000000000 +0100
407 # along with this program; if not, write to the Free Software
408 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
410 -noinst_SCRIPTS = Support/generate-text-files.pl
412 -EXTRA_DIST = $(noinst_SCRIPTS) mysql.info INSTALL-BINARY
414 -TXT_FILES= ../INSTALL-SOURCE ../INSTALL-WIN-SOURCE \
415 - INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt
417 -all-local: $(TXT_FILES)
418 +EXTRA_DIST = mysql.info INSTALL-BINARY
420 # make sure that "make install" installs the info page, too
421 # automake only seems to take care of this automatically,
424 @RM@ -f $(DESTDIR)$(infodir)/mysql.info
426 -# This target is not used in builds, just for convinience
427 -CLEAN_FILES: $(TXT_FILES)
430 -GT = $(srcdir)/Support/generate-text-files.pl
432 -../INSTALL-SOURCE: $(srcdir)/mysql.info $(GT)
433 - perl -w $(GT) $(srcdir)/mysql.info "installing-source" "windows-source-build" > $@
435 -../INSTALL-WIN-SOURCE: $(srcdir)/mysql.info $(GT)
436 - perl -w $(GT) $(srcdir)/mysql.info "windows-source-build" "post-installation" > $@
438 -# We put the description for the binary installation here so that
439 -# people who download source wont have to see it. It is moved up to
440 -# the toplevel by the script that makes the binary tar files.
441 -INSTALL-BINARY: $(srcdir)/mysql.info $(GT)
442 - perl -w $(GT) $(srcdir)/mysql.info "installing-binary" "installing-source" > $@
444 -../support-files/MacOSX/ReadMe.txt: $(srcdir)/mysql.info $(GT)
445 - perl -w $(GT) $(srcdir)/mysql.info "mac-os-x-installation" "netware-installation" > $@
447 # Don't update the files from bitkeeper
449 diff -urN mysql-4.1.23/Docs/mysql.info mysql-4.1/Docs/mysql.info
450 --- mysql-4.1.23/Docs/mysql.info 2007-12-02 20:38:26.000000000 +0100
451 +++ mysql-4.1/Docs/mysql.info 2007-11-02 01:31:55.000000000 +0100
453 -This is mysql.info, produced by makeinfo version 4.8 from manual.texi.
455 -START-INFO-DIR-ENTRY
456 -* mysql: (mysql). MySQL documentation.
460 -File: mysql.info, Node: Top, Next: (dir), Prev: (dir), Up: (dir)
462 -This is an empty placeholder file for the MySQL manual.
464 -The MySQL manual is now maintained in a separate BitKeeper source tree!
465 -Please see `http://www.mysql.com/doc/en/Installing_source_tree.html'
466 -for more info on how to work with BitKeeper.
468 -This file will be replaced with the current `mysql.info' when building
469 -the official source distribution.
471 -You can find a specific manual for any older version of MySQL in the
472 -binary or source distribution for that version.
480 +The MySQL Reference Manual is available in various formats on
481 +http://dev.mysql.com/doc; if you're interested in the DocBook XML
482 +sources go to http://svn.mysql.com.
483 diff -urN mysql-4.1.23/Docs/Support/generate-text-files.pl mysql-4.1/Docs/Support/generate-text-files.pl
484 --- mysql-4.1.23/Docs/Support/generate-text-files.pl 2007-12-02 20:38:25.000000000 +0100
485 +++ mysql-4.1/Docs/Support/generate-text-files.pl 1970-01-01 01:00:00.000000000 +0100
487 -#!/usr/bin/perl -w -*- perl -*-
488 -# Generate text files from top directory from the manual.
490 -$from = shift(@ARGV);
491 -$fnode = shift(@ARGV);
492 -$tnode = shift(@ARGV);
494 -open(IN, "$from") || die "Cannot open $from: $!";
502 - if (/Node: $tnode,/ || /\[index/)
506 - elsif (/^File: mysql.info/ || (/^
\1f/))
508 - # Just Skip node beginnings
517 - if (/Node: $fnode,/)
520 - # Skip first empty line
528 -die "Could not find node \"$tnode\"" if ($in == 1);
530 diff -urN mysql-4.1.23/heap/hp_delete.c mysql-4.1/heap/hp_delete.c
531 --- mysql-4.1.23/heap/hp_delete.c 2007-12-02 20:38:25.000000000 +0100
532 +++ mysql-4.1/heap/hp_delete.c 2007-09-13 12:39:15.000000000 +0200
538 info->last_pos= NULL; /* For heap_rnext/heap_rprev */
539 - info->lastkey_len= 0;
542 custom_arg.keyseg= keyinfo->seg;
543 custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos);
544 diff -urN mysql-4.1.23/heap/hp_rfirst.c mysql-4.1/heap/hp_rfirst.c
545 --- mysql-4.1.23/heap/hp_rfirst.c 2007-12-02 20:38:51.000000000 +0100
546 +++ mysql-4.1/heap/hp_rfirst.c 2007-09-13 12:39:15.000000000 +0200
549 info->current_ptr = pos;
550 memcpy(record, pos, (size_t)share->reclength);
552 + If we're performing index_first on a table that was taken from
553 + table cache, info->lastkey_len is initialized to previous query.
554 + Thus we set info->lastkey_len to proper value for subsequent
555 + heap_rnext() calls.
556 + This is needed for DELETE queries only, otherwise this variable is
558 + Note that the same workaround may be needed for heap_rlast(), but
559 + for now heap_rlast() is never used for DELETE queries.
561 + info->lastkey_len= 0;
562 info->update = HA_STATE_AKTIV;
565 diff -urN mysql-4.1.23/heap/hp_rnext.c mysql-4.1/heap/hp_rnext.c
566 --- mysql-4.1.23/heap/hp_rnext.c 2007-12-02 20:38:52.000000000 +0100
567 +++ mysql-4.1/heap/hp_rnext.c 2007-09-13 12:39:15.000000000 +0200
569 heap_rb_param custom_arg;
574 + We enter this branch for non-DELETE queries after heap_rkey()
575 + or heap_rfirst(). As last key position (info->last_pos) is available,
576 + we only need to climb the tree using tree_search_next().
578 pos = tree_search_next(&keyinfo->rb_tree, &info->last_pos,
579 offsetof(TREE_ELEMENT, left),
580 offsetof(TREE_ELEMENT, right));
582 + else if (!info->lastkey_len)
585 + We enter this branch only for DELETE queries after heap_rfirst(). E.g.
586 + DELETE FROM t1 WHERE a<10. As last key position is not available
587 + (last key is removed by heap_delete()), we must restart search as it
588 + is done in heap_rfirst().
590 + It should be safe to handle this situation without this branch. That is
591 + branch below should find smallest element in a tree as lastkey_len is
592 + zero. tree_search_edge() is a kind of optimisation here as it should be
593 + faster than tree_search_key().
595 + pos= tree_search_edge(&keyinfo->rb_tree, info->parents,
596 + &info->last_pos, offsetof(TREE_ELEMENT, left));
601 + We enter this branch only for DELETE queries after heap_rkey(). E.g.
602 + DELETE FROM t1 WHERE a=10. As last key position is not available
603 + (last key is removed by heap_delete()), we must restart search as it
604 + is done in heap_rkey().
606 custom_arg.keyseg = keyinfo->seg;
607 custom_arg.key_length = info->lastkey_len;
608 custom_arg.search_flag = SEARCH_SAME | SEARCH_FIND;
609 diff -urN mysql-4.1.23/include/my_global.h mysql-4.1/include/my_global.h
610 --- mysql-4.1.23/include/my_global.h 2007-12-02 20:38:51.000000000 +0100
611 +++ mysql-4.1/include/my_global.h 2007-06-22 14:12:39.000000000 +0200
613 typedef unsigned long ulong; /* Short for unsigned long */
615 #ifndef longlong_defined
616 -#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8
618 + Using [unsigned] long long is preferable as [u]longlong because we use
619 + [unsigned] long long unconditionally in many places,
620 + for example in constants with [U]LL suffix.
622 +#if defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8
623 typedef unsigned long long int ulonglong; /* ulong or unsigned long long */
624 typedef long long int longlong;
626 diff -urN mysql-4.1.23/include/mysql_com.h mysql-4.1/include/mysql_com.h
627 --- mysql-4.1.23/include/mysql_com.h 2007-12-02 20:38:25.000000000 +0100
628 +++ mysql-4.1/include/mysql_com.h 2007-11-09 13:05:01.000000000 +0100
630 int net_real_write(NET *net,const char *packet,unsigned long len);
631 unsigned long my_net_read(NET *net);
634 +void net_set_write_timeout(NET *net, uint timeout);
635 +void net_set_read_timeout(NET *net, uint timeout);
639 The following function is not meant for normal usage
640 Currently it's used internally by manager.c
641 diff -urN mysql-4.1.23/include/my_sys.h mysql-4.1/include/my_sys.h
642 --- mysql-4.1.23/include/my_sys.h 2007-12-02 20:38:51.000000000 +0100
643 +++ mysql-4.1/include/my_sys.h 2007-10-24 13:09:29.000000000 +0200
645 extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
646 extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
647 uint cs_flags, myf my_flags);
648 +extern CHARSET_INFO *get_compatible_charset_with_ctype(CHARSET_INFO
650 extern void free_charsets(void);
651 extern char *get_charsets_dir(char *buf);
652 extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2);
653 diff -urN mysql-4.1.23/INSTALL-SOURCE mysql-4.1/INSTALL-SOURCE
654 --- mysql-4.1.23/INSTALL-SOURCE 1970-01-01 01:00:00.000000000 +0100
655 +++ mysql-4.1/INSTALL-SOURCE 2007-11-02 01:29:32.000000000 +0100
658 +You can find information about how to install from a source distributions at
660 + http://dev.mysql.com/doc/refman/4.1/en/installing-source.html
662 +The MySQL Reference Manual is also available in various formats on
663 +http://dev.mysql.com/doc; if you're interested in the DocBook XML
664 +sources go to http://svn.mysql.com.
665 diff -urN mysql-4.1.23/INSTALL-WIN-SOURCE mysql-4.1/INSTALL-WIN-SOURCE
666 --- mysql-4.1.23/INSTALL-WIN-SOURCE 1970-01-01 01:00:00.000000000 +0100
667 +++ mysql-4.1/INSTALL-WIN-SOURCE 2007-11-02 12:36:29.000000000 +0100
670 +You can find information about how to install from a Windows source
673 + http://dev.mysql.com/doc/refman/4.1/en/windows-source-build.html
675 +The MySQL Reference Manual is also available in various formats on
676 +http://dev.mysql.com/doc; if you're interested in the DocBook XML
677 +sources go to http://svn.mysql.com.
678 diff -urN mysql-4.1.23/libmysqld/ha_blackhole.cc mysql-4.1/libmysqld/ha_blackhole.cc
679 --- mysql-4.1.23/libmysqld/ha_blackhole.cc 2007-12-02 20:38:51.000000000 +0100
680 +++ mysql-4.1/libmysqld/ha_blackhole.cc 1970-01-01 01:00:00.000000000 +0100
682 -/* Copyright (C) 2005 MySQL AB
684 - This program is free software; you can redistribute it and/or modify
685 - it under the terms of the GNU General Public License as published by
686 - the Free Software Foundation; either version 2 of the License, or
687 - (at your option) any later version.
689 - This program is distributed in the hope that it will be useful,
690 - but WITHOUT ANY WARRANTY; without even the implied warranty of
691 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
692 - GNU General Public License for more details.
694 - You should have received a copy of the GNU General Public License
695 - along with this program; if not, write to the Free Software
696 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
699 -#ifdef USE_PRAGMA_IMPLEMENTATION
700 -#pragma implementation // gcc: Class implementation
703 -#include "mysql_priv.h"
704 -#ifdef HAVE_BLACKHOLE_DB
705 -#include "ha_blackhole.h"
708 -const char **ha_blackhole::bas_ext() const
710 - static const char *ext[]= { NullS };
714 -int ha_blackhole::open(const char *name, int mode, uint test_if_locked)
716 - DBUG_ENTER("ha_blackhole::open");
717 - thr_lock_init(&thr_lock);
718 - thr_lock_data_init(&thr_lock,&lock,NULL);
722 -int ha_blackhole::close(void)
724 - DBUG_ENTER("ha_blackhole::close");
725 - thr_lock_delete(&thr_lock);
729 -int ha_blackhole::create(const char *name, TABLE *table_arg,
730 - HA_CREATE_INFO *create_info)
732 - DBUG_ENTER("ha_blackhole::create");
736 -const char *ha_blackhole::index_type(uint key_number)
738 - DBUG_ENTER("ha_blackhole::index_type");
739 - DBUG_RETURN((table->key_info[key_number].flags & HA_FULLTEXT) ?
741 - (table->key_info[key_number].flags & HA_SPATIAL) ?
743 - (table->key_info[key_number].algorithm == HA_KEY_ALG_RTREE) ?
748 -int ha_blackhole::write_row(byte * buf)
750 - DBUG_ENTER("ha_blackhole::write_row");
754 -int ha_blackhole::rnd_init(bool scan)
756 - DBUG_ENTER("ha_blackhole::rnd_init");
761 -int ha_blackhole::rnd_next(byte *buf)
763 - DBUG_ENTER("ha_blackhole::rnd_next");
764 - DBUG_RETURN(HA_ERR_END_OF_FILE);
768 -int ha_blackhole::rnd_pos(byte * buf, byte *pos)
770 - DBUG_ENTER("ha_blackhole::rnd_pos");
776 -void ha_blackhole::position(const byte *record)
778 - DBUG_ENTER("ha_blackhole::position");
784 -int ha_blackhole::info(uint flag)
786 - DBUG_ENTER("ha_blackhole::info");
791 - mean_rec_length= 0;
792 - data_file_length= 0;
793 - index_file_length= 0;
794 - max_data_file_length= 0;
796 - if (flag & HA_STATUS_AUTO)
797 - auto_increment_value= 1;
801 -int ha_blackhole::external_lock(THD *thd, int lock_type)
803 - DBUG_ENTER("ha_blackhole::external_lock");
808 -uint ha_blackhole::lock_count(void) const
810 - DBUG_ENTER("ha_blackhole::lock_count");
814 -THR_LOCK_DATA **ha_blackhole::store_lock(THD *thd,
815 - THR_LOCK_DATA **to,
816 - enum thr_lock_type lock_type)
818 - DBUG_ENTER("ha_blackhole::store_lock");
823 -int ha_blackhole::index_read(byte * buf, const byte * key,
824 - uint key_len, enum ha_rkey_function find_flag)
826 - DBUG_ENTER("ha_blackhole::index_read");
831 -int ha_blackhole::index_read_idx(byte * buf, uint idx, const byte * key,
832 - uint key_len, enum ha_rkey_function find_flag)
834 - DBUG_ENTER("ha_blackhole::index_read_idx");
835 - DBUG_RETURN(HA_ERR_END_OF_FILE);
839 -int ha_blackhole::index_read_last(byte * buf, const byte * key, uint key_len)
841 - DBUG_ENTER("ha_blackhole::index_read_last");
842 - DBUG_RETURN(HA_ERR_END_OF_FILE);
846 -int ha_blackhole::index_next(byte * buf)
848 - DBUG_ENTER("ha_blackhole::index_next");
849 - DBUG_RETURN(HA_ERR_END_OF_FILE);
853 -int ha_blackhole::index_prev(byte * buf)
855 - DBUG_ENTER("ha_blackhole::index_prev");
856 - DBUG_RETURN(HA_ERR_END_OF_FILE);
860 -int ha_blackhole::index_first(byte * buf)
862 - DBUG_ENTER("ha_blackhole::index_first");
863 - DBUG_RETURN(HA_ERR_END_OF_FILE);
867 -int ha_blackhole::index_last(byte * buf)
869 - DBUG_ENTER("ha_blackhole::index_last");
870 - DBUG_RETURN(HA_ERR_END_OF_FILE);
873 -#endif /* HAVE_BLACKHOLE_DB */
874 diff -urN mysql-4.1.23/libmysql_r/client_settings.h mysql-4.1/libmysql_r/client_settings.h
875 --- mysql-4.1.23/libmysql_r/client_settings.h 2007-12-02 20:38:26.000000000 +0100
876 +++ mysql-4.1/libmysql_r/client_settings.h 1970-01-01 01:00:00.000000000 +0100
878 -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
880 - This program is free software; you can redistribute it and/or modify
881 - it under the terms of the GNU General Public License as published by
882 - the Free Software Foundation; either version 2 of the License, or
883 - (at your option) any later version.
885 - This program is distributed in the hope that it will be useful,
886 - but WITHOUT ANY WARRANTY; without even the implied warranty of
887 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
888 - GNU General Public License for more details.
890 - You should have received a copy of the GNU General Public License
891 - along with this program; if not, write to the Free Software
892 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
894 -extern uint mysql_port;
895 -extern my_string mysql_unix_port;
897 -#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \
898 - CLIENT_TRANSACTIONS | \
899 - CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION)
901 -sig_handler pipe_sig_handler(int sig);
902 -void read_user_name(char *name);
903 -my_bool handle_local_infile(MYSQL *mysql, const char *net_filename);
906 - Let the user specify that we don't want SIGPIPE; This doesn't however work
907 - with threaded applications as we can have multiple read in progress.
910 -#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD)
911 -#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0;
912 -#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE,pipe_sig_handler)
913 -#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler);
915 -#define init_sigpipe_variables
916 -#define set_sigpipe(mysql)
917 -#define reset_sigpipe(mysql)
920 -void mysql_read_default_options(struct st_mysql_options *options,
921 - const char *filename,const char *group);
922 -void mysql_detach_stmt_list(LIST **stmt_list);
924 -cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
925 - const char *passwd, const char *db,
926 - uint port, const char *unix_socket,ulong client_flag);
928 -void cli_mysql_close(MYSQL *mysql);
930 -MYSQL_FIELD * cli_list_fields(MYSQL *mysql);
931 -my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt);
932 -MYSQL_DATA * cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
934 -int cli_stmt_execute(MYSQL_STMT *stmt);
935 -int cli_read_binary_rows(MYSQL_STMT *stmt);
936 -int cli_unbuffered_fetch(MYSQL *mysql, char **row);
937 -const char * cli_read_statistics(MYSQL *mysql);
938 -int cli_read_change_user_result(MYSQL *mysql, char *buff, const char *passwd);
940 -#ifdef EMBEDDED_LIBRARY
941 -int init_embedded_server(int argc, char **argv, char **groups);
942 -void end_embedded_server();
943 -#endif /*EMBEDDED_LIBRARY*/
944 diff -urN mysql-4.1.23/myisam/ft_boolean_search.c mysql-4.1/myisam/ft_boolean_search.c
945 --- mysql-4.1.23/myisam/ft_boolean_search.c 2007-12-02 20:38:25.000000000 +0100
946 +++ mysql-4.1/myisam/ft_boolean_search.c 2007-10-30 11:46:42.000000000 +0100
949 if (cs->coll->instr(cs, p0, e0 - p0, s1, e1 - s1, m, 2) != 2)
951 - if ((!s_after || p0 + m[1].beg == s0 || !true_word_char(cs, p0[m[1].beg-1])) &&
952 + if ((!s_after || p0 + m[1].beg == s0 ||
953 + !true_word_char(cs, p0[(int) m[1].beg - 1])) &&
954 (!e_before || p0 + m[1].end == e0 || !true_word_char(cs, p0[m[1].end])))
957 diff -urN mysql-4.1.23/myisam/mi_check.c mysql-4.1/myisam/mi_check.c
958 --- mysql-4.1.23/myisam/mi_check.c 2007-12-02 20:38:51.000000000 +0100
959 +++ mysql-4.1/myisam/mi_check.c 2007-11-07 09:55:27.000000000 +0100
961 ha_rows records,del_blocks;
962 my_off_t used,empty,pos,splits,start_recpos,
963 del_length,link_used,start_block;
965 + byte *record= 0, *to;
966 char llbuff[22],llbuff2[22],llbuff3[22];
967 ha_checksum intern_record_checksum;
968 ha_checksum key_checksum[MI_MAX_POSSIBLE_KEY];
970 puts("- check record links");
973 - if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0))))
974 + if (!mi_alloc_rec_buff(info, -1, &record))
976 mi_check_print_error(param,"Not enough memory for record");
978 @@ -1364,12 +1364,12 @@
979 printf("Lost space: %12s Linkdata: %10s\n",
980 llstr(empty,llbuff),llstr(link_used,llbuff2));
982 - my_free((gptr) record,MYF(0));
983 + my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
986 mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff));
988 - my_free((gptr) record,MYF(0));
989 + my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
990 param->testflag|=T_RETRY_WITHOUT_QUICK;
992 } /* chk_data_link */
993 @@ -1428,8 +1428,7 @@
994 MYF(MY_WME | MY_WAIT_IF_FULL)))
996 info->opt_flag|=WRITE_CACHE_USED;
997 - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
999 + if (!mi_alloc_rec_buff(info, -1, &sort_param.record) ||
1000 !mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
1002 mi_check_print_error(param, "Not enough memory for extra record");
1003 @@ -1631,7 +1630,8 @@
1005 my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff),
1006 MYF(MY_ALLOW_ZERO_PTR));
1007 - my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
1008 + my_free(mi_get_rec_buff_ptr(info, sort_param.record),
1009 + MYF(MY_ALLOW_ZERO_PTR));
1010 my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
1011 VOID(end_io_cache(¶m->read_cache));
1012 info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
1013 @@ -2129,8 +2129,7 @@
1014 info->opt_flag|=WRITE_CACHE_USED;
1015 info->rec_cache.file=info->dfile; /* for sort_delete_record */
1017 - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
1019 + if (!mi_alloc_rec_buff(info, -1, &sort_param.record) ||
1020 !mi_alloc_rec_buff(info, -1, &sort_param.rec_buff))
1022 mi_check_print_error(param, "Not enough memory for extra record");
1023 @@ -2415,7 +2414,8 @@
1025 my_free(mi_get_rec_buff_ptr(info, sort_param.rec_buff),
1026 MYF(MY_ALLOW_ZERO_PTR));
1027 - my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
1028 + my_free(mi_get_rec_buff_ptr(info, sort_param.record),
1029 + MYF(MY_ALLOW_ZERO_PTR));
1030 my_free((gptr) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
1031 my_free((gptr) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
1032 my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
1033 @@ -2493,6 +2493,7 @@
1034 SORT_INFO sort_info;
1035 ulonglong key_map=share->state.key_map;
1036 pthread_attr_t thr_attr;
1037 + ulong max_pack_reclength;
1038 DBUG_ENTER("mi_repair_parallel");
1040 start_records=info->state->records;
1041 @@ -2649,10 +2650,13 @@
1043 del=info->state->del;
1046 + /* for compressed tables */
1047 + max_pack_reclength= share->base.pack_reclength;
1048 + if (share->options & HA_OPTION_COMPRESS_RECORD)
1049 + set_if_bigger(max_pack_reclength, share->max_pack_length);
1050 if (!(sort_param=(MI_SORT_PARAM *)
1051 my_malloc((uint) share->base.keys *
1052 - (sizeof(MI_SORT_PARAM) + share->base.pack_reclength),
1053 + (sizeof(MI_SORT_PARAM) + max_pack_reclength),
1056 mi_check_print_error(param,"Not enough memory for key!");
1057 @@ -2704,7 +2708,7 @@
1058 sort_param[i].max_pos=sort_param[i].pos=share->pack.header_length;
1060 sort_param[i].record= (((char *)(sort_param+share->base.keys))+
1061 - (share->base.pack_reclength * i));
1062 + (max_pack_reclength * i));
1063 if (!mi_alloc_rec_buff(info, -1, &sort_param[i].rec_buff))
1065 mi_check_print_error(param,"Not enough memory!");
1066 @@ -4320,7 +4324,7 @@
1067 void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
1068 my_bool repair_only)
1072 DBUG_ENTER("update_auto_increment_key");
1074 if (!info->s->base.auto_key ||
1075 @@ -4340,8 +4344,7 @@
1076 We have to use an allocated buffer instead of info->rec_buff as
1077 _mi_put_key_in_record() may use info->rec_buff
1079 - if (!(record= (byte*) my_malloc((uint) info->s->base.pack_reclength,
1081 + if (!mi_alloc_rec_buff(info, -1, &record))
1083 mi_check_print_error(param,"Not enough memory for extra record");
1085 @@ -4353,7 +4356,7 @@
1086 if (my_errno != HA_ERR_END_OF_FILE)
1088 mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
1089 - my_free((char*) record, MYF(0));
1090 + my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
1091 mi_check_print_error(param,"%d when reading last record",my_errno);
1094 @@ -4369,7 +4372,7 @@
1095 set_if_bigger(info->s->state.auto_increment,auto_increment);
1097 mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
1098 - my_free((char*) record, MYF(0));
1099 + my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
1100 update_state_info(param, info, UPDATE_AUTO_INC);
1103 diff -urN mysql-4.1.23/myisam/mi_dynrec.c mysql-4.1/myisam/mi_dynrec.c
1104 --- mysql-4.1.23/myisam/mi_dynrec.c 2007-12-02 20:38:26.000000000 +0100
1105 +++ mysql-4.1/myisam/mi_dynrec.c 2007-11-12 10:00:21.000000000 +0100
1106 @@ -145,6 +145,29 @@
1107 DBUG_ENTER("write_dynamic_record");
1112 + Check if we have enough room for the new record.
1113 + First we do simplified check to make usual case faster.
1114 + Then we do more precise check for the space left.
1115 + Though it still is not absolutely precise, as
1116 + we always use MI_MAX_DYN_BLOCK_HEADER while it can be
1117 + less in the most of the cases.
1120 + if (unlikely(info->s->base.max_data_file_length -
1121 + info->state->data_file_length <
1122 + reclength + MI_MAX_DYN_BLOCK_HEADER))
1124 + if (info->s->base.max_data_file_length - info->state->data_file_length +
1125 + info->state->empty - info->state->del * MI_MAX_DYN_BLOCK_HEADER <
1126 + reclength + MI_MAX_DYN_BLOCK_HEADER)
1128 + my_errno=HA_ERR_RECORD_FILE_FULL;
1135 if (_mi_find_writepos(info,reclength,&filepos,&length))
1136 @@ -577,6 +600,51 @@
1137 DBUG_ENTER("update_dynamic_record");
1139 flag=block_info.second_read=0;
1141 + Check if we have enough room for the record.
1142 + First we do simplified check to make usual case faster.
1143 + Then we do more precise check for the space left.
1144 + Though it still is not absolutely precise, as
1145 + we always use MI_MAX_DYN_BLOCK_HEADER while it can be
1146 + less in the most of the cases.
1150 + compare with just the reclength as we're going
1151 + to get some space from the old replaced record
1153 + if (unlikely(info->s->base.max_data_file_length -
1154 + info->state->data_file_length < reclength))
1157 + let's read the old record's block to find out the length of the
1160 + if ((error=_mi_get_block_info(&block_info,info->dfile,filepos))
1161 + & (BLOCK_DELETED | BLOCK_ERROR | BLOCK_SYNC_ERROR | BLOCK_FATAL_ERROR))
1163 + DBUG_PRINT("error",("Got wrong block info"));
1164 + if (!(error & BLOCK_FATAL_ERROR))
1165 + my_errno=HA_ERR_WRONG_IN_RECORD;
1170 + if new record isn't longer, we can go on safely
1172 + if (block_info.rec_len < reclength)
1174 + if (info->s->base.max_data_file_length - info->state->data_file_length +
1175 + info->state->empty - info->state->del * MI_MAX_DYN_BLOCK_HEADER <
1176 + reclength - block_info.rec_len + MI_MAX_DYN_BLOCK_HEADER)
1178 + my_errno=HA_ERR_RECORD_FILE_FULL;
1182 + block_info.second_read=0;
1185 while (reclength > 0)
1187 if (filepos != info->s->state.dellink)
1188 diff -urN mysql-4.1.23/myisam/mi_open.c mysql-4.1/myisam/mi_open.c
1189 --- mysql-4.1.23/myisam/mi_open.c 2007-12-02 20:38:26.000000000 +0100
1190 +++ mysql-4.1/myisam/mi_open.c 2007-11-07 09:55:27.000000000 +0100
1191 @@ -659,8 +659,11 @@
1192 /* to simplify initial init of info->rec_buf in mi_open and mi_extra */
1193 if (length == (ulong) -1)
1195 - length= max(info->s->base.pack_reclength,
1196 - info->s->base.max_key_length);
1197 + if (info->s->options & HA_OPTION_COMPRESS_RECORD)
1198 + length= max(info->s->base.pack_reclength, info->s->max_pack_length);
1200 + length= info->s->base.pack_reclength;
1201 + length= max(length, info->s->base.max_key_length);
1202 /* Avoid unnecessary realloc */
1203 if (newptr && length == old_length)
1205 diff -urN mysql-4.1.23/myisam/mi_packrec.c mysql-4.1/myisam/mi_packrec.c
1206 --- mysql-4.1.23/myisam/mi_packrec.c 2007-12-02 20:38:27.000000000 +0100
1207 +++ mysql-4.1/myisam/mi_packrec.c 2007-11-07 09:55:27.000000000 +0100
1209 share->pack.header_length= uint4korr(header+4);
1210 share->min_pack_length=(uint) uint4korr(header+8);
1211 share->max_pack_length=(uint) uint4korr(header+12);
1212 - set_if_bigger(share->base.pack_reclength,share->max_pack_length);
1213 elements=uint4korr(header+16);
1214 intervall_length=uint4korr(header+20);
1215 trees=uint2korr(header+24);
1216 diff -urN mysql-4.1.23/myisam/mi_rkey.c mysql-4.1/myisam/mi_rkey.c
1217 --- mysql-4.1.23/myisam/mi_rkey.c 2007-12-02 20:38:26.000000000 +0100
1218 +++ mysql-4.1/myisam/mi_rkey.c 2007-08-01 11:54:13.000000000 +0200
1220 myisam_read_vec[search_flag], info->s->state.key_root[inx]))
1223 - If we searching for a partial key (or using >, >=, < or <=) and
1224 - the data is outside of the data file, we need to continue searching
1225 - for the first key inside the data file
1226 + Found a key, but it might not be usable. We cannot use rows that
1227 + are inserted by other threads after we got our table lock
1228 + ("concurrent inserts"). The record may not even be present yet.
1229 + Keys are inserted into the index(es) before the record is
1230 + inserted into the data file. When we got our table lock, we
1231 + saved the current data_file_length. Concurrent inserts always go
1232 + to the end of the file. So we can test if the found key
1233 + references a new record.
1235 - if (info->lastpos >= info->state->data_file_length &&
1236 - (search_flag != HA_READ_KEY_EXACT ||
1237 - last_used_keyseg != keyinfo->seg + keyinfo->keysegs))
1238 + if (info->lastpos >= info->state->data_file_length)
1241 + /* The key references a concurrently inserted record. */
1242 + if (search_flag == HA_READ_KEY_EXACT &&
1243 + last_used_keyseg == keyinfo->seg + keyinfo->keysegs)
1245 + /* Simply ignore the key if it matches exactly. (Bug #29838) */
1246 + my_errno= HA_ERR_KEY_NOT_FOUND;
1247 + info->lastpos= HA_OFFSET_ERROR;
1253 - Skip rows that are inserted by other threads since we got a lock
1254 - Note that this can only happen if we are not searching after an
1255 - full length exact key, because the keys are sorted
1256 - according to position
1258 - if (_mi_search_next(info, keyinfo, info->lastkey,
1259 - info->lastkey_length,
1260 - myisam_readnext_vec[search_flag],
1261 - info->s->state.key_root[inx]))
1264 - Check that the found key does still match the search.
1265 - _mi_search_next() delivers the next key regardless of its
1267 + If searching for a partial key (or using >, >=, < or <=) and
1268 + the data is outside of the data file, we need to continue
1269 + searching for the first key inside the data file.
1271 - if (search_flag == HA_READ_KEY_EXACT &&
1272 - ha_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length,
1273 - SEARCH_FIND, not_used))
1276 - my_errno= HA_ERR_KEY_NOT_FOUND;
1277 - info->lastpos= HA_OFFSET_ERROR;
1280 - } while (info->lastpos >= info->state->data_file_length);
1283 + Skip rows that are inserted by other threads since we got
1284 + a lock. Note that this can only happen if we are not
1285 + searching after a full length exact key, because the keys
1286 + are sorted according to position.
1288 + if (_mi_search_next(info, keyinfo, info->lastkey,
1289 + info->lastkey_length,
1290 + myisam_readnext_vec[search_flag],
1291 + info->s->state.key_root[inx]))
1292 + break; /* purecov: inspected */
1294 + Check that the found key does still match the search.
1295 + _mi_search_next() delivers the next key regardless of its
1298 + if (search_flag == HA_READ_KEY_EXACT &&
1299 + ha_key_cmp(keyinfo->seg, key_buff, info->lastkey,
1300 + use_key_length, SEARCH_FIND, not_used))
1302 + /* purecov: begin inspected */
1303 + my_errno= HA_ERR_KEY_NOT_FOUND;
1304 + info->lastpos= HA_OFFSET_ERROR;
1306 + /* purecov: end */
1308 + } while (info->lastpos >= info->state->data_file_length);
1313 diff -urN mysql-4.1.23/myisam/myisamchk.c mysql-4.1/myisam/myisamchk.c
1314 --- mysql-4.1.23/myisam/myisamchk.c 2007-12-02 20:38:51.000000000 +0100
1315 +++ mysql-4.1/myisam/myisamchk.c 2007-11-07 09:55:27.000000000 +0100
1317 (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR,
1318 REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1319 {"stats_method", OPT_STATS_METHOD,
1320 - "Specifies how index statistics collection code should threat NULLs. "
1321 + "Specifies how index statistics collection code should treat NULLs. "
1322 "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
1323 "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
1324 (gptr*) &myisam_stats_method_str, (gptr*) &myisam_stats_method_str, 0,
1326 MySQL faster. You can check the calculated distribution\n\
1327 by using '--description --verbose table_name'.\n\
1328 --stats_method=name Specifies how index statistics collection code should\n\
1329 - threat NULLs. Possible values of name are \"nulls_unequal\"\n\
1330 + treat NULLs. Possible values of name are \"nulls_unequal\"\n\
1331 (default for 4.1/5.0), \"nulls_equal\" (emulate 4.0), and \n\
1332 \"nulls_ignored\".\n\
1333 -d, --description Prints some information about table.\n\
1334 @@ -1543,8 +1543,8 @@
1335 mi_check_print_error(param,"Not enough memory for key block");
1338 - if (!(sort_param.record=(byte*) my_malloc((uint) share->base.pack_reclength,
1341 + if (!mi_alloc_rec_buff(info, -1, &sort_param.record))
1343 mi_check_print_error(param,"Not enough memory for record");
1345 @@ -1639,7 +1639,8 @@
1347 my_afree((gptr) temp_buff);
1349 - my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR));
1350 + my_free(mi_get_rec_buff_ptr(info, sort_param.record),
1351 + MYF(MY_ALLOW_ZERO_PTR));
1352 info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
1353 VOID(end_io_cache(&info->rec_cache));
1354 my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
1355 diff -urN mysql-4.1.23/myisam/rt_index.c mysql-4.1/myisam/rt_index.c
1356 --- mysql-4.1.23/myisam/rt_index.c 2007-12-02 20:38:51.000000000 +0100
1357 +++ mysql-4.1/myisam/rt_index.c 2007-10-05 12:40:31.000000000 +0200
1358 @@ -485,15 +485,16 @@
1359 uint key_length, uchar *page_buf, uint nod_flag)
1362 - double best_incr = DBL_MAX;
1367 + uchar *best_key= NULL;
1368 uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
1369 uchar *last = rt_PAGE_END(page_buf);
1371 LINT_INIT(best_area);
1372 LINT_INIT(best_key);
1373 + LINT_INIT(best_incr);
1375 for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
1377 @@ -502,22 +503,13 @@
1380 /* The following should be safe, even if we compare doubles */
1381 - if (increase < best_incr)
1382 + if (!best_key || increase < best_incr ||
1383 + ((increase == best_incr) && (area < best_area)))
1387 best_incr = increase;
1391 - /* The following should be safe, even if we compare doubles */
1392 - if ((increase == best_incr) && (area < best_area))
1396 - best_incr = increase;
1402 diff -urN mysql-4.1.23/myisam/rt_mbr.c mysql-4.1/myisam/rt_mbr.c
1403 --- mysql-4.1.23/myisam/rt_mbr.c 2007-12-02 20:38:25.000000000 +0100
1404 +++ mysql-4.1/myisam/rt_mbr.c 2007-10-05 12:40:31.000000000 +0200
1405 @@ -525,7 +525,10 @@
1409 -Calculates MBR_AREA(a+b) - MBR_AREA(a)
1410 + Calculates MBR_AREA(a+b) - MBR_AREA(a)
1411 + Note: when 'a' and 'b' objects are far from each other,
1412 + the area increase can be really big, so this function
1413 + can return 'inf' as a result.
1415 double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
1416 uint key_length, double *ab_area)
1417 diff -urN mysql-4.1.23/myisam/sort.c mysql-4.1/myisam/sort.c
1418 --- mysql-4.1.23/myisam/sort.c 2007-12-02 20:38:26.000000000 +0100
1419 +++ mysql-4.1/myisam/sort.c 2007-10-11 12:28:08.000000000 +0200
1420 @@ -559,9 +559,10 @@
1423 length=param->sort_buffer_length;
1424 - while (length >= MIN_SORT_MEMORY && !mergebuf)
1425 + while (length >= MIN_SORT_MEMORY)
1427 - mergebuf=my_malloc(length, MYF(0));
1428 + if ((mergebuf= my_malloc(length, MYF(0))))
1436 maxcount=keys/((uint) (Tb-Fb) +1);
1437 + DBUG_ASSERT(maxcount > 0);
1438 LINT_INIT(to_start_filepos);
1440 to_start_filepos=my_b_tell(to_file);
1441 diff -urN mysql-4.1.23/mysql-test/include/ctype_common.inc mysql-4.1/mysql-test/include/ctype_common.inc
1442 --- mysql-4.1.23/mysql-test/include/ctype_common.inc 2007-12-02 20:38:26.000000000 +0100
1443 +++ mysql-4.1/mysql-test/include/ctype_common.inc 2007-10-04 07:19:59.000000000 +0200
1445 SELECT c1 as want1result from t1 where c1 like 'location%';
1449 +# Bug #31070: crash during conversion of charsets
1451 +create table t1 (a set('a') not null);
1452 +insert into t1 values (),();
1453 +select cast(a as char(1)) from t1;
1454 +select a sounds like a from t1;
1460 diff -urN mysql-4.1.23/mysql-test/lib/mtr_misc.pl mysql-4.1/mysql-test/lib/mtr_misc.pl
1461 --- mysql-4.1.23/mysql-test/lib/mtr_misc.pl 2007-12-02 20:38:50.000000000 +0100
1462 +++ mysql-4.1/mysql-test/lib/mtr_misc.pl 2007-08-29 14:39:39.000000000 +0200
1469 sub mtr_full_hostname ();
1470 sub mtr_short_hostname ();
1472 sub mtr_exe_exists(@);
1473 sub mtr_exe_maybe_exists(@);
1474 sub mtr_copy_dir($$);
1476 sub mtr_same_opts($$);
1477 sub mtr_cmp_opts($$);
1479 @@ -202,6 +204,64 @@
1483 +sub mtr_rmtree($) {
1485 + my $need_file_find= 0;
1486 + mtr_verbose("mtr_rmtree: $dir");
1489 + # Try to use File::Path::rmtree. Recent versions
1490 + # handles removal of directories and files that don't
1491 + # have full permissions, while older versions
1492 + # may have a problem with that and we use our own version
1494 + local $SIG{__WARN__}= sub {
1495 + $need_file_find= 1;
1496 + mtr_warning($_[0]);
1500 + if ( $need_file_find ) {
1501 + mtr_warning("rmtree($dir) failed, trying with File::Find...");
1510 + or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++;
1521 + # Use special underscore (_) filehandle, caches stat info
1522 + if (!-l $file and -d _ ) {
1524 + mtr_warning("couldn't rmdir($file): $!") and $errors++;
1527 + or mtr_warning("couldn't unlink($file): $!") and $errors++;
1534 + mtr_error("Failed to remove '$dir'") if $errors;
1536 + mtr_report("OK, that worked!");
1541 sub mtr_same_opts ($$) {
1544 diff -urN mysql-4.1.23/mysql-test/mysql-test-run.pl mysql-4.1/mysql-test/mysql-test-run.pl
1545 --- mysql-4.1.23/mysql-test/mysql-test-run.pl 2007-12-02 20:38:25.000000000 +0100
1546 +++ mysql-4.1/mysql-test/mysql-test-run.pl 2007-11-07 09:55:27.000000000 +0100
1547 @@ -1880,6 +1880,21 @@
1548 ($lib_udf_example ? dirname($lib_udf_example) : "") .
1549 ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
1551 + # ----------------------------------------------------
1552 + # Setup env so childs can execute myisampack and myisamchk
1553 + # ----------------------------------------------------
1554 + $ENV{'MYISAMCHK'}= mtr_native_path(mtr_exe_exists(
1555 + vs_config_dirs('storage/myisam', 'myisamchk'),
1556 + vs_config_dirs('myisam', 'myisamchk'),
1557 + "$path_client_bindir/myisamchk",
1558 + "$glob_basedir/storage/myisam/myisamchk",
1559 + "$glob_basedir/myisam/myisamchk"));
1560 + $ENV{'MYISAMPACK'}= mtr_native_path(mtr_exe_exists(
1561 + vs_config_dirs('storage/myisam', 'myisampack'),
1562 + vs_config_dirs('myisam', 'myisampack'),
1563 + "$path_client_bindir/myisampack",
1564 + "$glob_basedir/storage/myisam/myisampack",
1565 + "$glob_basedir/myisam/myisampack"));
1567 # ----------------------------------------------------
1568 # We are nice and report a bit about our settings
1569 @@ -1988,7 +2003,7 @@
1571 # Remove the directory which the link points at
1572 mtr_verbose("Removing " . readlink($opt_vardir));
1573 - rmtree(readlink($opt_vardir));
1574 + mtr_rmtree(readlink($opt_vardir));
1576 # Remove the "var" symlink
1577 mtr_verbose("unlink($opt_vardir)");
1578 @@ -2016,7 +2031,7 @@
1579 foreach my $bin ( glob("$opt_vardir/*") )
1581 mtr_verbose("Removing bin $bin");
1587 @@ -2024,7 +2039,7 @@
1589 # Remove the entire "var" dir
1590 mtr_verbose("Removing $opt_vardir/");
1591 - rmtree("$opt_vardir/");
1592 + mtr_rmtree("$opt_vardir/");
1596 @@ -2033,7 +2048,7 @@
1597 # remove the $opt_mem dir to assure the symlink
1598 # won't point at an old directory
1599 mtr_verbose("Removing $opt_mem");
1601 + mtr_rmtree($opt_mem);
1605 @@ -2046,11 +2061,11 @@
1606 # Remove the var/ dir in mysql-test dir if any
1607 # this could be an old symlink that shouldn't be there
1608 mtr_verbose("Removing $default_vardir");
1609 - rmtree($default_vardir);
1610 + mtr_rmtree($default_vardir);
1612 # Remove the "var" dir
1613 mtr_verbose("Removing $opt_vardir/");
1614 - rmtree("$opt_vardir/");
1615 + mtr_rmtree("$opt_vardir/");
1619 @@ -2143,16 +2158,23 @@
1623 - chmod(oct("0755"), $test_file);
1624 - unlink($test_file);
1625 + # Some filesystems( for example CIFS) allows reading a file
1626 + # although mode was set to 0000, but in that case a stat on
1627 + # the file will not return 0000
1628 + my $file_mode= (stat($test_file))[2] & 07777;
1630 $ENV{'MYSQL_TEST_ROOT'}= "NO";
1631 - if ($result eq "MySQL")
1632 + mtr_verbose("result: $result, file_mode: $file_mode");
1633 + if ($result eq "MySQL" && $file_mode == 0)
1635 mtr_warning("running this script as _root_ will cause some " .
1636 "tests to be skipped");
1637 $ENV{'MYSQL_TEST_ROOT'}= "YES";
1640 + chmod(oct("0755"), $test_file);
1641 + unlink($test_file);
1646 @@ -2956,7 +2978,7 @@
1648 my $data_dir= $slave->[$idx]->{'path_myddir'};
1649 my $name= basename($data_dir);
1650 - rmtree($data_dir);
1651 + mtr_rmtree($data_dir);
1652 mtr_copy_dir("$path_snapshot/$name", $data_dir);
1655 @@ -3099,9 +3121,12 @@
1659 + # Set default message
1660 + $tinfo->{'comment'}= "Detected by testcase(no log file)";
1662 # Open mysqltest.log
1663 - my $F= IO::File->new($path_timefile) or
1664 - mtr_error("can't open file \"$path_timefile\": $!");
1665 + my $F= IO::File->new($path_timefile)
1669 while ( my $line= <$F> )
1670 @@ -3154,8 +3179,8 @@
1673 # Open mysqltest.log
1674 - my $F= IO::File->new($path_timefile) or
1675 - mtr_error("can't open file \"$path_timefile\": $!");
1676 + my $F= IO::File->new($path_timefile)
1679 while ( my $line= <$F> )
1681 @@ -3300,7 +3325,7 @@
1682 sub save_installed_db () {
1684 mtr_report("Saving snapshot of installed databases");
1685 - rmtree($path_snapshot);
1686 + mtr_rmtree($path_snapshot);
1688 foreach my $data_dir (@data_dir_lst)
1690 @@ -3347,7 +3372,7 @@
1692 my $name= basename($data_dir);
1693 save_files_before_restore($test_name, $data_dir);
1694 - rmtree("$data_dir");
1695 + mtr_rmtree("$data_dir");
1696 mtr_copy_dir("$path_snapshot/$name", "$data_dir");
1699 @@ -3357,7 +3382,7 @@
1701 foreach my $ndbd (@{$cluster->{'ndbds'}})
1703 - rmtree("$ndbd->{'path_fs'}" );
1704 + mtr_rmtree("$ndbd->{'path_fs'}" );
1708 @@ -3815,6 +3840,9 @@
1709 $wait_for_pid_file= 0;
1712 + # Remove the pidfile
1713 + unlink($mysqld->{'path_pid'});
1717 $pid= mtr_spawn($exe, $args, "",
1718 diff -urN mysql-4.1.23/mysql-test/r/almost_full.result mysql-4.1/mysql-test/r/almost_full.result
1719 --- mysql-4.1.23/mysql-test/r/almost_full.result 1970-01-01 01:00:00.000000000 +0100
1720 +++ mysql-4.1/mysql-test/r/almost_full.result 2007-11-12 10:00:21.000000000 +0100
1722 +drop table if exists t1;
1723 +set global myisam_data_pointer_size=2;
1724 +CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM;
1725 +DELETE FROM t1 WHERE a=1 or a=5;
1726 +INSERT INTO t1 SET b=repeat('a',600);
1727 +ERROR HY000: The table 't1' is full
1728 +CHECK TABLE t1 EXTENDED;
1729 +Table Op Msg_type Msg_text
1730 +test.t1 check warning Datafile is almost full, 65448 of 65534 used
1731 +test.t1 check status OK
1732 +UPDATE t1 SET b=repeat('a', 800) where a=10;
1733 +ERROR HY000: The table 't1' is full
1734 +CHECK TABLE t1 EXTENDED;
1735 +Table Op Msg_type Msg_text
1736 +test.t1 check warning Datafile is almost full, 65448 of 65534 used
1737 +test.t1 check status OK
1738 +INSERT INTO t1 SET b=repeat('a',400);
1739 +CHECK TABLE t1 EXTENDED;
1740 +Table Op Msg_type Msg_text
1741 +test.t1 check warning Datafile is almost full, 65448 of 65534 used
1742 +test.t1 check status OK
1743 +DELETE FROM t1 WHERE a=2 or a=6;
1744 +UPDATE t1 SET b=repeat('a', 600) where a=11;
1745 +CHECK TABLE t1 EXTENDED;
1746 +Table Op Msg_type Msg_text
1747 +test.t1 check warning Datafile is almost full, 65448 of 65534 used
1748 +test.t1 check status OK
1750 +set global myisam_data_pointer_size=default;
1751 diff -urN mysql-4.1.23/mysql-test/r/bigint.result mysql-4.1/mysql-test/r/bigint.result
1752 --- mysql-4.1.23/mysql-test/r/bigint.result 2007-12-02 20:38:25.000000000 +0100
1753 +++ mysql-4.1/mysql-test/r/bigint.result 2007-11-12 12:51:40.000000000 +0100
1755 value64 value32 value64 value32
1756 9223372036854775807 2 9223372036854775807 4
1758 +create table t1 (sint64 bigint not null);
1759 +insert into t1 values (-9223372036854775808);
1762 +-9223372036854775808
1764 diff -urN mysql-4.1.23/mysql-test/r/ctype_big5.result mysql-4.1/mysql-test/r/ctype_big5.result
1765 --- mysql-4.1.23/mysql-test/r/ctype_big5.result 2007-12-02 20:38:51.000000000 +0100
1766 +++ mysql-4.1/mysql-test/r/ctype_big5.result 2007-10-04 07:19:59.000000000 +0200
1771 +create table t1 (a set('a') not null);
1772 +insert into t1 values (),();
1773 +select cast(a as char(1)) from t1;
1777 +select a sounds like a from t1;
1784 SET character_set_server= @safe_character_set_server;
1785 diff -urN mysql-4.1.23/mysql-test/r/ctype_euckr.result mysql-4.1/mysql-test/r/ctype_euckr.result
1786 --- mysql-4.1.23/mysql-test/r/ctype_euckr.result 2007-12-02 20:38:26.000000000 +0100
1787 +++ mysql-4.1/mysql-test/r/ctype_euckr.result 2007-10-04 07:19:59.000000000 +0200
1792 +create table t1 (a set('a') not null);
1793 +insert into t1 values (),();
1794 +select cast(a as char(1)) from t1;
1798 +select a sounds like a from t1;
1805 SET character_set_server= @safe_character_set_server;
1806 diff -urN mysql-4.1.23/mysql-test/r/ctype_gb2312.result mysql-4.1/mysql-test/r/ctype_gb2312.result
1807 --- mysql-4.1.23/mysql-test/r/ctype_gb2312.result 2007-12-02 20:38:26.000000000 +0100
1808 +++ mysql-4.1/mysql-test/r/ctype_gb2312.result 2007-10-04 07:19:59.000000000 +0200
1813 +create table t1 (a set('a') not null);
1814 +insert into t1 values (),();
1815 +select cast(a as char(1)) from t1;
1819 +select a sounds like a from t1;
1826 SET character_set_server= @safe_character_set_server;
1827 diff -urN mysql-4.1.23/mysql-test/r/ctype_gbk.result mysql-4.1/mysql-test/r/ctype_gbk.result
1828 --- mysql-4.1.23/mysql-test/r/ctype_gbk.result 2007-12-02 20:38:51.000000000 +0100
1829 +++ mysql-4.1/mysql-test/r/ctype_gbk.result 2007-10-04 07:19:59.000000000 +0200
1834 +create table t1 (a set('a') not null);
1835 +insert into t1 values (),();
1836 +select cast(a as char(1)) from t1;
1840 +select a sounds like a from t1;
1847 SET character_set_server= @safe_character_set_server;
1848 diff -urN mysql-4.1.23/mysql-test/r/ctype_uca.result mysql-4.1/mysql-test/r/ctype_uca.result
1849 --- mysql-4.1.23/mysql-test/r/ctype_uca.result 2007-12-02 20:38:51.000000000 +0100
1850 +++ mysql-4.1/mysql-test/r/ctype_uca.result 2007-10-04 07:19:59.000000000 +0200
1851 @@ -2371,6 +2371,17 @@
1855 +create table t1 (a set('a') not null);
1856 +insert into t1 values (),();
1857 +select cast(a as char(1)) from t1;
1861 +select a sounds like a from t1;
1868 SET character_set_server= @safe_character_set_server;
1869 diff -urN mysql-4.1.23/mysql-test/r/ctype_ucs.result mysql-4.1/mysql-test/r/ctype_ucs.result
1870 --- mysql-4.1.23/mysql-test/r/ctype_ucs.result 2007-12-02 20:38:27.000000000 +0100
1871 +++ mysql-4.1/mysql-test/r/ctype_ucs.result 2007-10-24 13:09:29.000000000 +0200
1872 @@ -803,4 +803,10 @@
1875 drop table bug20536;
1876 +CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci);
1877 +INSERT INTO t1 VALUES('abcd');
1878 +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
1883 diff -urN mysql-4.1.23/mysql-test/r/delete.result mysql-4.1/mysql-test/r/delete.result
1884 --- mysql-4.1.23/mysql-test/r/delete.result 2007-12-02 20:38:52.000000000 +0100
1885 +++ mysql-4.1/mysql-test/r/delete.result 2007-09-10 14:26:49.000000000 +0200
1886 @@ -193,4 +193,15 @@
1893 +`seq` int(10) unsigned NOT NULL auto_increment,
1894 +PRIMARY KEY (`seq`),
1896 +KEY `time` (`time`),
1897 +KEY `date` (`date`)
1899 +DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
1902 diff -urN mysql-4.1.23/mysql-test/r/fulltext.result mysql-4.1/mysql-test/r/fulltext.result
1903 --- mysql-4.1.23/mysql-test/r/fulltext.result 2007-12-02 20:38:25.000000000 +0100
1904 +++ mysql-4.1/mysql-test/r/fulltext.result 2007-10-30 11:46:42.000000000 +0100
1906 SELECT * FROM t1 WHERE MATCH(a) AGAINST('test');
1907 ERROR HY000: Can't find FULLTEXT index matching the column list
1909 +CREATE TABLE t1(a TEXT);
1910 +INSERT INTO t1 VALUES(' aaaaa aaaa');
1911 +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE);
1915 diff -urN mysql-4.1.23/mysql-test/r/func_str.result mysql-4.1/mysql-test/r/func_str.result
1916 --- mysql-4.1.23/mysql-test/r/func_str.result 2007-12-02 20:38:26.000000000 +0100
1917 +++ mysql-4.1/mysql-test/r/func_str.result 2007-10-30 09:35:02.000000000 +0100
1919 show create table t1;
1921 t1 CREATE TABLE `t1` (
1922 - `bin(130)` char(64) NOT NULL default '',
1923 - `oct(130)` char(64) NOT NULL default '',
1924 - `conv(130,16,10)` char(64) NOT NULL default '',
1925 + `bin(130)` char(64) default NULL,
1926 + `oct(130)` char(64) default NULL,
1927 + `conv(130,16,10)` char(64) default NULL,
1928 `hex(130)` char(6) NOT NULL default '',
1929 `char(130)` char(1) NOT NULL default '',
1930 `format(130,10)` char(4) NOT NULL default '',
1931 @@ -1076,4 +1076,16 @@
1933 Note 1003 select decode(test.t1.f1,'zxcv') AS `enc` from test.t1
1935 +create table t1 (a bigint not null)engine=myisam;
1936 +insert into t1 set a = 1024*1024*1024*4;
1937 +delete from t1 order by (inet_ntoa(a)) desc limit 10;
1939 +create table t1 (a char(36) not null)engine=myisam;
1940 +insert ignore into t1 set a = ' ';
1941 +insert ignore into t1 set a = ' ';
1942 +select * from t1 order by (oct(a));
1948 diff -urN mysql-4.1.23/mysql-test/r/gis.result mysql-4.1/mysql-test/r/gis.result
1949 --- mysql-4.1.23/mysql-test/r/gis.result 2007-12-02 20:38:26.000000000 +0100
1950 +++ mysql-4.1/mysql-test/r/gis.result 2007-10-03 10:35:33.000000000 +0200
1951 @@ -724,4 +724,10 @@
1955 +CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
1956 +INSERT INTO `t1` VALUES ('','0000-00-00');
1957 +select geomfromtext(col9,col89) as a from t1;
1962 diff -urN mysql-4.1.23/mysql-test/r/gis-rtree.result mysql-4.1/mysql-test/r/gis-rtree.result
1963 --- mysql-4.1.23/mysql-test/r/gis-rtree.result 2007-12-02 20:38:27.000000000 +0100
1964 +++ mysql-4.1/mysql-test/r/gis-rtree.result 2007-10-05 12:40:31.000000000 +0200
1965 @@ -1420,3 +1420,34 @@
1966 Table Op Msg_type Msg_text
1967 test.t1 check status OK
1969 +create table t1 (a geometry not null, spatial index(a));
1970 +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
1971 +insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
1972 +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
1973 +insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
1974 +insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
1975 +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
1976 +insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
1977 +insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
1978 +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
1979 +insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
1980 +insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
1981 +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
1982 +insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
1983 +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
1984 +insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
1985 +insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
1986 +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
1987 +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
1988 +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
1989 +insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
1990 +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
1991 +insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
1992 +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
1993 +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
1994 +insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
1995 +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
1996 +insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
1997 +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
1998 +insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
2000 diff -urN mysql-4.1.23/mysql-test/r/group_by.result mysql-4.1/mysql-test/r/group_by.result
2001 --- mysql-4.1.23/mysql-test/r/group_by.result 2007-12-02 20:38:25.000000000 +0100
2002 +++ mysql-4.1/mysql-test/r/group_by.result 2007-07-31 07:45:59.000000000 +0200
2003 @@ -818,3 +818,20 @@
2008 +f1 int(10) unsigned NOT NULL auto_increment primary key,
2009 +f2 varchar(100) NOT NULL default ''
2012 +f1 varchar(10) NOT NULL default '',
2013 +f2 char(3) NOT NULL default '',
2014 +PRIMARY KEY (`f1`),
2015 +KEY `k1` (`f2`,`f1`)
2017 +INSERT INTO t1 values(NULL, '');
2018 +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
2019 +SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
2021 +SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
2024 diff -urN mysql-4.1.23/mysql-test/r/having.result mysql-4.1/mysql-test/r/having.result
2025 --- mysql-4.1.23/mysql-test/r/having.result 2007-12-02 20:38:27.000000000 +0100
2026 +++ mysql-4.1/mysql-test/r/having.result 2007-07-21 07:55:59.000000000 +0200
2027 @@ -158,3 +158,22 @@
2028 id select_type table type possible_keys key key_len ref rows Extra
2029 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
2031 +CREATE TABLE t1 (a int PRIMARY KEY);
2032 +CREATE TABLE t2 (b int PRIMARY KEY, a int);
2033 +CREATE TABLE t3 (b int, flag int);
2034 +INSERT INTO t1 VALUES (1);
2035 +INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
2036 +INSERT INTO t3(b,flag) VALUES (2, 1);
2038 +FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
2039 +GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
2041 +SELECT DISTINCT t1.a, MAX(t3.flag)
2042 +FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
2043 +GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
2045 +SELECT DISTINCT t1.a
2046 +FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
2047 +GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
2049 +DROP TABLE t1,t2,t3;
2050 diff -urN mysql-4.1.23/mysql-test/r/heap_btree.result mysql-4.1/mysql-test/r/heap_btree.result
2051 --- mysql-4.1.23/mysql-test/r/heap_btree.result 2007-12-02 20:38:25.000000000 +0100
2052 +++ mysql-4.1/mysql-test/r/heap_btree.result 2007-09-13 12:39:15.000000000 +0200
2053 @@ -307,4 +307,11 @@
2054 ) ENGINE= MEMORY DEFAULT CHARSET= utf8;
2055 INSERT INTO t1 VALUES('1'), ('2');
2057 +CREATE TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY;
2058 +INSERT INTO t1 VALUES(1),(2),(2);
2059 +DELETE FROM t1 WHERE a=2;
2065 diff -urN mysql-4.1.23/mysql-test/r/innodb_mysql.result mysql-4.1/mysql-test/r/innodb_mysql.result
2066 --- mysql-4.1.23/mysql-test/r/innodb_mysql.result 2007-12-02 20:38:27.000000000 +0100
2067 +++ mysql-4.1/mysql-test/r/innodb_mysql.result 2007-10-04 12:22:30.000000000 +0200
2068 @@ -182,4 +182,40 @@
2069 id select_type table type possible_keys key key_len ref rows Extra
2070 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2072 +CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
2073 +INSERT INTO t1 VALUES ('uk'),('bg');
2074 +SELECT * FROM t1 WHERE a = 'uk';
2077 +DELETE FROM t1 WHERE a = 'uk';
2078 +SELECT * FROM t1 WHERE a = 'uk';
2080 +UPDATE t1 SET a = 'us' WHERE a = 'uk';
2081 +SELECT * FROM t1 WHERE a = 'uk';
2083 +CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
2084 +INSERT INTO t2 VALUES ('uk'),('bg');
2085 +SELECT * FROM t2 WHERE a = 'uk';
2088 +DELETE FROM t2 WHERE a = 'uk';
2089 +SELECT * FROM t2 WHERE a = 'uk';
2091 +INSERT INTO t2 VALUES ('uk');
2092 +UPDATE t2 SET a = 'us' WHERE a = 'uk';
2093 +SELECT * FROM t2 WHERE a = 'uk';
2095 +CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
2096 +INSERT INTO t3 VALUES ('uk'),('bg');
2097 +SELECT * FROM t3 WHERE a = 'uk';
2100 +DELETE FROM t3 WHERE a = 'uk';
2101 +SELECT * FROM t3 WHERE a = 'uk';
2103 +INSERT INTO t3 VALUES ('uk');
2104 +UPDATE t3 SET a = 'us' WHERE a = 'uk';
2105 +SELECT * FROM t3 WHERE a = 'uk';
2107 +DROP TABLE t1,t2,t3;
2109 diff -urN mysql-4.1.23/mysql-test/r/insert_select.result mysql-4.1/mysql-test/r/insert_select.result
2110 --- mysql-4.1.23/mysql-test/r/insert_select.result 2007-12-02 20:38:27.000000000 +0100
2111 +++ mysql-4.1/mysql-test/r/insert_select.result 2007-07-31 07:45:59.000000000 +0200
2112 @@ -690,3 +690,29 @@
2113 INSERT INTO t1 values (1), (2);
2114 INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
2117 +f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
2118 +f2 varchar(100) NOT NULL default ''
2121 +f1 varchar(10) NOT NULL default '',
2122 +f2 char(3) NOT NULL default '',
2123 +PRIMARY KEY (`f1`),
2124 +KEY `k1` (`f2`, `f1`)
2126 +INSERT INTO t1 values(NULL, '');
2127 +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
2128 +SELECT COUNT(*) FROM t1;
2131 +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
2133 +INSERT INTO t1 (f2)
2134 +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
2135 +SELECT COUNT(*) FROM t1;
2142 diff -urN mysql-4.1.23/mysql-test/r/loaddata.result mysql-4.1/mysql-test/r/loaddata.result
2143 --- mysql-4.1.23/mysql-test/r/loaddata.result 2007-12-02 20:38:27.000000000 +0100
2144 +++ mysql-4.1/mysql-test/r/loaddata.result 2007-07-03 18:44:26.000000000 +0200
2146 -drop table if exists t1;
2147 +drop table if exists t1,t2;
2148 create table t1 (a date, b date, c date not null, d date);
2149 load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
2156 +id INT AUTO_INCREMENT PRIMARY KEY,
2163 +INSERT INTO t1 (c1) VALUES
2164 +('r'), ('rr'), ('rrr'), ('rrrr'),
2165 +('.r'), ('.rr'), ('.rrr'), ('.rrrr'),
2166 +('r.'), ('rr.'), ('rrr.'), ('rrrr.'),
2167 +('.r.'), ('.rr.'), ('.rrr.'), ('.rrrr.');
2186 +SELECT * INTO OUTFILE 'MYSQL_TEST_DIR/var/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
2203 +LOAD DATA INFILE 'MYSQL_TEST_DIR/var/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
2204 +SELECT t1.id, c1, c2 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
2206 +SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
2209 diff -urN mysql-4.1.23/mysql-test/r/myisampack.result mysql-4.1/mysql-test/r/myisampack.result
2210 --- mysql-4.1.23/mysql-test/r/myisampack.result 1970-01-01 01:00:00.000000000 +0100
2211 +++ mysql-4.1/mysql-test/r/myisampack.result 2007-11-07 09:55:27.000000000 +0100
2213 +CREATE TABLE t1(c1 DOUBLE, c2 DOUBLE, c3 DOUBLE, c4 DOUBLE, c5 DOUBLE,
2214 +c6 DOUBLE, c7 DOUBLE, c8 DOUBLE, c9 DOUBLE, a INT PRIMARY KEY);
2215 +INSERT INTO t1 VALUES
2216 +(-3.31168791059336e-06,-3.19054655887874e-06,-1.06528081684847e-05,-1.227278240089e-06,-1.66718069164799e-06,-2.59038972510885e-06,-2.83145227805303e-06,-4.09678491270648e-07,-2.22610091291797e-06,6),
2217 +(0.0030743000272545,2.53222044316438e-05,2.78674650061845e-05,1.95914465544536e-05,1.7347572525984e-05,1.87513810069614e-05,1.69882826885005e-05,2.44449336987598e-05,1.89914629921774e-05,9),
2218 +(2.85229319423495e-05,3.05970988282259e-05,3.77161100113133e-05,2.3055238978766e-05,2.08241267364615e-05,2.28009504270553e-05,2.12070165658947e-05,2.84350091565409e-05,2.3366822910704e-05,3),
2219 +(0,0,0,0,0,0,0,0,0,12),
2220 +(3.24544577570754e-05,3.44619021870993e-05,4.37561613201124e-05,2.57556808726748e-05,2.3195354640561e-05,2.58532400758869e-05,2.34934241667179e-05,3.1621640063232e-05,2.58229982746189e-05,19),
2221 +(2.53222044316438e-05,0.00445071933455582,2.97447268116016e-05,2.12379514059868e-05,1.86777776502663e-05,2.0170058676712e-05,1.8946030385445e-05,2.66040037173511e-05,2.09161899668946e-05,20),
2222 +(3.03462382611645e-05,3.26517930083994e-05,3.5242025468662e-05,2.53219745106391e-05,2.24384532945004e-05,2.4052346047657e-05,2.23865572957053e-05,3.1634313969082e-05,2.48285463481801e-05,21),
2223 +(1.95914465544536e-05,2.12379514059868e-05,2.27808649037128e-05,0.000341724375366877,1.4512761275113e-05,1.56475828693953e-05,1.44372366441415e-05,2.07952121981765e-05,1.61488256935919e-05,28),
2224 +(1.7347572525984e-05,1.86777776502663e-05,2.04116907052727e-05,1.4512761275113e-05,0.000432162526082388,1.38116514014465e-05,1.2712914948904e-05,1.82503165178506e-05,1.43043075345922e-05,30),
2225 +(1.68339762136661e-05,1.77836497166611e-05,2.36328309295222e-05,1.30183423732016e-05,1.18674654241553e-05,1.32467273128652e-05,1.24581739117775e-05,1.55624190959406e-05,1.33010638508213e-05,31),
2226 +(1.89643062824415e-05,2.06997140070717e-05,2.29045490159364e-05,1.57918175731019e-05,1.39864987449492e-05,1.50580274578455e-05,1.45908734129609e-05,1.95329296993327e-05,1.5814709481221e-05,32),
2227 +(1.69882826885005e-05,1.8946030385445e-05,2.00820439721439e-05,1.44372366441415e-05,1.2712914948904e-05,1.35209686474184e-05,0.00261563314789896,1.78285095864627e-05,1.46699314500019e-05,34),
2228 +(2.0278186540684e-05,2.18923409729654e-05,2.39981539939738e-05,1.71774589459438e-05,1.54654355357383e-05,1.62731485707636e-05,1.49253140625051e-05,2.18229800160297e-05,1.71923561673718e-05,35),
2229 +(2.44449336987598e-05,2.66040037173511e-05,2.84860148925308e-05,2.07952121981765e-05,1.82503165178506e-05,1.97667730441441e-05,1.78285095864627e-05,0.00166478601822712,2.0299952103232e-05,36),
2230 +(1.89914629921774e-05,2.09161899668946e-05,2.26026841007872e-05,1.61488256935919e-05,1.43043075345922e-05,1.52609063290127e-05,1.46699314500019e-05,2.0299952103232e-05,0.00306670170971682,39),
2231 +(0,0,0,0,0,0,0,0,0,41),
2232 +(0,0,0,0,0,0,0,0,0,17),
2233 +(0,0,0,0,0,0,0,0,0,18),
2234 +(2.51880677333017e-05,2.63051795435778e-05,2.79874748974906e-05,2.02888886670845e-05,1.8178636318197e-05,1.91308527003585e-05,1.83260023644133e-05,2.4422300558171e-05,1.96411467520551e-05,44),
2235 +(2.22402118719591e-05,2.37546284320705e-05,2.58463051055541e-05,1.83391609130854e-05,1.6300720519646e-05,1.74559091886791e-05,1.63733785575587e-05,2.26616253279828e-05,1.79541237435621e-05,45),
2236 +(3.01092775359837e-05,3.23865212934412e-05,4.09444584045994e-05,0,2.15470966302776e-05,2.39082636344032e-05,2.28296706429177e-05,2.9007671511595e-05,2.44201138973326e-05,46);
2238 +CHECK TABLE t1 EXTENDED;
2239 +Table Op Msg_type Msg_text
2240 +test.t1 check status OK
2242 diff -urN mysql-4.1.23/mysql-test/r/mysqltest.result mysql-4.1/mysql-test/r/mysqltest.result
2243 --- mysql-4.1.23/mysql-test/r/mysqltest.result 2007-12-02 20:38:26.000000000 +0100
2244 +++ mysql-4.1/mysql-test/r/mysqltest.result 2007-06-19 11:06:02.000000000 +0200
2248 here is the sourced script
2249 +here is the sourced script
2250 mysqltest: At line 1: Missing argument to sleep
2251 mysqltest: At line 1: Missing argument to real_sleep
2252 mysqltest: At line 1: Invalid argument to sleep "abc"
2253 @@ -655,4 +656,43 @@
2254 INSERT INTO t1 SELECT f1 - 512 FROM t1;
2258 +a int, b varchar(255), c datetime
2260 +SHOW COLUMNS FROM t1;
2261 +Field Type Null Key Default Extra
2263 +b varchar(255) YES NULL
2264 +c datetime YES NULL
2265 +statement=SHOW COLUMNS FROM t1 row_number=1, column_name="Type", Value=int(11)
2266 +statement="SHOW COLUMNS FROM t1" row_number=1, column_name="Type", Value=int(11)
2267 +statement=SHOW COLUMNS FROM t1 row_number=1, column_name=Default, Value=NULL
2270 +mysqltest: At line 1: query_get_value - argument list started with '(' must be ended with ')'
2271 +mysqltest: At line 1: Missing required argument 'query' to command 'query_get_value'
2272 +mysqltest: At line 1: Missing required argument 'column name' to command 'query_get_value'
2273 +mysqltest: At line 1: Missing required argument 'row number' to command 'query_get_value'
2276 +mysqltest: At line 1: Invalid row number: 'notnumber'
2277 +mysqltest: At line 1: Could not find column 'column_not_exists' in the result of 'SHOW COLUMNS FROM t1'
2278 +mysqltest: At line 1: Query 'SET @A = 1' didn't return a result set
2279 +mysqltest: At line 1: Could not find column '1 AS B' in the result of 'SELECT 1 AS A'
2281 +mysqltest: At line 1: Error running query 'SHOW COLNS FROM t1': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLNS FROM t1' at line 1
2283 +Field Type Null Key Default Extra
2284 +a int(11) YES -><- NULL
2285 +b varchar(255) YES -><- NULL
2286 +c datetime YES -><- NULL
2288 +Number of columns with Default NULL: 3
2290 +SHOW COLUMNS FROM t1;
2291 +Field Type Null Key Default Extra
2293 +b varchar(255) YES NULL
2294 +c datetime YES NULL
2297 diff -urN mysql-4.1.23/mysql-test/r/repair.result mysql-4.1/mysql-test/r/repair.result
2298 --- mysql-4.1.23/mysql-test/r/repair.result 2007-12-02 20:38:25.000000000 +0100
2299 +++ mysql-4.1/mysql-test/r/repair.result 2007-10-17 08:29:45.000000000 +0200
2301 SET myisam_repair_threads=@@global.myisam_repair_threads;
2302 SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
2304 +CREATE TABLE t1(a CHAR(255), KEY(a));
2305 +SET myisam_sort_buffer_size=4496;
2306 +INSERT INTO t1 VALUES
2307 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2308 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2309 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2310 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2311 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2312 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2313 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2314 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2315 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2316 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2317 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2318 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2319 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2320 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2321 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
2322 +('0'),('0'),('0'),('0'),('0'),('0'),('0');
2323 +SET myisam_repair_threads=2;
2325 +Table Op Msg_type Msg_text
2326 +test.t1 repair status OK
2327 +SET myisam_repair_threads=@@global.myisam_repair_threads;
2328 +SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
2331 diff -urN mysql-4.1.23/mysql-test/r/rpl_change_master.result mysql-4.1/mysql-test/r/rpl_change_master.result
2332 --- mysql-4.1.23/mysql-test/r/rpl_change_master.result 2007-12-02 20:38:25.000000000 +0100
2333 +++ mysql-4.1/mysql-test/r/rpl_change_master.result 2007-06-19 12:19:19.000000000 +0200
2338 -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
2339 -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 273 slave-relay-bin.000002 258 master-bin.000001 No No 0 0 214 317 None 0 No #
2341 +Master_Host 127.0.0.1
2343 +Master_Port MASTER_MYPORT
2345 +Master_Log_File master-bin.000001
2346 +Read_Master_Log_Pos 273
2347 +Relay_Log_File slave-relay-bin.000002
2349 +Relay_Master_Log_File master-bin.000001
2350 +Slave_IO_Running No
2351 +Slave_SQL_Running No
2353 +Replicate_Ignore_DB
2355 +Replicate_Ignore_Table
2356 +Replicate_Wild_Do_Table
2357 +Replicate_Wild_Ignore_Table
2361 +Exec_Master_Log_Pos 214
2362 +Relay_Log_Space 317
2363 +Until_Condition None
2366 +Master_SSL_Allowed No
2372 +Seconds_Behind_Master #
2373 change master to master_user='root';
2375 -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
2376 -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 214 # # master-bin.000001 No No 0 0 214 # None 0 No #
2378 +Master_Host 127.0.0.1
2380 +Master_Port MASTER_MYPORT
2382 +Master_Log_File master-bin.000001
2383 +Read_Master_Log_Pos 214
2386 +Relay_Master_Log_File master-bin.000001
2387 +Slave_IO_Running No
2388 +Slave_SQL_Running No
2390 +Replicate_Ignore_DB
2392 +Replicate_Ignore_Table
2393 +Replicate_Wild_Do_Table
2394 +Replicate_Wild_Ignore_Table
2398 +Exec_Master_Log_Pos 214
2400 +Until_Condition None
2403 +Master_SSL_Allowed No
2409 +Seconds_Behind_Master #
2410 select release_lock("a");
2413 diff -urN mysql-4.1.23/mysql-test/r/select.result mysql-4.1/mysql-test/r/select.result
2414 --- mysql-4.1.23/mysql-test/r/select.result 2007-12-02 20:38:26.000000000 +0100
2415 +++ mysql-4.1/mysql-test/r/select.result 2007-11-07 16:45:01.000000000 +0100
2416 @@ -2835,4 +2835,12 @@
2417 FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF
2418 8FFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF
2420 +CREATE TABLE t1 (c0 int);
2421 +CREATE TABLE t2 (c0 int);
2422 +INSERT INTO t1 VALUES(@@connect_timeout);
2423 +INSERT INTO t2 VALUES(@@connect_timeout);
2424 +SELECT * FROM t1 JOIN t2 ON t1.c0 = t2.c0 WHERE (t1.c0 <=> @@connect_timeout);
2429 diff -urN mysql-4.1.23/mysql-test/r/subselect.result mysql-4.1/mysql-test/r/subselect.result
2430 --- mysql-4.1.23/mysql-test/r/subselect.result 2007-12-02 20:38:27.000000000 +0100
2431 +++ mysql-4.1/mysql-test/r/subselect.result 2007-06-06 15:29:14.000000000 +0200
2432 @@ -2834,6 +2834,8 @@
2434 DROP TABLE t1,t2,t3;
2435 purge master logs before (select adddate(current_timestamp(), interval -4 day));
2436 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select adddate(current_timestamp(), interval -4 day))' at line 1
2437 +purge master logs before adddate(current_timestamp(), interval -4 day);
2438 CREATE TABLE t1 (f1 INT);
2439 CREATE TABLE t2 (f2 INT);
2440 INSERT INTO t1 VALUES (1);
2441 diff -urN mysql-4.1.23/mysql-test/r/symlink.result mysql-4.1/mysql-test/r/symlink.result
2442 --- mysql-4.1.23/mysql-test/r/symlink.result 2007-12-02 20:38:26.000000000 +0100
2443 +++ mysql-4.1/mysql-test/r/symlink.result 2007-11-12 18:51:47.000000000 +0100
2445 `b` int(11) default NULL
2446 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
2448 +CREATE TABLE t1(a INT)
2449 +DATA DIRECTORY='TEST_DIR/master-data/mysql'
2450 +INDEX DIRECTORY='TEST_DIR/master-data/mysql';
2451 +RENAME TABLE t1 TO user;
2452 +ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17)
2454 show create table t1;
2456 t1 CREATE TABLE `t1` (
2457 diff -urN mysql-4.1.23/mysql-test/r/type_enum.result mysql-4.1/mysql-test/r/type_enum.result
2458 --- mysql-4.1.23/mysql-test/r/type_enum.result 2007-12-02 20:38:26.000000000 +0100
2459 +++ mysql-4.1/mysql-test/r/type_enum.result 2007-06-27 00:41:47.000000000 +0200
2460 @@ -1778,4 +1778,27 @@
2461 create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
\ 1\ 2\ 3\ 4\ 5\ 6\a\b
2462 \v\f\r\ e\ f\10\11\12\13\14\15\16\17\18\19\1a\e\1c\1d\1e\1f !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\
\7f','yy\
\80','zz
\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'));
2463 ERROR 42000: Field separator argument is not what is expected; check the manual
2465 +id INT AUTO_INCREMENT PRIMARY KEY,
2466 +c1 ENUM('a', '', 'b')
2468 +INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
2470 +Warning 1265 Data truncated for column 'c1' at row 1
2471 +SELECT id, c1 + 0, c1 FROM t1;
2477 +ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL;
2479 +Warning 1265 Data truncated for column 'c1' at row 4
2480 +SELECT id, c1 + 0, c1 FROM t1;
2488 diff -urN mysql-4.1.23/mysql-test/r/variables.result mysql-4.1/mysql-test/r/variables.result
2489 --- mysql-4.1.23/mysql-test/r/variables.result 2007-12-02 20:38:25.000000000 +0100
2490 +++ mysql-4.1/mysql-test/r/variables.result 2007-10-18 10:47:51.000000000 +0200
2492 select @@query_prealloc_size = @test;
2493 @@query_prealloc_size = @test
2495 +set global sql_mode=repeat('a',80);
2496 +ERROR 42000: Variable 'sql_mode' can't be set to the value of 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
2498 diff -urN mysql-4.1.23/mysql-test/t/almost_full.test mysql-4.1/mysql-test/t/almost_full.test
2499 --- mysql-4.1.23/mysql-test/t/almost_full.test 1970-01-01 01:00:00.000000000 +0100
2500 +++ mysql-4.1/mysql-test/t/almost_full.test 2007-11-12 10:00:21.000000000 +0100
2503 +# Some special cases with empty tables
2507 +drop table if exists t1;
2510 +set global myisam_data_pointer_size=2;
2511 +CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM;
2513 +--disable_query_log
2517 + INSERT INTO t1 SET b=repeat('a',200);
2522 +DELETE FROM t1 WHERE a=1 or a=5;
2525 +INSERT INTO t1 SET b=repeat('a',600);
2526 +CHECK TABLE t1 EXTENDED;
2529 +UPDATE t1 SET b=repeat('a', 800) where a=10;
2530 +CHECK TABLE t1 EXTENDED;
2532 +INSERT INTO t1 SET b=repeat('a',400);
2533 +CHECK TABLE t1 EXTENDED;
2535 +DELETE FROM t1 WHERE a=2 or a=6;
2536 +UPDATE t1 SET b=repeat('a', 600) where a=11;
2537 +CHECK TABLE t1 EXTENDED;
2540 +set global myisam_data_pointer_size=default;
2543 diff -urN mysql-4.1.23/mysql-test/t/bigint.test mysql-4.1/mysql-test/t/bigint.test
2544 --- mysql-4.1.23/mysql-test/t/bigint.test 2007-12-02 20:38:51.000000000 +0100
2545 +++ mysql-4.1/mysql-test/t/bigint.test 2007-11-12 12:51:40.000000000 +0100
2546 @@ -107,4 +107,13 @@
2550 +# Test for BUG#30069, can't handle bigint -9223372036854775808 on
2551 +# x86_64, with some GCC versions and optimizations.
2553 +create table t1 (sint64 bigint not null);
2554 +insert into t1 values (-9223372036854775808);
2560 diff -urN mysql-4.1.23/mysql-test/t/ctype_ucs.test mysql-4.1/mysql-test/t/ctype_ucs.test
2561 --- mysql-4.1.23/mysql-test/t/ctype_ucs.test 2007-12-02 20:38:51.000000000 +0100
2562 +++ mysql-4.1/mysql-test/t/ctype_ucs.test 2007-10-24 13:09:29.000000000 +0200
2563 @@ -535,4 +535,12 @@
2565 drop table bug20536;
2568 +# BUG#31159 - fulltext search on ucs2 column crashes server
2570 +CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci);
2571 +INSERT INTO t1 VALUES('abcd');
2572 +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
2575 --echo End of 4.1 tests
2576 diff -urN mysql-4.1.23/mysql-test/t/delete.test mysql-4.1/mysql-test/t/delete.test
2577 --- mysql-4.1.23/mysql-test/t/delete.test 2007-12-02 20:38:52.000000000 +0100
2578 +++ mysql-4.1/mysql-test/t/delete.test 2007-09-10 14:26:49.000000000 +0200
2579 @@ -184,4 +184,17 @@
2583 +# BUG#30385 "Server crash when deleting with order by and limit"
2587 + `seq` int(10) unsigned NOT NULL auto_increment,
2588 + PRIMARY KEY (`seq`),
2589 + KEY `seq` (`seq`),
2590 + KEY `time` (`time`),
2591 + KEY `date` (`date`)
2593 +DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
2596 --echo End of 4.1 tests
2597 diff -urN mysql-4.1.23/mysql-test/t/disabled.def mysql-4.1/mysql-test/t/disabled.def
2598 --- mysql-4.1.23/mysql-test/t/disabled.def 2007-12-02 20:38:51.000000000 +0100
2599 +++ mysql-4.1/mysql-test/t/disabled.def 2007-11-02 10:11:26.000000000 +0100
2602 ##############################################################################
2604 +rpl000015 : Bug#31030 - rpl000015.test fails if $MYSQL_TCP_PORT != 3306
2605 diff -urN mysql-4.1.23/mysql-test/t/fulltext.test mysql-4.1/mysql-test/t/fulltext.test
2606 --- mysql-4.1.23/mysql-test/t/fulltext.test 2007-12-02 20:38:26.000000000 +0100
2607 +++ mysql-4.1/mysql-test/t/fulltext.test 2007-10-30 11:46:42.000000000 +0100
2608 @@ -379,4 +379,12 @@
2609 SELECT * FROM t1 WHERE MATCH(a) AGAINST('test');
2613 +# BUG#11392 - fulltext search bug
2615 +CREATE TABLE t1(a TEXT);
2616 +INSERT INTO t1 VALUES(' aaaaa aaaa');
2617 +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE);
2621 diff -urN mysql-4.1.23/mysql-test/t/func_str.test mysql-4.1/mysql-test/t/func_str.test
2622 --- mysql-4.1.23/mysql-test/t/func_str.test 2007-12-02 20:38:26.000000000 +0100
2623 +++ mysql-4.1/mysql-test/t/func_str.test 2007-10-30 09:35:02.000000000 +0100
2624 @@ -721,4 +721,17 @@
2625 explain extended select decode(f1,'zxcv') as 'enc' from t1;
2629 +# Bug #31758 inet_ntoa, oct, crashes server with null + filesort
2631 +create table t1 (a bigint not null)engine=myisam;
2632 +insert into t1 set a = 1024*1024*1024*4;
2633 +delete from t1 order by (inet_ntoa(a)) desc limit 10;
2635 +create table t1 (a char(36) not null)engine=myisam;
2636 +insert ignore into t1 set a = ' ';
2637 +insert ignore into t1 set a = ' ';
2638 +select * from t1 order by (oct(a));
2641 --echo End of 4.1 tests
2642 diff -urN mysql-4.1.23/mysql-test/t/gis-rtree.test mysql-4.1/mysql-test/t/gis-rtree.test
2643 --- mysql-4.1.23/mysql-test/t/gis-rtree.test 2007-12-02 20:38:26.000000000 +0100
2644 +++ mysql-4.1/mysql-test/t/gis-rtree.test 2007-10-05 12:40:31.000000000 +0200
2645 @@ -798,4 +798,40 @@
2646 CHECK TABLE t1 EXTENDED;
2650 +# Bug #30286 spatial index cause corruption and server crash!
2653 +create table t1 (a geometry not null, spatial index(a));
2654 +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
2655 +insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
2656 +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
2657 +insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
2658 +insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
2659 +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
2660 +insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
2661 +insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
2662 +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
2663 +insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
2664 +insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
2665 +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
2666 +insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
2667 +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
2668 +insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
2669 +insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
2670 +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
2671 +insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
2672 +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
2673 +insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
2674 +insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
2675 +insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
2676 +insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
2677 +insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
2678 +insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
2679 +insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
2680 +insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
2681 +insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
2682 +insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
2686 diff -urN mysql-4.1.23/mysql-test/t/gis.test mysql-4.1/mysql-test/t/gis.test
2687 --- mysql-4.1.23/mysql-test/t/gis.test 2007-12-02 20:38:27.000000000 +0100
2688 +++ mysql-4.1/mysql-test/t/gis.test 2007-10-03 10:35:33.000000000 +0200
2689 @@ -419,4 +419,12 @@
2694 +# Bug #30955 geomfromtext() crasher
2696 +CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
2697 +INSERT INTO `t1` VALUES ('','0000-00-00');
2698 +select geomfromtext(col9,col89) as a from t1;
2701 --echo End of 4.1 tests
2702 diff -urN mysql-4.1.23/mysql-test/t/group_by.test mysql-4.1/mysql-test/t/group_by.test
2703 --- mysql-4.1.23/mysql-test/t/group_by.test 2007-12-02 20:38:27.000000000 +0100
2704 +++ mysql-4.1/mysql-test/t/group_by.test 2007-07-31 07:45:59.000000000 +0200
2705 @@ -633,4 +633,27 @@
2706 SELECT a FROM t1 ORDER BY "a" DESC;
2707 SELECT a FROM t1 ORDER BY `a` DESC;
2712 +# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself
2716 + f1 int(10) unsigned NOT NULL auto_increment primary key,
2717 + f2 varchar(100) NOT NULL default ''
2720 + f1 varchar(10) NOT NULL default '',
2721 + f2 char(3) NOT NULL default '',
2722 + PRIMARY KEY (`f1`),
2723 + KEY `k1` (`f2`,`f1`)
2726 +INSERT INTO t1 values(NULL, '');
2727 +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
2728 +SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
2729 +SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
2733 diff -urN mysql-4.1.23/mysql-test/t/having.test mysql-4.1/mysql-test/t/having.test
2734 --- mysql-4.1.23/mysql-test/t/having.test 2007-12-02 20:38:26.000000000 +0100
2735 +++ mysql-4.1/mysql-test/t/having.test 2007-07-21 07:55:59.000000000 +0200
2736 @@ -151,4 +151,30 @@
2741 +# Bug #29911: HAVING clause depending on constant table and evaluated to false
2744 +CREATE TABLE t1 (a int PRIMARY KEY);
2745 +CREATE TABLE t2 (b int PRIMARY KEY, a int);
2746 +CREATE TABLE t3 (b int, flag int);
2748 +INSERT INTO t1 VALUES (1);
2749 +INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
2750 +INSERT INTO t3(b,flag) VALUES (2, 1);
2753 + FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
2754 + GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
2756 +SELECT DISTINCT t1.a, MAX(t3.flag)
2757 + FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
2758 + GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
2760 +SELECT DISTINCT t1.a
2761 + FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
2762 + GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
2764 +DROP TABLE t1,t2,t3;
2767 diff -urN mysql-4.1.23/mysql-test/t/heap_btree.test mysql-4.1/mysql-test/t/heap_btree.test
2768 --- mysql-4.1.23/mysql-test/t/heap_btree.test 2007-12-02 20:38:51.000000000 +0100
2769 +++ mysql-4.1/mysql-test/t/heap_btree.test 2007-09-13 12:39:15.000000000 +0200
2770 @@ -213,4 +213,13 @@
2771 INSERT INTO t1 VALUES('1'), ('2');
2775 +# BUG#30590 - delete from memory table with composite btree primary key
2777 +CREATE TABLE t1 (a INT, KEY USING BTREE(a)) ENGINE=MEMORY;
2778 +INSERT INTO t1 VALUES(1),(2),(2);
2779 +DELETE FROM t1 WHERE a=2;
2783 --echo End of 4.1 tests
2784 diff -urN mysql-4.1.23/mysql-test/t/innodb_mysql.test mysql-4.1/mysql-test/t/innodb_mysql.test
2785 --- mysql-4.1.23/mysql-test/t/innodb_mysql.test 2007-12-02 20:38:26.000000000 +0100
2786 +++ mysql-4.1/mysql-test/t/innodb_mysql.test 2007-10-04 12:22:30.000000000 +0200
2787 @@ -216,4 +216,36 @@
2792 +# Bug #28878: InnoDB tables with UTF8 character set and indexes cause wrong result for DML
2795 +CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
2796 +INSERT INTO t1 VALUES ('uk'),('bg');
2797 +SELECT * FROM t1 WHERE a = 'uk';
2798 +DELETE FROM t1 WHERE a = 'uk';
2799 +SELECT * FROM t1 WHERE a = 'uk';
2800 +UPDATE t1 SET a = 'us' WHERE a = 'uk';
2801 +SELECT * FROM t1 WHERE a = 'uk';
2803 +CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
2804 +INSERT INTO t2 VALUES ('uk'),('bg');
2805 +SELECT * FROM t2 WHERE a = 'uk';
2806 +DELETE FROM t2 WHERE a = 'uk';
2807 +SELECT * FROM t2 WHERE a = 'uk';
2808 +INSERT INTO t2 VALUES ('uk');
2809 +UPDATE t2 SET a = 'us' WHERE a = 'uk';
2810 +SELECT * FROM t2 WHERE a = 'uk';
2812 +CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
2813 +INSERT INTO t3 VALUES ('uk'),('bg');
2814 +SELECT * FROM t3 WHERE a = 'uk';
2815 +DELETE FROM t3 WHERE a = 'uk';
2816 +SELECT * FROM t3 WHERE a = 'uk';
2817 +INSERT INTO t3 VALUES ('uk');
2818 +UPDATE t3 SET a = 'us' WHERE a = 'uk';
2819 +SELECT * FROM t3 WHERE a = 'uk';
2821 +DROP TABLE t1,t2,t3;
2823 --echo End of 4.1 tests
2824 diff -urN mysql-4.1.23/mysql-test/t/insert_select.test mysql-4.1/mysql-test/t/insert_select.test
2825 --- mysql-4.1.23/mysql-test/t/insert_select.test 2007-12-02 20:38:51.000000000 +0100
2826 +++ mysql-4.1/mysql-test/t/insert_select.test 2007-07-31 07:45:59.000000000 +0200
2827 @@ -239,4 +239,32 @@
2832 +# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty
2836 + f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
2837 + f2 varchar(100) NOT NULL default ''
2840 + f1 varchar(10) NOT NULL default '',
2841 + f2 char(3) NOT NULL default '',
2842 + PRIMARY KEY (`f1`),
2843 + KEY `k1` (`f2`, `f1`)
2846 +INSERT INTO t1 values(NULL, '');
2847 +INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
2848 +SELECT COUNT(*) FROM t1;
2850 +SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
2852 +INSERT INTO t1 (f2)
2853 + SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
2855 +SELECT COUNT(*) FROM t1;
2860 diff -urN mysql-4.1.23/mysql-test/t/loaddata.test mysql-4.1/mysql-test/t/loaddata.test
2861 --- mysql-4.1.23/mysql-test/t/loaddata.test 2007-12-02 20:38:52.000000000 +0100
2862 +++ mysql-4.1/mysql-test/t/loaddata.test 2007-07-03 18:38:21.000000000 +0200
2867 -drop table if exists t1;
2868 +drop table if exists t1,t2;
2871 create table t1 (a date, b date, c date not null, d date);
2877 +# Bug #29294 SELECT INTO OUTFILE/LOAD DATA INFILE with special
2878 +# characters in the FIELDS ENCLOSED BY clause
2882 + id INT AUTO_INCREMENT PRIMARY KEY,
2891 +INSERT INTO t1 (c1) VALUES
2892 + ('r'), ('rr'), ('rrr'), ('rrrr'),
2893 + ('.r'), ('.rr'), ('.rrr'), ('.rrrr'),
2894 + ('r.'), ('rr.'), ('rrr.'), ('rrrr.'),
2895 + ('.r.'), ('.rr.'), ('.rrr.'), ('.rrrr.');
2898 +--exec rm -f $MYSQL_TEST_DIR/var/tmp/t1
2899 +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2900 +eval SELECT * INTO OUTFILE '$MYSQL_TEST_DIR/var/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
2901 +--exec cat $MYSQL_TEST_DIR/var/tmp/t1
2903 +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
2904 +eval LOAD DATA INFILE '$MYSQL_TEST_DIR/var/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
2905 +SELECT t1.id, c1, c2 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
2906 +SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
2908 +--exec rm $MYSQL_TEST_DIR/var/tmp/t1
2912 diff -urN mysql-4.1.23/mysql-test/t/myisampack.test mysql-4.1/mysql-test/t/myisampack.test
2913 --- mysql-4.1.23/mysql-test/t/myisampack.test 1970-01-01 01:00:00.000000000 +0100
2914 +++ mysql-4.1/mysql-test/t/myisampack.test 2007-11-07 09:55:27.000000000 +0100
2917 +# BUG#31277 - myisamchk --unpack corrupts a table
2919 +CREATE TABLE t1(c1 DOUBLE, c2 DOUBLE, c3 DOUBLE, c4 DOUBLE, c5 DOUBLE,
2920 + c6 DOUBLE, c7 DOUBLE, c8 DOUBLE, c9 DOUBLE, a INT PRIMARY KEY);
2921 +INSERT INTO t1 VALUES
2922 +(-3.31168791059336e-06,-3.19054655887874e-06,-1.06528081684847e-05,-1.227278240089e-06,-1.66718069164799e-06,-2.59038972510885e-06,-2.83145227805303e-06,-4.09678491270648e-07,-2.22610091291797e-06,6),
2923 +(0.0030743000272545,2.53222044316438e-05,2.78674650061845e-05,1.95914465544536e-05,1.7347572525984e-05,1.87513810069614e-05,1.69882826885005e-05,2.44449336987598e-05,1.89914629921774e-05,9),
2924 +(2.85229319423495e-05,3.05970988282259e-05,3.77161100113133e-05,2.3055238978766e-05,2.08241267364615e-05,2.28009504270553e-05,2.12070165658947e-05,2.84350091565409e-05,2.3366822910704e-05,3),
2925 +(0,0,0,0,0,0,0,0,0,12),
2926 +(3.24544577570754e-05,3.44619021870993e-05,4.37561613201124e-05,2.57556808726748e-05,2.3195354640561e-05,2.58532400758869e-05,2.34934241667179e-05,3.1621640063232e-05,2.58229982746189e-05,19),
2927 +(2.53222044316438e-05,0.00445071933455582,2.97447268116016e-05,2.12379514059868e-05,1.86777776502663e-05,2.0170058676712e-05,1.8946030385445e-05,2.66040037173511e-05,2.09161899668946e-05,20),
2928 +(3.03462382611645e-05,3.26517930083994e-05,3.5242025468662e-05,2.53219745106391e-05,2.24384532945004e-05,2.4052346047657e-05,2.23865572957053e-05,3.1634313969082e-05,2.48285463481801e-05,21),
2929 +(1.95914465544536e-05,2.12379514059868e-05,2.27808649037128e-05,0.000341724375366877,1.4512761275113e-05,1.56475828693953e-05,1.44372366441415e-05,2.07952121981765e-05,1.61488256935919e-05,28),
2930 +(1.7347572525984e-05,1.86777776502663e-05,2.04116907052727e-05,1.4512761275113e-05,0.000432162526082388,1.38116514014465e-05,1.2712914948904e-05,1.82503165178506e-05,1.43043075345922e-05,30),
2931 +(1.68339762136661e-05,1.77836497166611e-05,2.36328309295222e-05,1.30183423732016e-05,1.18674654241553e-05,1.32467273128652e-05,1.24581739117775e-05,1.55624190959406e-05,1.33010638508213e-05,31),
2932 +(1.89643062824415e-05,2.06997140070717e-05,2.29045490159364e-05,1.57918175731019e-05,1.39864987449492e-05,1.50580274578455e-05,1.45908734129609e-05,1.95329296993327e-05,1.5814709481221e-05,32),
2933 +(1.69882826885005e-05,1.8946030385445e-05,2.00820439721439e-05,1.44372366441415e-05,1.2712914948904e-05,1.35209686474184e-05,0.00261563314789896,1.78285095864627e-05,1.46699314500019e-05,34),
2934 +(2.0278186540684e-05,2.18923409729654e-05,2.39981539939738e-05,1.71774589459438e-05,1.54654355357383e-05,1.62731485707636e-05,1.49253140625051e-05,2.18229800160297e-05,1.71923561673718e-05,35),
2935 +(2.44449336987598e-05,2.66040037173511e-05,2.84860148925308e-05,2.07952121981765e-05,1.82503165178506e-05,1.97667730441441e-05,1.78285095864627e-05,0.00166478601822712,2.0299952103232e-05,36),
2936 +(1.89914629921774e-05,2.09161899668946e-05,2.26026841007872e-05,1.61488256935919e-05,1.43043075345922e-05,1.52609063290127e-05,1.46699314500019e-05,2.0299952103232e-05,0.00306670170971682,39),
2937 +(0,0,0,0,0,0,0,0,0,41),
2938 +(0,0,0,0,0,0,0,0,0,17),
2939 +(0,0,0,0,0,0,0,0,0,18),
2940 +(2.51880677333017e-05,2.63051795435778e-05,2.79874748974906e-05,2.02888886670845e-05,1.8178636318197e-05,1.91308527003585e-05,1.83260023644133e-05,2.4422300558171e-05,1.96411467520551e-05,44),
2941 +(2.22402118719591e-05,2.37546284320705e-05,2.58463051055541e-05,1.83391609130854e-05,1.6300720519646e-05,1.74559091886791e-05,1.63733785575587e-05,2.26616253279828e-05,1.79541237435621e-05,45),
2942 +(3.01092775359837e-05,3.23865212934412e-05,4.09444584045994e-05,0,2.15470966302776e-05,2.39082636344032e-05,2.28296706429177e-05,2.9007671511595e-05,2.44201138973326e-05,46);
2944 +--exec $MYISAMPACK -s $MYSQLTEST_VARDIR/master-data/test/t1
2945 +--exec $MYISAMCHK -srq $MYSQLTEST_VARDIR/master-data/test/t1
2946 +--exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1
2947 +CHECK TABLE t1 EXTENDED;
2949 diff -urN mysql-4.1.23/mysql-test/t/mysqltest.test mysql-4.1/mysql-test/t/mysqltest.test
2950 --- mysql-4.1.23/mysql-test/t/mysqltest.test 2007-12-02 20:38:27.000000000 +0100
2951 +++ mysql-4.1/mysql-test/t/mysqltest.test 2007-06-19 11:06:02.000000000 +0200
2952 @@ -807,6 +807,10 @@
2954 --enable_abort_on_error
2957 +# Test source $variable/<filename>
2958 +--source $MYSQLTEST_VARDIR/tmp/sourced.inc
2960 --remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
2962 # ----------------------------------------------------------------------------
2963 @@ -1811,4 +1815,125 @@
2967 +# ----------------------------------------------------------------------------
2968 +# test for query_get_value
2969 +# ----------------------------------------------------------------------------
2972 + a int, b varchar(255), c datetime
2974 +SHOW COLUMNS FROM t1;
2976 +#------------ Positive tests ------------
2977 +# 1. constant parameters
2978 +# value is simple string without spaces
2979 +let $value= query_get_value(SHOW COLUMNS FROM t1, Type, 1);
2980 +--echo statement=SHOW COLUMNS FROM t1 row_number=1, column_name="Type", Value=$value
2981 +let $value= query_get_value("SHOW COLUMNS FROM t1", Type, 1);
2982 +--echo statement="SHOW COLUMNS FROM t1" row_number=1, column_name="Type", Value=$value
2984 +# 2. $variables as parameters
2986 +let $my_show= SHOW COLUMNS FROM t1;
2987 +let $column_name= Default;
2988 +let $row_number= 1;
2989 +let $value= query_get_value($my_show, $column_name, $row_number);
2990 +--echo statement=$my_show row_number=$row_number, column_name=$column_name, Value=$value
2992 +# 3. result set of a SELECT (not recommended, because projection and
2993 +# selection could be done much better by pure SELECT functionality)
2994 +# value is string with space in the middle
2995 +let $value= query_get_value(SELECT 'A B' AS "MyColumn", MyColumn, 1);
2996 +--echo value= ->$value<-
2998 +# 4. column name with space
2999 +let $value= query_get_value(SELECT 1 AS "My Column", My Column, 1);
3000 +--echo value= $value
3002 +#------------ Negative tests ------------
3003 +# 5. Incomplete statement including missing parameters
3004 +# 5.1 incomplete statement
3006 +--exec echo "let \$value= query_get_value(SHOW;" | $MYSQL_TEST 2>&1
3007 +# 5.2 missing query
3009 +--exec echo "let \$value= query_get_value;" | $MYSQL_TEST 2>&1
3010 +# 5.3 missing column name
3012 +--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1);" | $MYSQL_TEST 2>&1
3013 +# 5.4 missing row number
3015 +--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, Field);" | $MYSQL_TEST 2>&1
3017 +# 6. Somehow "wrong" value of parameters
3018 +# 6.1 row parameter
3019 +# 6.1.1 non sense number 0
3020 +let $value= initialized;
3021 +let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 0);
3022 +--echo value= $value
3023 +# 6.1.2 after the last row
3024 +let $value= initialized;
3025 +let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 10);
3026 +--echo value= $value
3027 +# 6.1.3 invalid row number
3029 +--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, Field, notnumber);" | $MYSQL_TEST 2>&1
3030 +# 6.2 column name parameter, name of not existing column
3032 +--exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, column_not_exists, 1);" | $MYSQL_TEST 2>&1
3033 +# 6.3. statement which never gives a result set
3035 +--exec echo "let \$value= query_get_value(SET @A = 1, Field, 1);" | $MYSQL_TEST 2>&1
3036 +# 6.4. statement contains a ","
3037 +# Note: There is no need to improve this, because we need query_get_value
3038 +# for SHOW commands only.
3040 +--exec echo "let \$value= query_get_value(SELECT 1 AS "A", 1 AS "B", 1);" | $MYSQL_TEST 2>&1
3042 +# 7. empty result set
3043 +let $value= initialized;
3044 +let $value= query_get_value(SELECT a FROM t1, a, 1);
3045 +--echo value= $value
3047 +# 9. failing statement
3049 +--exec echo "let \$value= query_get_value(SHOW COLNS FROM t1, Field, 1);" | $MYSQL_TEST 2>&1
3051 +# 10. Artificial example how to process a complete SHOW result set:
3052 +let $show_statement= SHOW COLUMNS FROM t1;
3057 +--echo Field Type Null Key Default Extra
3060 + let $Field= query_get_value($show_statement, Field, $rowno);
3061 + if (`SELECT '$Field' = 'No such row'`)
3065 + if (`SELECT '$Field' <> 'No such row'`)
3067 + let $Type= query_get_value($show_statement, Type, $rowno);
3068 + let $Null= query_get_value($show_statement, Null, $rowno);
3069 + if (`SELECT '$Null' = 'YES'`)
3073 + let $Key= query_get_value($show_statement, Key, $rowno);
3074 + let $Default= query_get_value($show_statement, Default, $rowno);
3075 + let $Extra= query_get_value($show_statement, Extra, $rowno);
3076 + --echo $Field $Type $Null ->$Key<- $Default $Extra
3081 +--echo Number of columns with Default NULL: $count
3083 +eval $show_statement;
3089 diff -urN mysql-4.1.23/mysql-test/t/repair.test mysql-4.1/mysql-test/t/repair.test
3090 --- mysql-4.1.23/mysql-test/t/repair.test 2007-12-02 20:38:25.000000000 +0100
3091 +++ mysql-4.1/mysql-test/t/repair.test 2007-10-17 08:29:45.000000000 +0200
3093 SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
3098 +# BUG#31174 - "Repair" command on MyISAM crashes with small
3099 +# myisam_sort_buffer_size
3101 +CREATE TABLE t1(a CHAR(255), KEY(a));
3102 +SET myisam_sort_buffer_size=4496;
3103 +INSERT INTO t1 VALUES
3104 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3105 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3106 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3107 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3108 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3109 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3110 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3111 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3112 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3113 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3114 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3115 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3116 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3117 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3118 +('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
3119 +('0'),('0'),('0'),('0'),('0'),('0'),('0');
3120 +SET myisam_repair_threads=2;
3122 +SET myisam_repair_threads=@@global.myisam_repair_threads;
3123 +SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
3126 +--echo End of 4.1 tests
3127 diff -urN mysql-4.1.23/mysql-test/t/rpl_change_master.test mysql-4.1/mysql-test/t/rpl_change_master.test
3128 --- mysql-4.1.23/mysql-test/t/rpl_change_master.test 2007-12-02 20:38:51.000000000 +0100
3129 +++ mysql-4.1/mysql-test/t/rpl_change_master.test 2007-06-19 12:19:19.000000000 +0200
3131 --replace_result $MASTER_MYPORT MASTER_MYPORT
3132 --replace_column 1 # 8 # 9 # 23 # 33 #
3133 --replace_column 1 # 33 #
3135 +query_vertical show slave status;
3136 change master to master_user='root';
3137 --replace_result $MASTER_MYPORT MASTER_MYPORT
3138 --replace_column 1 # 8 # 9 # 23 # 33 #
3140 +query_vertical show slave status;
3141 # Will restart from after the values(2), which is bug
3142 select release_lock("a");
3144 diff -urN mysql-4.1.23/mysql-test/t/select.test mysql-4.1/mysql-test/t/select.test
3145 --- mysql-4.1.23/mysql-test/t/select.test 2007-12-02 20:38:51.000000000 +0100
3146 +++ mysql-4.1/mysql-test/t/select.test 2007-11-07 16:45:01.000000000 +0100
3147 @@ -2353,4 +2353,25 @@
3148 select hex(a), hex(b) from t1;
3152 +# Bug #32103: optimizer crash when join on int and mediumint with variable in
3156 +CREATE TABLE t1 (c0 int);
3157 +CREATE TABLE t2 (c0 int);
3159 +# We need any variable that:
3160 +# 1. has integer type,
3161 +# 2. can be used with the "@@name" syntax
3162 +# 3. available in every server build
3163 +INSERT INTO t1 VALUES(@@connect_timeout);
3164 +INSERT INTO t2 VALUES(@@connect_timeout);
3166 +# We only need to ensure 1 row is returned to validate the results
3167 +--replace_column 1 X 2 X
3168 +SELECT * FROM t1 JOIN t2 ON t1.c0 = t2.c0 WHERE (t1.c0 <=> @@connect_timeout);
3172 --echo End of 4.1 tests
3173 diff -urN mysql-4.1.23/mysql-test/t/subselect.test mysql-4.1/mysql-test/t/subselect.test
3174 --- mysql-4.1.23/mysql-test/t/subselect.test 2007-12-02 20:38:27.000000000 +0100
3175 +++ mysql-4.1/mysql-test/t/subselect.test 2007-06-06 15:29:14.000000000 +0200
3176 @@ -1815,11 +1815,12 @@
3177 DROP TABLE t1,t2,t3;
3180 -# BUG #10308: purge log with subselect
3181 +# BUG#10308: purge log with subselect
3182 +# Bug#28553: mysqld crash in "purge master log before(select time from information_schema)"
3186 purge master logs before (select adddate(current_timestamp(), interval -4 day));
3188 +purge master logs before adddate(current_timestamp(), interval -4 day);
3191 # Bug#18503: Queries with a quantified subquery returning empty set may
3192 diff -urN mysql-4.1.23/mysql-test/t/symlink.test mysql-4.1/mysql-test/t/symlink.test
3193 --- mysql-4.1.23/mysql-test/t/symlink.test 2007-12-02 20:38:51.000000000 +0100
3194 +++ mysql-4.1/mysql-test/t/symlink.test 2007-11-12 18:51:28.000000000 +0100
3195 @@ -119,6 +119,18 @@
3199 +# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE
3201 +--replace_result $MYSQLTEST_VARDIR TEST_DIR
3202 +eval CREATE TABLE t1(a INT)
3203 +DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'
3204 +INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
3205 +--replace_result $MYSQLTEST_VARDIR TEST_DIR
3207 +RENAME TABLE t1 TO user;
3211 # Test specifying DATA DIRECTORY that is the same as what would normally
3212 # have been chosen. (Bug #8707)
3214 diff -urN mysql-4.1.23/mysql-test/t/type_enum.test mysql-4.1/mysql-test/t/type_enum.test
3215 --- mysql-4.1.23/mysql-test/t/type_enum.test 2007-12-02 20:38:25.000000000 +0100
3216 +++ mysql-4.1/mysql-test/t/type_enum.test 2007-06-27 00:41:46.000000000 +0200
3217 @@ -156,4 +156,21 @@
3218 create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
\ 1\ 2\ 3\ 4\ 5\ 6\a\b
3219 \v\f\r\ e\ f\10\11\12\13\14\15\16\17\18\19\1a\e\1c\1d\1e\1f !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\
\7f','yy\
\80','zz
\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f\90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'));
3222 +# Bug #29251: MySQL coerces special 0 enum values to normal '' value
3223 +# when ALTERing the column
3227 + id INT AUTO_INCREMENT PRIMARY KEY,
3228 + c1 ENUM('a', '', 'b')
3230 +INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
3231 +SELECT id, c1 + 0, c1 FROM t1;
3233 +ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL;
3234 +SELECT id, c1 + 0, c1 FROM t1;
3238 --echo End of 4.1 tests
3239 diff -urN mysql-4.1.23/mysql-test/t/variables.test mysql-4.1/mysql-test/t/variables.test
3240 --- mysql-4.1.23/mysql-test/t/variables.test 2007-12-02 20:38:25.000000000 +0100
3241 +++ mysql-4.1/mysql-test/t/variables.test 2007-10-18 10:47:52.000000000 +0200
3242 @@ -447,4 +447,11 @@
3243 set @@query_prealloc_size = @test;
3244 select @@query_prealloc_size = @test;
3248 +# Bug#31588 buffer overrun when setting variables
3250 +# Buffer-size Off By One. Should throw valgrind-warning without fix #31588.
3252 +set global sql_mode=repeat('a',80);
3254 +--echo End of 4.1 tests
3255 diff -urN mysql-4.1.23/mysys/charset.c mysql-4.1/mysys/charset.c
3256 --- mysql-4.1.23/mysys/charset.c 2007-12-02 20:38:25.000000000 +0100
3257 +++ mysql-4.1/mysys/charset.c 2007-10-24 13:09:29.000000000 +0200
3258 @@ -673,3 +673,43 @@
3259 return fs_cset_cache;
3265 + @brief Find compatible character set with ctype.
3267 + @param[in] original_cs Original character set
3270 + 128 my_charset_ucs2_general_uca ->192 my_charset_utf8_general_uca_ci
3271 + 129 my_charset_ucs2_icelandic_uca_ci ->193 my_charset_utf8_icelandic_uca_ci
3272 + 130 my_charset_ucs2_latvian_uca_ci ->194 my_charset_utf8_latvian_uca_ci
3273 + 131 my_charset_ucs2_romanian_uca_ci ->195 my_charset_utf8_romanian_uca_ci
3274 + 132 my_charset_ucs2_slovenian_uca_ci ->196 my_charset_utf8_slovenian_uca_ci
3275 + 133 my_charset_ucs2_polish_uca_ci ->197 my_charset_utf8_polish_uca_ci
3276 + 134 my_charset_ucs2_estonian_uca_ci ->198 my_charset_utf8_estonian_uca_ci
3277 + 135 my_charset_ucs2_spanish_uca_ci ->199 my_charset_utf8_spanish_uca_ci
3278 + 136 my_charset_ucs2_swedish_uca_ci ->200 my_charset_utf8_swedish_uca_ci
3279 + 137 my_charset_ucs2_turkish_uca_ci ->201 my_charset_utf8_turkish_uca_ci
3280 + 138 my_charset_ucs2_czech_uca_ci ->202 my_charset_utf8_czech_uca_ci
3281 + 139 my_charset_ucs2_danish_uca_ci ->203 my_charset_utf8_danish_uca_ci
3282 + 140 my_charset_ucs2_lithuanian_uca_ci->204 my_charset_utf8_lithuanian_uca_ci
3283 + 141 my_charset_ucs2_slovak_uca_ci ->205 my_charset_utf8_slovak_uca_ci
3284 + 142 my_charset_ucs2_spanish2_uca_ci ->206 my_charset_utf8_spanish2_uca_ci
3285 + 143 my_charset_ucs2_roman_uca_ci ->207 my_charset_utf8_roman_uca_ci
3286 + 144 my_charset_ucs2_persian_uca_ci ->208 my_charset_utf8_persian_uca_ci
3288 + @return Compatible character set or NULL.
3291 +CHARSET_INFO *get_compatible_charset_with_ctype(CHARSET_INFO *original_cs)
3293 + CHARSET_INFO *compatible_cs= 0;
3294 + DBUG_ENTER("get_compatible_charset_with_ctype");
3295 + if (!strcmp(original_cs->csname, "ucs2") &&
3296 + (compatible_cs= get_charset(original_cs->number + 64, MYF(0))) &&
3297 + (!compatible_cs->ctype ||
3298 + strcmp(original_cs->name + 4, compatible_cs->name + 4)))
3300 + DBUG_RETURN(compatible_cs);
3302 diff -urN mysql-4.1.23/mysys/hash.c mysql-4.1/mysys/hash.c
3303 --- mysql-4.1.23/mysys/hash.c 2007-12-02 20:38:25.000000000 +0100
3304 +++ mysql-4.1/mysys/hash.c 2007-07-05 08:45:13.000000000 +0200
3305 @@ -572,6 +572,25 @@
3306 previous->next=pos->next; /* unlink pos */
3308 /* Move data to correct position */
3309 + if (new_index == empty)
3312 + At this point record is unlinked from the old chain, thus it holds
3313 + random position. By the chance this position is equal to position
3314 + for the first element in the new chain. That means updated record
3315 + is the only record in the new chain.
3320 + Record was moved while unlinking it from the old chain.
3321 + Copy data to a new position.
3323 + data[empty]= org_link;
3325 + data[empty].next= NO_RECORD;
3329 new_pos_index=hash_rec_mask(hash,pos,blength,records);
3330 if (new_index != new_pos_index)
3331 diff -urN mysql-4.1.23/mysys/my_pthread.c mysql-4.1/mysys/my_pthread.c
3332 --- mysql-4.1.23/mysys/my_pthread.c 2007-12-02 20:38:50.000000000 +0100
3333 +++ mysql-4.1/mysys/my_pthread.c 2007-07-30 20:38:48.000000000 +0200
3335 #define SCHED_POLICY SCHED_OTHER
3338 -uint thd_lib_detected;
3339 +uint thd_lib_detected= 0;
3341 #ifndef my_pthread_setprio
3342 void my_pthread_setprio(pthread_t thread_id,int prior)
3343 diff -urN mysql-4.1.23/mysys/my_symlink2.c mysql-4.1/mysys/my_symlink2.c
3344 --- mysql-4.1.23/mysys/my_symlink2.c 2007-12-02 20:38:27.000000000 +0100
3345 +++ mysql-4.1/mysys/my_symlink2.c 2007-11-12 11:55:20.000000000 +0100
3347 int was_symlink= (!my_disable_symlinks &&
3348 !my_readlink(link_name, from, MYF(0)));
3350 + int name_is_different;
3351 DBUG_ENTER("my_rename_with_symlink");
3354 @@ -133,6 +134,14 @@
3355 /* Change filename that symlink pointed to */
3356 strmov(tmp_name, to);
3357 fn_same(tmp_name,link_name,1); /* Copy dir */
3358 + name_is_different= strcmp(link_name, tmp_name);
3359 + if (name_is_different && !access(tmp_name, F_OK))
3362 + if (MyFlags & MY_WME)
3363 + my_error(EE_CANTCREATEFILE, MYF(0), tmp_name, EEXIST);
3367 /* Create new symlink */
3368 if (my_symlink(tmp_name, to, MyFlags))
3370 the same basename and different directories.
3373 - if (strcmp(link_name, tmp_name) && my_rename(link_name, tmp_name, MyFlags))
3374 + if (name_is_different && my_rename(link_name, tmp_name, MyFlags))
3376 int save_errno=my_errno;
3377 my_delete(to, MyFlags); /* Remove created symlink */
3378 diff -urN mysql-4.1.23/scripts/mysql_config.sh mysql-4.1/scripts/mysql_config.sh
3379 --- mysql-4.1.23/scripts/mysql_config.sh 2007-12-02 20:38:27.000000000 +0100
3380 +++ mysql-4.1/scripts/mysql_config.sh 2007-08-29 22:24:05.000000000 +0200
3382 cflags=`echo "$cflags"|sed -e 's/ *\$//'`
3384 # Same for --libs(_r)
3385 -for remove in lmtmalloc static-libcxa i-static
3386 +for remove in lmtmalloc static-libcxa i-static static-intel
3388 # We know the strings starts with a space
3389 libs=`echo "$libs"|sed -e "s/ -$remove */ /g"`
3390 diff -urN mysql-4.1.23/scripts/mysql_setpermission.sh mysql-4.1/scripts/mysql_setpermission.sh
3391 --- mysql-4.1.23/scripts/mysql_setpermission.sh 2007-12-02 20:38:52.000000000 +0100
3392 +++ mysql-4.1/scripts/mysql_setpermission.sh 2007-08-01 11:48:53.000000000 +0200
3394 ## 1.3 Applied patch provided by Martin Mokrejs <mmokrejs@natur.cuni.cz>
3395 ## (General code cleanup, use the GRANT statement instead of updating
3396 ## the privilege tables directly, added option to revoke privileges)
3397 +## 1.4 Remove option 6 which attempted to erroneously grant global privileges
3401 # empty ... suggestions ... mail them to me ...
3409 @@ -103,13 +104,9 @@
3410 print " existing database and host combination (user can do\n";
3411 print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,\n";
3412 print " LOCK TABLES,CREATE TEMPORARY TABLES)\n";
3413 - print " 6. Create/append database administrative privileges for an\n";
3414 - print " existing database and host combination (user can do\n";
3415 - print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,\n";
3416 - print " CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS)\n";
3417 - print " 7. Create/append full privileges for an existing database\n";
3418 + print " 6. Create/append full privileges for an existing database\n";
3419 print " and host combination (user has FULL privilege)\n";
3420 - print " 8. Remove all privileges for for an existing database and\n";
3421 + print " 7. Remove all privileges for for an existing database and\n";
3422 print " host combination.\n";
3423 print " (user will have all permission fields set to N)\n";
3424 print " 0. exit this program\n";
3425 @@ -117,10 +114,10 @@
3429 - if ($answer =~ /^[12345678]$/) {
3430 + if ($answer =~ /^[1234567]$/) {
3433 - } elsif ($answer =~ /^[2345678]$/) {
3434 + } elsif ($answer =~ /^[234567]$/) {
3437 print "Sorry, something went wrong. With such option number you should not get here.\n\n";
3442 - if ( ( !$todo ) or not ( $todo =~ m/^[2-8]$/ ) ) {
3443 + if ( ( !$todo ) or not ( $todo =~ m/^[2-7]$/ ) ) {
3444 print STDERR "Sorry, select option $todo isn't known inside the program .. See ya\n";
3447 @@ -256,12 +253,9 @@
3448 # user privileges: SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES
3449 $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
3450 } elsif ($todo == 6) {
3451 - # admin privileges: GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS
3452 - $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
3453 - } elsif ($todo == 7) {
3455 $sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
3456 - } elsif ($todo == 8) {
3457 + } elsif ($todo == 7) {
3458 # all privileges set to N
3459 $sth = $dbh->do("REVOKE ALL ON *.* FROM \'$user\'\@\'$host\'") || die $dbh->errstr;
3461 diff -urN mysql-4.1.23/sql/field.cc mysql-4.1/sql/field.cc
3462 --- mysql-4.1.23/sql/field.cc 2007-12-02 20:38:25.000000000 +0100
3463 +++ mysql-4.1/sql/field.cc 2007-10-04 12:22:30.000000000 +0200
3464 @@ -5211,7 +5211,8 @@
3465 length / field_charset->mbmaxlen);
3466 memcpy(buff, ptr, bytes);
3468 - bzero(buff + bytes, length - bytes);
3469 + field_charset->cset->fill(field_charset, buff + bytes, length - bytes,
3474 diff -urN mysql-4.1.23/sql/field_conv.cc mysql-4.1/sql/field_conv.cc
3475 --- mysql-4.1.23/sql/field_conv.cc 2007-12-02 20:38:51.000000000 +0100
3476 +++ mysql-4.1/sql/field_conv.cc 2007-06-27 00:41:45.000000000 +0200
3477 @@ -311,6 +311,15 @@
3481 +static void do_field_enum(Copy_field *copy)
3483 + if (copy->from_field->val_int() == 0)
3484 + ((Field_enum *) copy->to_field)->store_type((ulonglong) 0);
3486 + do_field_string(copy);
3490 static void do_field_int(Copy_field *copy)
3492 longlong value=copy->from_field->val_int();
3493 @@ -538,7 +547,13 @@
3494 to->real_type() == FIELD_TYPE_SET)
3496 if (!to->eq_def(from))
3497 - return do_field_string;
3499 + if (from->real_type() == MYSQL_TYPE_ENUM &&
3500 + to->real_type() == MYSQL_TYPE_ENUM)
3501 + return do_field_enum;
3503 + return do_field_string;
3506 else if (to->charset() != from->charset())
3507 return do_field_string;
3508 diff -urN mysql-4.1.23/sql/gstream.cc mysql-4.1/sql/gstream.cc
3509 --- mysql-4.1.23/sql/gstream.cc 2007-12-02 20:38:51.000000000 +0100
3510 +++ mysql-4.1/sql/gstream.cc 2007-10-03 10:30:31.000000000 +0200
3513 res->str= (char*) m_cur;
3514 /* The following will also test for \0 */
3515 - if (!my_isvar_start(&my_charset_bin, *m_cur))
3516 + if ((m_cur >= m_limit) || !my_isvar_start(&my_charset_bin, *m_cur))
3520 diff -urN mysql-4.1.23/sql/item_func.cc mysql-4.1/sql/item_func.cc
3521 --- mysql-4.1.23/sql/item_func.cc 2007-12-02 20:38:52.000000000 +0100
3522 +++ mysql-4.1/sql/item_func.cc 2007-10-24 13:09:29.000000000 +0200
3523 @@ -2243,7 +2243,7 @@
3526 #ifdef EMBEDDED_LIBRARY
3527 - if (ull->locked && pthread_equal(current_thd->real_id,ull->thread))
3528 + if (ull->locked && (current_thd->real_id == ull->thread))
3530 if (ull->locked && pthread_equal(pthread_self(),ull->thread))
3532 @@ -3135,13 +3135,44 @@
3533 my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH");
3536 - table=((Item_field *)item)->field->table;
3538 + With prepared statements Item_func_match::fix_fields is called twice.
3539 + When it is called first time we have original item tree here and add
3540 + conversion layer for character sets that do not have ctype array a few
3541 + lines below. When it is called second time, we already have conversion
3542 + layer in item tree.
3544 + table= (item->type() == Item::FIELD_ITEM) ?
3545 + ((Item_field *)item)->field->table :
3546 + ((Item_field *)((Item_func_conv *)item)->key_item())->field->table;
3547 if (!(table->file->table_flags() & HA_CAN_FULLTEXT))
3549 my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0));
3552 table->fulltext_searched=1;
3553 + /* A workaround for ucs2 character set */
3554 + if (!args[1]->collation.collation->ctype)
3556 + CHARSET_INFO *compatible_cs=
3557 + get_compatible_charset_with_ctype(args[1]->collation.collation);
3559 + if (compatible_cs)
3561 + Item_string *conv_item= new Item_string("", 0, compatible_cs,
3562 + DERIVATION_EXPLICIT);
3564 + args[0]= conv_item;
3565 + rc= agg_item_charsets(cmp_collation, func_name(), args, arg_count,
3566 + MY_COLL_ALLOW_SUPERSET_CONV |
3567 + MY_COLL_ALLOW_COERCIBLE_CONV |
3568 + MY_COLL_DISALLOW_NONE);
3572 + my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH");
3575 return agg_arg_collations_for_comparison(cmp_collation, args+1, arg_count-1);
3578 diff -urN mysql-4.1.23/sql/item.h mysql-4.1/sql/item.h
3579 --- mysql-4.1.23/sql/item.h 2007-12-02 20:38:51.000000000 +0100
3580 +++ mysql-4.1/sql/item.h 2007-11-07 16:45:01.000000000 +0100
3583 { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
3584 String *val_str(String*);
3585 - Item *new_item() { return new Item_uint(name,max_length); }
3586 + Item *new_item() { return new Item_uint(name, value, max_length); }
3587 int save_in_field(Field *field, bool no_conversions);
3588 void print(String *str);
3590 diff -urN mysql-4.1.23/sql/item_strfunc.h mysql-4.1/sql/item_strfunc.h
3591 --- mysql-4.1.23/sql/item_strfunc.h 2007-12-02 20:38:26.000000000 +0100
3592 +++ mysql-4.1/sql/item_strfunc.h 2007-10-30 09:35:02.000000000 +0100
3595 collation.set(default_charset());
3596 decimals=0; max_length=64;
3603 String* val_str(String* str);
3604 const char *func_name() const { return "inet_ntoa"; }
3605 - void fix_length_and_dec() { decimals = 0; max_length=3*8+7; }
3606 + void fix_length_and_dec() { decimals = 0; max_length=3*8+7; maybe_null=1;}
3609 class Item_func_quote :public Item_str_func
3610 diff -urN mysql-4.1.23/sql/lock.cc mysql-4.1/sql/lock.cc
3611 --- mysql-4.1.23/sql/lock.cc 2007-12-02 20:38:51.000000000 +0100
3612 +++ mysql-4.1/sql/lock.cc 2007-06-01 10:50:12.000000000 +0200
3613 @@ -155,6 +155,13 @@
3614 if (thr_multi_lock(sql_lock->locks + sql_lock->lock_count,
3615 sql_lock->lock_count))
3618 + reset_lock_data is required here. If thr_multi_lock fails it
3619 + resets lock type for tables, which were locked before (and
3620 + including) one that caused error. Lock type for other tables
3623 + reset_lock_data(sql_lock);
3624 thd->some_tables_deleted=1; // Try again
3625 sql_lock->lock_count=0; // Locks are alread freed
3627 diff -urN mysql-4.1.23/sql/mysql_priv.h mysql-4.1/sql/mysql_priv.h
3628 --- mysql-4.1.23/sql/mysql_priv.h 2007-12-02 20:38:51.000000000 +0100
3629 +++ mysql-4.1/sql/mysql_priv.h 2007-11-09 13:05:01.000000000 +0100
3631 bool net_request_file(NET* net, const char* fname);
3632 char* query_table_status(THD *thd,const char *db,const char *table_name);
3634 -void net_set_write_timeout(NET *net, uint timeout);
3635 -void net_set_read_timeout(NET *net, uint timeout);
3637 #define x_free(A) { my_free((gptr) (A),MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); }
3638 #define safeFree(x) { if(x) { my_free((gptr) x,MYF(0)); x = NULL; } }
3639 #define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
3640 @@ -408,6 +405,16 @@
3641 int create_table_precheck(THD *thd, TABLE_LIST *tables,
3642 TABLE_LIST *create_table);
3643 Item *negate_expression(THD *thd, Item *expr);
3646 +void sql_perror(const char *message);
3648 +void vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
3649 +void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
3650 +void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
3651 +void sql_print_information(const char *format, ...)
3652 + ATTRIBUTE_FORMAT(printf, 1, 2);
3654 #include "sql_class.h"
3655 #include "sql_acl.h"
3657 @@ -842,14 +849,6 @@
3658 int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
3660 bool init_errmessage(void);
3661 -void sql_perror(const char *message);
3663 -void vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
3664 -void sql_print_error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
3665 -void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
3666 -void sql_print_information(const char *format, ...)
3667 - ATTRIBUTE_FORMAT(printf, 1, 2);
3670 bool fn_format_relative_to_data_home(my_string to, const char *name,
3671 const char *dir, const char *extension);
3672 diff -urN mysql-4.1.23/sql/net_serv.cc mysql-4.1/sql/net_serv.cc
3673 --- mysql-4.1.23/sql/net_serv.cc 2007-12-02 20:38:27.000000000 +0100
3674 +++ mysql-4.1/sql/net_serv.cc 2007-06-19 08:13:10.000000000 +0200
3675 @@ -111,13 +111,13 @@
3676 my_bool my_net_init(NET *net, Vio* vio)
3678 DBUG_ENTER("my_net_init");
3680 my_net_local_init(net); /* Set some limits */
3681 if (!(net->buff=(uchar*) my_malloc((uint32) net->max_packet+
3682 NET_HEADER_SIZE + COMP_HEADER_SIZE,
3685 net->buff_end=net->buff+net->max_packet;
3687 net->no_send_ok = 0;
3688 net->error=0; net->return_errno=0; net->return_status=0;
3689 net->pkt_nr=net->compress_pkt_nr=0;
3690 diff -urN mysql-4.1.23/sql/opt_range.cc mysql-4.1/sql/opt_range.cc
3691 --- mysql-4.1.23/sql/opt_range.cc 2007-12-02 20:38:25.000000000 +0100
3692 +++ mysql-4.1/sql/opt_range.cc 2007-09-10 14:26:49.000000000 +0200
3694 if (!(table->keys_in_use_for_query.is_set(idx)))
3696 KEY_PART_INFO *keyinfo= table->key_info[idx].key_part;
3697 + uint n_parts= table->key_info[idx].key_parts;
3703 if (!(table->file->index_flags(idx, 0, 1) & HA_READ_ORDER))
3705 - for (ord= order; ord; ord= ord->next, partno++)
3706 + for (ord= order; ord && partno < n_parts; ord= ord->next, partno++)
3708 Item *item= order->item[0];
3709 if (!(item->type() == Item::FIELD_ITEM &&
3710 diff -urN mysql-4.1.23/sql/set_var.cc mysql-4.1/sql/set_var.cc
3711 --- mysql-4.1.23/sql/set_var.cc 2007-12-02 20:38:27.000000000 +0100
3712 +++ mysql-4.1/sql/set_var.cc 2007-10-18 10:47:52.000000000 +0200
3713 @@ -1573,7 +1573,7 @@
3717 - strmake(buff, error, min(sizeof(buff), error_len));
3718 + strmake(buff, error, min(sizeof(buff) - 1, error_len));
3722 diff -urN mysql-4.1.23/sql/share/english/errmsg.txt mysql-4.1/sql/share/english/errmsg.txt
3723 --- mysql-4.1.23/sql/share/english/errmsg.txt 2007-12-02 20:38:52.000000000 +0100
3724 +++ mysql-4.1/sql/share/english/errmsg.txt 2007-07-26 12:49:50.000000000 +0200
3728 "Can't create file '%-.64s' (errno: %d)",
3729 -"Can't create table '%-.64s' (errno: %d)",
3730 +"Can't create table '%-.150s' (errno: %d)",
3731 "Can't create database '%-.64s' (errno: %d)",
3732 "Can't create database '%-.64s'; database exists",
3733 "Can't drop database '%-.64s'; database doesn't exist",
3735 "Can't get working directory (errno: %d)",
3736 "Can't lock file (errno: %d)",
3737 "Can't open file: '%-.64s' (errno: %d)",
3738 -"Can't find file: '%-.64s' (errno: %d)",
3739 +"Can't find file: '%-.150s' (errno: %d)",
3740 "Can't read dir of '%-.64s' (errno: %d)",
3741 "Can't change dir to '%-.64s' (errno: %d)",
3742 "Record has changed since last read in table '%-.64s'",
3744 "Can't write; duplicate key in table '%-.64s'",
3745 "Error on close of '%-.64s' (errno: %d)",
3746 "Error reading file '%-.64s' (errno: %d)",
3747 -"Error on rename of '%-.64s' to '%-.64s' (errno: %d)",
3748 +"Error on rename of '%-.107s' to '%-.107s' (errno: %d)",
3749 "Error writing file '%-.64s' (errno: %d)",
3750 "'%-.64s' is locked against change",
3752 diff -urN mysql-4.1.23/sql/sql_class.cc mysql-4.1/sql/sql_class.cc
3753 --- mysql-4.1.23/sql/sql_class.cc 2007-12-02 20:38:51.000000000 +0100
3754 +++ mysql-4.1/sql/sql_class.cc 2007-07-03 18:04:24.000000000 +0200
3755 @@ -1020,6 +1020,7 @@
3756 field_sep_char= (exchange->enclosed->length() ? (*exchange->enclosed)[0] :
3757 field_term_length ? (*exchange->field_term)[0] : INT_MAX);
3758 escape_char= (exchange->escaped->length() ? (*exchange->escaped)[0] : -1);
3759 + is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char));
3760 line_sep_char= (exchange->line_term->length() ?
3761 (*exchange->line_term)[0] : INT_MAX);
3762 if (!field_term_length)
3763 @@ -1113,7 +1114,9 @@
3764 (int) *pos == line_sep_char || !*pos)
3767 - tmp_buff[0]= escape_char;
3768 + tmp_buff[0]= ((int) *pos == field_sep_char &&
3769 + is_ambiguous_field_sep) ?
3770 + field_sep_char : escape_char;
3771 tmp_buff[1]= *pos ? *pos : '0';
3772 if (my_b_write(&cache,(byte*) start,(uint) (pos-start)) ||
3773 my_b_write(&cache,(byte*) tmp_buff,2))
3774 diff -urN mysql-4.1.23/sql/sql_class.h mysql-4.1/sql/sql_class.h
3775 --- mysql-4.1.23/sql/sql_class.h 2007-12-02 20:38:51.000000000 +0100
3776 +++ mysql-4.1/sql/sql_class.h 2007-07-16 22:38:49.000000000 +0200
3777 @@ -1018,11 +1018,27 @@
3778 proc_info = old_msg;
3779 pthread_mutex_unlock(&mysys_var->mutex);
3782 + static inline void safe_time(time_t *t)
3785 + Wrapper around time() which retries on error (-1)
3788 + This is needed because, despite the documentation, time() may fail
3789 + in some circumstances. Here we retry time() until it succeeds, and
3790 + log the failure so that performance problems related to this can be
3793 + while(unlikely(time(t) == ((time_t) -1)))
3794 + sql_print_information("time() failed with %d", errno);
3797 inline time_t query_start() { query_start_used=1; return start_time; }
3798 - inline void set_time() { if (user_time) start_time=time_after_lock=user_time; else time_after_lock=time(&start_time); }
3799 - inline void end_time() { time(&start_time); }
3800 + inline void set_time() { if (user_time) start_time=time_after_lock=user_time; else { safe_time(&start_time); time_after_lock= start_time; }}
3801 + inline void end_time() { safe_time(&start_time); }
3802 inline void set_time(time_t t) { time_after_lock=start_time=user_time=t; }
3803 - inline void lock_time() { time(&time_after_lock); }
3804 + inline void lock_time() { safe_time(&time_after_lock); }
3805 inline void insert_id(ulonglong id_arg)
3807 last_insert_id= id_arg;
3808 @@ -1224,9 +1240,18 @@
3812 +#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape
3815 class select_export :public select_to_file {
3816 uint field_term_length;
3817 int field_sep_char,escape_char,line_sep_char;
3819 + The is_ambiguous_field_sep field is true if a value of the field_sep_char
3820 + field is one of the 'n', 't', 'r' etc characters
3821 + (see the READ_INFO::unescape method and the ESCAPE_CHARS constant value).
3823 + bool is_ambiguous_field_sep;
3824 bool fixed_row_size;
3826 select_export(sql_exchange *ex) :select_to_file(ex) {}
3827 diff -urN mysql-4.1.23/sql/sql_load.cc mysql-4.1/sql/sql_load.cc
3828 --- mysql-4.1.23/sql/sql_load.cc 2007-12-02 20:38:51.000000000 +0100
3829 +++ mysql-4.1/sql/sql_load.cc 2007-07-03 16:05:06.000000000 +0200
3832 READ_INFO::unescape(char chr)
3834 + /* keep this switch synchornous with the ESCAPE_CHARS macro */
3836 case 'n': return '\n';
3837 case 't': return '\t';
3838 diff -urN mysql-4.1.23/sql/sql_parse.cc mysql-4.1/sql/sql_parse.cc
3839 --- mysql-4.1.23/sql/sql_parse.cc 2007-12-02 20:38:51.000000000 +0100
3840 +++ mysql-4.1/sql/sql_parse.cc 2007-06-12 14:47:34.000000000 +0200
3841 @@ -1445,11 +1445,14 @@
3842 Old clients send null-terminated string ('\0' for empty string) for
3843 password. New clients send the size (1 byte) + string (not null
3844 terminated, so also '\0' for empty string).
3846 + Cast *passwd to an unsigned char, so that it doesn't extend the sign
3847 + for *passwd > 127 and become 2**32-127 after casting to uint.
3849 char db_buff[NAME_LEN+1]; // buffer to store db in utf8
3851 uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
3852 - *passwd++ : strlen(passwd);
3853 + (uchar)(*passwd++) : strlen(passwd);
3854 db+= passwd_len + 1;
3855 #ifndef EMBEDDED_LIBRARY
3856 /* Small check for incomming packet */
3857 diff -urN mysql-4.1.23/sql/sql_select.cc mysql-4.1/sql/sql_select.cc
3858 --- mysql-4.1.23/sql/sql_select.cc 2007-12-02 20:38:25.000000000 +0100
3859 +++ mysql-4.1/sql/sql_select.cc 2007-07-31 08:00:17.000000000 +0200
3861 order=0; // The output has only one row
3863 select_distinct= 0; // No need in distinct for 1 row
3864 + group_optimized_away= 1;
3867 calc_group_buffer(this, group_list);
3868 @@ -6896,7 +6897,8 @@
3869 if (!join->first_record || end_of_records ||
3870 (idx=test_if_group_changed(join->group_fields)) >= 0)
3872 - if (join->first_record || (end_of_records && !join->group))
3873 + if (join->first_record ||
3874 + (end_of_records && !join->group && !join->group_optimized_away))
3876 if (join->procedure)
3877 join->procedure->end_group();
3878 @@ -8118,7 +8120,7 @@
3882 - if (!field_count && !(join->select_options & OPTION_FOUND_ROWS))
3883 + if (!field_count && !(join->select_options & OPTION_FOUND_ROWS) && !having)
3884 { // only const items with no OPTION_FOUND_ROWS
3885 join->unit->select_limit_cnt= 1; // Only send first row
3887 diff -urN mysql-4.1.23/sql/sql_select.h mysql-4.1/sql/sql_select.h
3888 --- mysql-4.1.23/sql/sql_select.h 2007-12-02 20:38:25.000000000 +0100
3889 +++ mysql-4.1/sql/sql_select.h 2007-07-31 07:45:59.000000000 +0200
3890 @@ -180,6 +180,14 @@
3891 ROLLUP rollup; // Used with rollup
3893 bool select_distinct; // Set if SELECT DISTINCT
3895 + If we have the GROUP BY statement in the query,
3896 + but the group_list was emptied by optimizer, this
3898 + It happens when fields in the GROUP BY are from
3901 + bool group_optimized_away;
3904 simple_xxxxx is set if ORDER/GROUP BY doesn't include any references
3906 ref_pointer_array_size= 0;
3907 zero_result_cause= 0;
3909 + group_optimized_away= 0;
3911 fields_list= fields_arg;
3912 bzero((char*) &keyuse,sizeof(keyuse));
3913 diff -urN mysql-4.1.23/sql/sql_yacc.yy mysql-4.1/sql/sql_yacc.yy
3914 --- mysql-4.1.23/sql/sql_yacc.yy 2007-12-02 20:38:27.000000000 +0100
3915 +++ mysql-4.1/sql/sql_yacc.yy 2007-06-06 15:29:14.000000000 +0200
3916 @@ -3567,7 +3567,8 @@
3918 lex->derived_tables= 1;
3919 if (lex->sql_command == (int)SQLCOM_HA_READ ||
3920 - lex->sql_command == (int)SQLCOM_KILL)
3921 + lex->sql_command == (int)SQLCOM_KILL ||
3922 + lex->sql_command == (int)SQLCOM_PURGE)
3924 yyerror(ER(ER_SYNTAX_ERROR));
3926 @@ -4748,6 +4749,7 @@
3930 + lex->sql_command = SQLCOM_PURGE;
3934 @@ -4759,7 +4761,6 @@
3936 TO_SYM TEXT_STRING_sys
3938 - Lex->sql_command = SQLCOM_PURGE;
3939 Lex->to_log = $2.str;
3942 @@ -6212,7 +6213,8 @@
3945 if (lex->sql_command == (int)SQLCOM_HA_READ ||
3946 - lex->sql_command == (int)SQLCOM_KILL)
3947 + lex->sql_command == (int)SQLCOM_KILL ||
3948 + lex->sql_command == (int)SQLCOM_PURGE)
3950 yyerror(ER(ER_SYNTAX_ERROR));
3952 diff -urN mysql-4.1.23/sql-common/client.c mysql-4.1/sql-common/client.c
3953 --- mysql-4.1.23/sql-common/client.c 2007-12-02 20:38:25.000000000 +0100
3954 +++ mysql-4.1/sql-common/client.c 2007-11-09 13:05:01.000000000 +0100
3955 @@ -1176,12 +1176,12 @@
3956 /* fields count may be wrong */
3957 DBUG_ASSERT ((field - result) < fields);
3958 cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
3959 - field->catalog = strdup_root(alloc,(char*) row->data[0]);
3960 - field->db = strdup_root(alloc,(char*) row->data[1]);
3961 - field->table = strdup_root(alloc,(char*) row->data[2]);
3962 - field->org_table= strdup_root(alloc,(char*) row->data[3]);
3963 - field->name = strdup_root(alloc,(char*) row->data[4]);
3964 - field->org_name = strdup_root(alloc,(char*) row->data[5]);
3965 + field->catalog= strmake_root(alloc,(char*) row->data[0], lengths[0]);
3966 + field->db= strmake_root(alloc,(char*) row->data[1], lengths[1]);
3967 + field->table= strmake_root(alloc,(char*) row->data[2], lengths[2]);
3968 + field->org_table= strmake_root(alloc,(char*) row->data[3], lengths[3]);
3969 + field->name= strmake_root(alloc,(char*) row->data[4], lengths[4]);
3970 + field->org_name= strmake_root(alloc,(char*) row->data[5], lengths[5]);
3972 field->catalog_length= lengths[0];
3973 field->db_length= lengths[1];
3974 @@ -1202,7 +1202,7 @@
3975 field->flags|= NUM_FLAG;
3976 if (default_value && row->data[7])
3978 - field->def=strdup_root(alloc,(char*) row->data[7]);
3979 + field->def=strmake_root(alloc,(char*) row->data[7], lengths[7]);
3980 field->def_length= lengths[7];
3983 @@ -1884,13 +1884,11 @@
3985 /* If user set read_timeout, let it override the default */
3986 if (mysql->options.read_timeout)
3987 - net->read_timeout= mysql->options.read_timeout;
3988 - vio_timeout(net->vio, 0, net->read_timeout);
3989 + net_set_read_timeout(net, mysql->options.read_timeout);
3991 /* If user set write_timeout, let it override the default */
3992 if (mysql->options.write_timeout)
3993 - net->write_timeout= mysql->options.write_timeout;
3994 - vio_timeout(net->vio, 1, net->write_timeout);
3995 + net_set_write_timeout(net, mysql->options.write_timeout);
3997 if (mysql->options.max_allowed_packet)
3998 net->max_packet_size= mysql->options.max_allowed_packet;
3999 diff -urN mysql-4.1.23/strings/ctype-big5.c mysql-4.1/strings/ctype-big5.c
4000 --- mysql-4.1.23/strings/ctype-big5.c 2007-12-02 20:38:25.000000000 +0100
4001 +++ mysql-4.1/strings/ctype-big5.c 2007-10-04 07:19:59.000000000 +0200
4002 @@ -6256,12 +6256,12 @@
4003 my_wc_t *pwc,const uchar *s,const uchar *e)
4010 return MY_CS_TOOSMALL;
4013 + if ((hi= s[0]) < 0x80)
4017 diff -urN mysql-4.1.23/strings/ctype-cp932.c mysql-4.1/strings/ctype-cp932.c
4018 --- mysql-4.1.23/strings/ctype-cp932.c 2007-12-02 20:38:25.000000000 +0100
4019 +++ mysql-4.1/strings/ctype-cp932.c 2007-10-04 07:19:59.000000000 +0200
4020 @@ -5352,12 +5352,12 @@
4022 my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)),
4023 my_wc_t *pwc, const uchar *s, const uchar *e){
4028 return MY_CS_TOOSMALL;
4031 + if ((hi= s[0]) < 0x80)
4035 diff -urN mysql-4.1.23/strings/ctype-euc_kr.c mysql-4.1/strings/ctype-euc_kr.c
4036 --- mysql-4.1.23/strings/ctype-euc_kr.c 2007-12-02 20:38:26.000000000 +0100
4037 +++ mysql-4.1/strings/ctype-euc_kr.c 2007-10-04 07:19:59.000000000 +0200
4038 @@ -8614,12 +8614,12 @@
4039 my_wc_t *pwc, const uchar *s, const uchar *e)
4046 return MY_CS_TOOSMALL;
4049 + if ((hi= s[0]) < 0x80)
4053 diff -urN mysql-4.1.23/strings/ctype-gb2312.c mysql-4.1/strings/ctype-gb2312.c
4054 --- mysql-4.1.23/strings/ctype-gb2312.c 2007-12-02 20:38:26.000000000 +0100
4055 +++ mysql-4.1/strings/ctype-gb2312.c 2007-10-04 07:19:59.000000000 +0200
4056 @@ -5665,12 +5665,10 @@
4057 my_wc_t *pwc, const uchar *s, const uchar *e){
4063 return MY_CS_TOOSMALL;
4066 + if ((hi= s[0]) < 0x80)
4070 diff -urN mysql-4.1.23/strings/ctype-simple.c mysql-4.1/strings/ctype-simple.c
4071 --- mysql-4.1.23/strings/ctype-simple.c 2007-12-02 20:38:25.000000000 +0100
4072 +++ mysql-4.1/strings/ctype-simple.c 2007-09-28 22:33:23.000000000 +0200
4078 + val= -(unsigned long int)val;
4087 + val = -(ulonglong)val;
4091 diff -urN mysql-4.1.23/strings/ctype-sjis.c mysql-4.1/strings/ctype-sjis.c
4092 --- mysql-4.1.23/strings/ctype-sjis.c 2007-12-02 20:38:52.000000000 +0100
4093 +++ mysql-4.1/strings/ctype-sjis.c 2007-10-04 07:19:59.000000000 +0200
4094 @@ -4512,12 +4512,12 @@
4096 my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
4097 my_wc_t *pwc, const uchar *s, const uchar *e){
4102 return MY_CS_TOOSMALL;
4105 + if ((hi= s[0]) < 0x80)
4109 diff -urN mysql-4.1.23/support-files/MacOSX/ReadMe.txt mysql-4.1/support-files/MacOSX/ReadMe.txt
4110 --- mysql-4.1.23/support-files/MacOSX/ReadMe.txt 1970-01-01 01:00:00.000000000 +0100
4111 +++ mysql-4.1/support-files/MacOSX/ReadMe.txt 2007-11-02 01:29:32.000000000 +0100
4114 +You can find information about how to install on Mac OS X at
4116 + http://dev.mysql.com/doc/refman/4.1/en/mac-os-x-installation.html
4118 +The MySQL Reference Manual is also available in various formats on
4119 +http://dev.mysql.com/doc; if you're interested in the DocBook XML
4120 +sources go to http://svn.mysql.com.
4121 diff -urN mysql-4.1.23/VC++Files/sql/mysqld.dsp mysql-4.1/VC++Files/sql/mysqld.dsp
4122 --- mysql-4.1.23/VC++Files/sql/mysqld.dsp 2007-12-02 20:38:51.000000000 +0100
4123 +++ mysql-4.1/VC++Files/sql/mysqld.dsp 2007-05-16 23:09:48.000000000 +0200
4124 @@ -1610,7 +1610,7 @@
4128 -SOURCE=.\sql\sql_locale.cpp
4129 +SOURCE=.\sql_locale.cpp