summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-11-24 12:12:25 +0100
committerunknown <msvensson@neptunus.(none)>2006-11-24 12:12:25 +0100
commit87e3047501d74efd55983d6c45936f1bc3a13256 (patch)
tree857a75fef3cd023ca835be3648bb195609b13cdb /mysql-test
parentde9980f4c61c3fdfe7547789ec4b0a86dc49c6a0 (diff)
parent6bd194d7ca9942a5926fe98dd8f59bd5213f24fd (diff)
downloadmariadb-git-87e3047501d74efd55983d6c45936f1bc3a13256.tar.gz
Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-4.1-maint mysql-test/Makefile.am: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/t/func_time.test: Auto merged sql-common/my_time.c: Auto merged sql/item_timefunc.cc: Auto merged mysql-test/mysql-test-run-shell.sh: Auto merged mysql-test/mysql-test-run.pl: Manual merge of changes for RPM
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/include/report-features.test11
-rw-r--r--mysql-test/install_test_db.sh17
-rw-r--r--mysql-test/mysql-test-run-shell.sh45
-rwxr-xr-xmysql-test/mysql-test-run.pl83
-rw-r--r--mysql-test/r/ctype_ucs.result22
-rw-r--r--mysql-test/r/func_gconcat.result62
-rw-r--r--mysql-test/r/func_time.result40
-rw-r--r--mysql-test/r/rename.result1
-rw-r--r--mysql-test/r/rpl_packet.result17
-rw-r--r--mysql-test/r/timezone.result8
-rw-r--r--mysql-test/r/timezone2.result24
-rw-r--r--mysql-test/r/timezone4.result6
-rw-r--r--mysql-test/t/ctype_ucs.test18
-rw-r--r--mysql-test/t/func_gconcat.test24
-rw-r--r--mysql-test/t/func_time.test52
-rw-r--r--mysql-test/t/rename.test6
-rw-r--r--mysql-test/t/rpl_packet-master.opt1
-rw-r--r--mysql-test/t/rpl_packet-slave.opt1
-rw-r--r--mysql-test/t/rpl_packet.test39
-rw-r--r--mysql-test/t/timezone.test7
-rw-r--r--mysql-test/t/timezone2.test10
-rw-r--r--mysql-test/t/timezone4-master.opt1
-rw-r--r--mysql-test/t/timezone4.test13
24 files changed, 452 insertions, 58 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 4afab8b0281..f8bf5c490f0 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -57,6 +57,7 @@ dist-hook:
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
+ $(INSTALL_DATA) $(srcdir)/include/*.test $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
@@ -84,6 +85,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r
$(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r
$(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
+ $(INSTALL_DATA) $(srcdir)/include/*.test $(DESTDIR)$(testdir)/include
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
diff --git a/mysql-test/include/report-features.test b/mysql-test/include/report-features.test
new file mode 100644
index 00000000000..df395f6e3f0
--- /dev/null
+++ b/mysql-test/include/report-features.test
@@ -0,0 +1,11 @@
+#
+# show server variables
+#
+
+--disable_query_log
+--echo ===== ENGINES =====
+show engines;
+--echo ===== VARIABLES =====
+show variables;
+--echo ===== STOP =====
+--enable_query_log
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index 4554b92857e..c30583503dc 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 1997-2002 MySQL AB
+# Copyright (C) 1997-2006 MySQL AB
# For a more info consult the file COPYRIGHT distributed with this file
# This scripts creates the privilege tables db, host, user, tables_priv,
@@ -7,19 +7,26 @@
if [ x$1 = x"--bin" ]; then
shift 1
+ BINARY_DIST=1
+
+ bindir=../bin
+ scriptdir=../bin
+ libexecdir=../libexec
# Check if it's a binary distribution or a 'make install'
if test -x ../libexec/mysqld
then
execdir=../libexec
+ elif test -x ../../sbin/mysqld # RPM installation
+ then
+ execdir=../../sbin
+ bindir=../../bin
+ scriptdir=../../bin
+ libexecdir=../../libexec
else
execdir=../bin
fi
- bindir=../bin
- BINARY_DIST=1
fix_bin=mysql-test
- scriptdir=../bin
- libexecdir=../libexec
else
execdir=../sql
bindir=../client
diff --git a/mysql-test/mysql-test-run-shell.sh b/mysql-test/mysql-test-run-shell.sh
index 141a725db2e..544721cf40d 100644
--- a/mysql-test/mysql-test-run-shell.sh
+++ b/mysql-test/mysql-test-run-shell.sh
@@ -158,18 +158,29 @@ fi
# Misc. Definitions
#--
-if [ -d ../sql ] ; then
+# BASEDIR is always above mysql-test directory ...
+MYSQL_TEST_DIR=`pwd`
+cd ..
+
+if [ -d ./sql ] ; then
SOURCE_DIST=1
else
BINARY_DIST=1
fi
-#BASEDIR is always one above mysql-test directory
-CWD=`pwd`
-cd ..
-BASEDIR=`pwd`
-cd $CWD
-MYSQL_TEST_DIR=$BASEDIR/mysql-test
+# ... one level for tar.gz, two levels for a RPM installation
+if [ -d ./bin ] ; then
+ # this is not perfect: we have
+ # /usr/share/mysql/ # mysql-test-run is here, so this is "$MYSQL_TEST_DIR"
+ # /usr/bin/ # with MySQL client programs
+ # so the existence of "/usr/share/bin/" would make this test fail.
+ BASEDIR=`pwd`
+else
+ cd ..
+ BASEDIR=`pwd`
+fi
+
+cd $MYSQL_TEST_DIR
MYSQL_TEST_WINDIR=$MYSQL_TEST_DIR
MYSQLTEST_VARDIR=$MYSQL_TEST_DIR/var
export MYSQL_TEST_DIR MYSQL_TEST_WINDIR MYSQLTEST_VARDIR
@@ -648,8 +659,15 @@ else
if test -x "$BASEDIR/libexec/mysqld"
then
MYSQLD="$VALGRIND $BASEDIR/libexec/mysqld"
- else
+ elif test -x "$BASEDIR/bin/mysqld"
+ then
MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
+ elif test -x "$BASEDIR/sbin/mysqld"
+ then
+ MYSQLD="$VALGRIND $BASEDIR/sbin/mysqld"
+ else
+ $ECHO "Fatal error: Cannot find program mysqld in $BASEDIR/{libexec,bin,sbin}" 1>&2
+ exit 1
fi
CLIENT_BINDIR="$BASEDIR/bin"
if test -d "$BASEDIR/tests"
@@ -1261,7 +1279,7 @@ start_master()
then
$ECHO "set args $master_args" > $GDB_MASTER_INIT$1
$ECHO "To start gdb for the master , type in another window:"
- $ECHO "cd $CWD ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD"
+ $ECHO "cd $MYSQL_TEST_DIR ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD"
wait_for_master=1500
else
( $ECHO set args $master_args;
@@ -1377,7 +1395,7 @@ start_slave()
then
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
echo "To start gdb for the slave, type in another window:"
- echo "cd $CWD ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
+ echo "cd $MYSQL_TEST_DIR ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
wait_for_slave=1500
else
( $ECHO set args $slave_args;
@@ -1606,10 +1624,13 @@ run_testcase ()
--result-file=*)
result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"`
result_file="r/$result_file.result"
- # Note that this must be set to space, not "" for test-reset to
-# work
+ # Note that this must be set to space, not "" for test-reset to work
EXTRA_MASTER_OPT=" "
;;
+ --force-restart)
+ # Note that this must be set to space, not "" for test-reset to work
+ EXTRA_MASTER_OPT=" "
+ ;;
esac
stop_master
stop_master 1
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index aa650d3bf02..4f32ae17724 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -187,6 +187,7 @@ our $opt_fast;
our $opt_force;
our $opt_reorder= 0;
our $opt_enable_disabled;
+our $opt_report_features;
our $opt_mem= $ENV{'MTR_MEM'};
our $opt_gcov;
@@ -423,17 +424,20 @@ sub main () {
if ( ! $need_im )
{
$opt_skip_im= 1;
- }
+ }
initialize_servers();
+ if ( $opt_report_features ) {
+ run_report_features();
+ }
+
run_suite($opt_suite, $tests);
}
mtr_exit(0);
}
-
##############################################################################
#
# Default settings
@@ -591,6 +595,7 @@ sub command_line_setup () {
'mem' => \$opt_mem,
# Misc
+ 'report-features' => \$opt_report_features,
'comment=s' => \$opt_comment,
'debug' => \$opt_debug,
'fast' => \$opt_fast,
@@ -632,7 +637,7 @@ sub command_line_setup () {
$glob_hostname= mtr_short_hostname();
- # 'basedir' is always parent of "mysql-test" directory
+ # Find the absolute path to the test directory
$glob_mysql_test_dir= cwd();
if ( $glob_cygwin_perl )
{
@@ -640,11 +645,27 @@ sub command_line_setup () {
$glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
chomp($glob_mysql_test_dir);
}
- $glob_basedir= dirname($glob_mysql_test_dir);
+
+ # In most cases, the base directory we find everything relative to,
+ # is the parent directory of the "mysql-test" directory. For source
+ # distributions, TAR binary distributions and some other packages.
+ $glob_basedir= dirname($glob_mysql_test_dir);
+
+ # In the RPM case, binaries and libraries are installed in the
+ # default system locations, instead of having our own private base
+ # directory. And we install "/usr/share/mysql-test". Moving up one
+ # more directory relative to "mysql-test" gives us a usable base
+ # directory for RPM installs.
+ if ( ! $opt_source_dist and ! -d "$glob_basedir/bin" )
+ {
+ $glob_basedir= dirname($glob_basedir);
+ }
# Expect mysql-bench to be located adjacent to the source tree, by default
$glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
unless defined $glob_mysql_bench_dir;
+ $glob_mysql_bench_dir= undef
+ unless -d $glob_mysql_bench_dir;
$path_my_basedir=
$source_dist ? $glob_mysql_test_dir : $glob_basedir;
@@ -788,6 +809,13 @@ sub command_line_setup () {
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
}
+ # Ensure a proper error message
+ mkpath("$opt_vardir");
+ unless ( -d $opt_vardir and -w $opt_vardir )
+ {
+ mtr_error("Writable 'var' directory is needed, use the '--vardir' option");
+ }
+
# --------------------------------------------------------------------------
# Set tmpdir
# --------------------------------------------------------------------------
@@ -1300,7 +1328,8 @@ sub executable_setup_im () {
mtr_exe_maybe_exists(
"$glob_basedir/server-tools/instance-manager/mysqlmanager",
"$glob_basedir/libexec/mysqlmanager",
- "$glob_basedir/bin/mysqlmanager");
+ "$glob_basedir/bin/mysqlmanager",
+ "$glob_basedir/sbin/mysqlmanager");
return ($exe_im eq "");
}
@@ -4196,6 +4225,43 @@ sub run_check_testcase ($$) {
return $res;
}
+##############################################################################
+#
+# Report the features that were compiled in
+#
+##############################################################################
+
+sub run_report_features () {
+ my $args;
+
+ if ( ! $glob_use_embedded_server )
+ {
+ mysqld_start($master->[0],[],[]);
+ if ( ! $master->[0]->{'pid'} )
+ {
+ mtr_error("Can't start the mysqld server");
+ }
+ mysqld_wait_started($master->[0]);
+ }
+
+ my $tinfo = {};
+ $tinfo->{'name'} = 'report features';
+ $tinfo->{'result_file'} = undef;
+ $tinfo->{'component_id'} = 'mysqld';
+ $tinfo->{'path'} = 'include/report-features.test';
+ $tinfo->{'timezone'}= "GMT-3";
+ $tinfo->{'slave_num'} = 0;
+ $tinfo->{'master_opt'} = [];
+ $tinfo->{'slave_opt'} = [];
+ $tinfo->{'slave_mi'} = [];
+ $tinfo->{'comment'} = 'report server features';
+ run_mysqltest($tinfo);
+
+ if ( ! $glob_use_embedded_server )
+ {
+ stop_all_servers();
+ }
+}
sub run_mysqltest ($) {
@@ -4328,8 +4394,10 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--test-file");
mtr_add_arg($args, $tinfo->{'path'});
- mtr_add_arg($args, "--result-file");
- mtr_add_arg($args, $tinfo->{'result_file'});
+ if ( defined $tinfo->{'result_file'} ) {
+ mtr_add_arg($args, "--result-file");
+ mtr_add_arg($args, $tinfo->{'result_file'});
+ }
if ( $opt_record )
{
@@ -4735,3 +4803,4 @@ HERE
mtr_exit(1);
}
+
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 642a0fc13b5..bf827209795 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -715,6 +715,28 @@ lily
river
drop table t1;
deallocate prepare stmt;
+create table t1 (
+a char(10) unicode not null,
+index a (a)
+) engine=myisam;
+insert into t1 values (repeat(0x201f, 10));
+insert into t1 values (repeat(0x2020, 10));
+insert into t1 values (repeat(0x2021, 10));
+explain select hex(a) from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 20 NULL 3 Using index
+select hex(a) from t1 order by a;
+hex(a)
+201F201F201F201F201F201F201F201F201F201F
+2020202020202020202020202020202020202020
+2021202120212021202120212021202120212021
+alter table t1 drop index a;
+select hex(a) from t1 order by a;
+hex(a)
+201F201F201F201F201F201F201F201F201F201F
+2020202020202020202020202020202020202020
+2021202120212021202120212021202120212021
+drop table t1;
CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
SELECT id, MIN(s) FROM t1 GROUP BY id;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index d4a46bfd79f..fa8a1e2cf6d 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -599,12 +599,72 @@ count(distinct (f1+1))
1
3
drop table t1;
+set names utf8;
+create table t1
+(
+x text character set utf8 not null,
+y integer not null
+);
+insert into t1 values (repeat('a', 1022), 0), (repeat(_utf8 0xc3b7, 4), 0);
+set group_concat_max_len= 1022 + 10;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1032 1031 1027 aaaaaaa,÷÷÷÷ C3B7C3B7C3B7
+set group_concat_max_len= 1022 + 9;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1031 1031 1027 aaaaaaa,÷÷÷÷ C3B7C3B7C3B7
+set group_concat_max_len= 1022 + 8;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1030 1029 1026 aaaaaaaa,÷÷÷ C3B7C3B7C3B7
+set group_concat_max_len= 1022 + 7;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1029 1029 1026 aaaaaaaa,÷÷÷ C3B7C3B7C3B7
+set group_concat_max_len= 1022 + 6;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1028 1027 1025 aaaaaaaaa,÷÷ 612CC3B7C3B7
+set group_concat_max_len= 1022 + 5;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1027 1027 1025 aaaaaaaaa,÷÷ 612CC3B7C3B7
+set group_concat_max_len= 1022 + 4;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1026 1025 1024 aaaaaaaaaa,÷ 6161612CC3B7
+set group_concat_max_len= 1022 + 3;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1025 1025 1024 aaaaaaaaaa,÷ 6161612CC3B7
+set group_concat_max_len= 1022 + 2;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1024 1023 1023 aaaaaaaaaaa, 61616161612C
+set group_concat_max_len= 1022 + 1;
+select @x:=group_concat(x) from t1 group by y;
+select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12)
+1023 1023 1023 aaaaaaaaaaa, 61616161612C
+drop table t1;
+set group_concat_max_len=1024;
+set names latin1;
create table t1 (f1 int unsigned, f2 varchar(255));
insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
select f2,group_concat(f1) from t1 group by f2;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 f2 f2 253 255 255 Y 0 0 8
-def group_concat(f1) 252 400 1 Y 128 0 63
+def group_concat(f1) 252 1024 1 Y 128 0 63
f2 group_concat(f1)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index ef95e0bd558..fdfb42c878d 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -485,12 +485,48 @@ unix_timestamp('1969-12-01 19:00:01')
select from_unixtime(-1);
from_unixtime(-1)
NULL
-select from_unixtime(2145916800);
-from_unixtime(2145916800)
+select from_unixtime(2147483647);
+from_unixtime(2147483647)
+2038-01-19 06:14:07
+select from_unixtime(2147483648);
+from_unixtime(2147483648)
NULL
select from_unixtime(0);
from_unixtime(0)
1970-01-01 03:00:00
+select unix_timestamp(from_unixtime(2147483647));
+unix_timestamp(from_unixtime(2147483647))
+2147483647
+select unix_timestamp(from_unixtime(2147483648));
+unix_timestamp(from_unixtime(2147483648))
+NULL
+select unix_timestamp('2039-01-20 01:00:00');
+unix_timestamp('2039-01-20 01:00:00')
+0
+select unix_timestamp('1968-01-20 01:00:00');
+unix_timestamp('1968-01-20 01:00:00')
+0
+select unix_timestamp('2038-02-10 01:00:00');
+unix_timestamp('2038-02-10 01:00:00')
+0
+select unix_timestamp('1969-11-20 01:00:00');
+unix_timestamp('1969-11-20 01:00:00')
+0
+select unix_timestamp('2038-01-20 01:00:00');
+unix_timestamp('2038-01-20 01:00:00')
+0
+select unix_timestamp('1969-12-30 01:00:00');
+unix_timestamp('1969-12-30 01:00:00')
+0
+select unix_timestamp('2038-01-17 12:00:00');
+unix_timestamp('2038-01-17 12:00:00')
+2147331600
+select unix_timestamp('1970-01-01 03:00:01');
+unix_timestamp('1970-01-01 03:00:01')
+1
+select unix_timestamp('2038-01-19 07:14:07');
+unix_timestamp('2038-01-19 07:14:07')
+0
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
SELECT * from t1;
diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result
index 964babb1228..d7db297cf26 100644
--- a/mysql-test/r/rename.result
+++ b/mysql-test/r/rename.result
@@ -54,3 +54,4 @@ Tables_in_test
t2
t4
drop table t2, t4;
+End of 4.1 tests
diff --git a/mysql-test/r/rpl_packet.result b/mysql-test/r/rpl_packet.result
new file mode 100644
index 00000000000..a5c9b43cabb
--- /dev/null
+++ b/mysql-test/r/rpl_packet.result
@@ -0,0 +1,17 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+select @@net_buffer_length, @@max_allowed_packet;
+@@net_buffer_length @@max_allowed_packet
+1024 1024
+create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
+select count(*) from `DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________`.`t1` /* must be 1 */;
+count(*)
+1
+drop database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
diff --git a/mysql-test/r/timezone.result b/mysql-test/r/timezone.result
index 10944c3706e..1223fff36c6 100644
--- a/mysql-test/r/timezone.result
+++ b/mysql-test/r/timezone.result
@@ -41,7 +41,7 @@ Warning 1299 Invalid TIMESTAMP value in column 'ts' at row 2
DROP TABLE t1;
select unix_timestamp('1970-01-01 01:00:00'),
unix_timestamp('1970-01-01 01:00:01'),
-unix_timestamp('2038-01-01 00:59:59'),
-unix_timestamp('2038-01-01 01:00:00');
-unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix_timestamp('2038-01-01 00:59:59') unix_timestamp('2038-01-01 01:00:00')
-0 1 2145916799 0
+unix_timestamp('2038-01-19 04:14:07'),
+unix_timestamp('2038-01-19 04:14:08');
+unix_timestamp('1970-01-01 01:00:00') unix_timestamp('1970-01-01 01:00:01') unix_timestamp('2038-01-19 04:14:07') unix_timestamp('2038-01-19 04:14:08')
+0 1 2147483647 0
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index 199b48ef1aa..ad3ce40ebb1 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -106,7 +106,7 @@ create table t1 (ts timestamp);
set time_zone='UTC';
insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
-('2037-12-31 23:59:59'),('2038-01-01 00:00:00');
+('2038-01-19 03:14:07'),('2038-01-19 03:14:08');
Warnings:
Warning 1264 Data truncated; out of range for column 'ts' at row 2
Warning 1264 Data truncated; out of range for column 'ts' at row 3
@@ -117,13 +117,13 @@ ts
0000-00-00 00:00:00
0000-00-00 00:00:00
1970-01-01 00:00:01
-2037-12-31 23:59:59
+2038-01-19 03:14:07
0000-00-00 00:00:00
delete from t1;
set time_zone='MET';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
-('2038-01-01 00:59:59'),('2038-01-01 01:00:00');
+('2038-01-19 04:14:07'),('2038-01-19 04:14:08');
Warnings:
Warning 1264 Data truncated; out of range for column 'ts' at row 2
Warning 1264 Data truncated; out of range for column 'ts' at row 3
@@ -134,13 +134,13 @@ ts
0000-00-00 00:00:00
0000-00-00 00:00:00
1970-01-01 01:00:01
-2038-01-01 00:59:59
+2038-01-19 04:14:07
0000-00-00 00:00:00
delete from t1;
set time_zone='+01:30';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
('1970-01-01 01:30:00'),('1970-01-01 01:30:01'),
-('2038-01-01 01:29:59'),('2038-01-01 01:30:00');
+('2038-01-19 04:44:07'),('2038-01-19 04:44:08');
Warnings:
Warning 1264 Data truncated; out of range for column 'ts' at row 2
Warning 1264 Data truncated; out of range for column 'ts' at row 3
@@ -151,7 +151,7 @@ ts
0000-00-00 00:00:00
0000-00-00 00:00:00
1970-01-01 01:30:01
-2038-01-01 01:29:59
+2038-01-19 04:44:07
0000-00-00 00:00:00
drop table t1;
show variables like 'time_zone';
@@ -213,12 +213,12 @@ convert_tz('2003-10-26 02:59:59', 'MET', 'UTC')
select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
convert_tz('2003-10-26 04:00:00', 'MET', 'UTC')
2003-10-26 03:00:00
-select convert_tz('2038-01-01 00:59:59', 'MET', 'UTC');
-convert_tz('2038-01-01 00:59:59', 'MET', 'UTC')
-2037-12-31 23:59:59
-select convert_tz('2038-01-01 01:00:00', 'MET', 'UTC');
-convert_tz('2038-01-01 01:00:00', 'MET', 'UTC')
-2038-01-01 01:00:00
+select convert_tz('2038-01-19 04:14:07', 'MET', 'UTC');
+convert_tz('2038-01-19 04:14:07', 'MET', 'UTC')
+2038-01-19 03:14:07
+select convert_tz('2038-01-19 04:14:08', 'MET', 'UTC');
+convert_tz('2038-01-19 04:14:08', 'MET', 'UTC')
+2038-01-19 04:14:08
select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
convert_tz('2103-01-01 04:00:00', 'MET', 'UTC')
2103-01-01 04:00:00
diff --git a/mysql-test/r/timezone4.result b/mysql-test/r/timezone4.result
new file mode 100644
index 00000000000..28028bea657
--- /dev/null
+++ b/mysql-test/r/timezone4.result
@@ -0,0 +1,6 @@
+select from_unixtime(0);
+from_unixtime(0)
+1969-12-31 14:00:00
+select unix_timestamp('1969-12-31 14:00:01');
+unix_timestamp('1969-12-31 14:00:01')
+1
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 641080f48ab..10559d33eb3 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -453,6 +453,24 @@ drop table t1;
deallocate prepare stmt;
#
+# Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
+#
+create table t1 (
+ a char(10) unicode not null,
+ index a (a)
+) engine=myisam;
+insert into t1 values (repeat(0x201f, 10));
+insert into t1 values (repeat(0x2020, 10));
+insert into t1 values (repeat(0x2021, 10));
+# make sure "index read" is used
+explain select hex(a) from t1 order by a;
+select hex(a) from t1 order by a;
+alter table t1 drop index a;
+select hex(a) from t1 order by a;
+drop table t1;
+
+
+#
# Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
# over a 'ucs2' field uses a temporary table
#
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 40179ae7f38..fb21822caa0 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -391,6 +391,30 @@ select count(distinct (f1+1)) from t1 group by f1 with rollup;
drop table t1;
#
+# Bug#23451 GROUP_CONCAT truncates a multibyte utf8 character
+#
+set names utf8;
+create table t1
+(
+ x text character set utf8 not null,
+ y integer not null
+);
+insert into t1 values (repeat('a', 1022), 0), (repeat(_utf8 0xc3b7, 4), 0);
+let $1= 10;
+while ($1)
+{
+ eval set group_concat_max_len= 1022 + $1;
+ --disable_result_log
+ select @x:=group_concat(x) from t1 group by y;
+ --enable_result_log
+ select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
+ dec $1;
+}
+drop table t1;
+set group_concat_max_len=1024;
+set names latin1;
+
+#
# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
#
create table t1 (f1 int unsigned, f2 varchar(255));
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index a9b6be0cc72..fa12c45db04 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -236,17 +236,57 @@ select unix_timestamp(@a);
select unix_timestamp('1969-12-01 19:00:01');
#
-# Test for bug #6439 "unix_timestamp() function returns wrong datetime
-# values for too big argument" and bug #7515 "from_unixtime(0) now
-# returns NULL instead of the epoch". unix_timestamp() should return error
-# for too big or negative argument. It should return Epoch value for zero
-# argument since it seems that many user's rely on this fact.
+# Tests for bug #6439 "unix_timestamp() function returns wrong datetime
+# values for too big argument", bug #7515 "from_unixtime(0) now
+# returns NULL instead of the epoch" and bug #9191
+# "TIMESTAMP/from_unixtime() no longer accepts 2^31-1."
+# unix_timestamp() should return error for too big or negative argument.
+# It should return Epoch value for zero argument since it seems that many
+# users rely on this fact, from_unixtime() should work with values
+# up to INT_MAX32 because of the same reason.
#
select from_unixtime(-1);
-select from_unixtime(2145916800);
+# check for from_unixtime(2^31-1) and from_unixtime(2^31)
+select from_unixtime(2147483647);
+select from_unixtime(2147483648);
select from_unixtime(0);
#
+# Some more tests for bug #9191 "TIMESTAMP/from_unixtime() no
+# longer accepts 2^31-1". Here we test that from_unixtime and
+# unix_timestamp are consistent, when working with boundary dates.
+#
+select unix_timestamp(from_unixtime(2147483647));
+select unix_timestamp(from_unixtime(2147483648));
+
+# check for invalid dates
+
+# bad year
+select unix_timestamp('2039-01-20 01:00:00');
+select unix_timestamp('1968-01-20 01:00:00');
+# bad month
+select unix_timestamp('2038-02-10 01:00:00');
+select unix_timestamp('1969-11-20 01:00:00');
+# bad day
+select unix_timestamp('2038-01-20 01:00:00');
+select unix_timestamp('1969-12-30 01:00:00');
+
+#
+# Check negative shift (we subtract several days for boundary dates during
+# conversion).
+select unix_timestamp('2038-01-17 12:00:00');
+
+#
+# Check positive shift. (it happens only on
+# platfroms with unsigned time_t, such as QNX)
+#
+select unix_timestamp('1970-01-01 03:00:01');
+
+# check bad date, close to the boundary (we cut them off in the very end)
+select unix_timestamp('2038-01-19 07:14:07');
+
+
+#
# Test types from + INTERVAL
#
diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test
index b0fb60c0ee4..c32184645c1 100644
--- a/mysql-test/t/rename.test
+++ b/mysql-test/t/rename.test
@@ -70,4 +70,8 @@ show tables;
drop table t2, t4;
-# End of 4.1 tests
+disconnect con2;
+disconnect con1;
+connection default;
+
+--echo End of 4.1 tests
diff --git a/mysql-test/t/rpl_packet-master.opt b/mysql-test/t/rpl_packet-master.opt
new file mode 100644
index 00000000000..42d4f94c999
--- /dev/null
+++ b/mysql-test/t/rpl_packet-master.opt
@@ -0,0 +1 @@
+-O max_allowed_packet=1024 -O net_buffer_length=1024
diff --git a/mysql-test/t/rpl_packet-slave.opt b/mysql-test/t/rpl_packet-slave.opt
new file mode 100644
index 00000000000..42d4f94c999
--- /dev/null
+++ b/mysql-test/t/rpl_packet-slave.opt
@@ -0,0 +1 @@
+-O max_allowed_packet=1024 -O net_buffer_length=1024
diff --git a/mysql-test/t/rpl_packet.test b/mysql-test/t/rpl_packet.test
new file mode 100644
index 00000000000..d01979a4731
--- /dev/null
+++ b/mysql-test/t/rpl_packet.test
@@ -0,0 +1,39 @@
+#
+# Check replication protocol packet size handling
+# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
+#
+
+# max-out size db name
+source include/master-slave.inc;
+
+let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
+disable_warnings;
+eval drop database if exists $db;
+enable_warnings;
+eval create database $db;
+
+connection master;
+select @@net_buffer_length, @@max_allowed_packet;
+disconnect master;
+
+# alas, can't use eval here; if db name changed apply the change here
+connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________);
+
+connection master;
+create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
+
+INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1023');
+save_master_pos;
+
+connection slave;
+sync_with_master;
+eval select count(*) from `$db`.`t1` /* must be 1 */;
+
+connection master;
+eval drop database $db;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+
+# End of tests
diff --git a/mysql-test/t/timezone.test b/mysql-test/t/timezone.test
index 34bbb365c70..157b18f57fa 100644
--- a/mysql-test/t/timezone.test
+++ b/mysql-test/t/timezone.test
@@ -52,11 +52,12 @@ INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'),
DROP TABLE t1;
#
-# Test for fix for Bug#2523
+# Test for fix for Bug#2523 Check that boundary dates are processed
+# correctly.
#
select unix_timestamp('1970-01-01 01:00:00'),
unix_timestamp('1970-01-01 01:00:01'),
- unix_timestamp('2038-01-01 00:59:59'),
- unix_timestamp('2038-01-01 01:00:00');
+ unix_timestamp('2038-01-19 04:14:07'),
+ unix_timestamp('2038-01-19 04:14:08');
# End of 4.1 tests
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
index 523249a3a2c..43f9a944be1 100644
--- a/mysql-test/t/timezone2.test
+++ b/mysql-test/t/timezone2.test
@@ -107,21 +107,21 @@ create table t1 (ts timestamp);
set time_zone='UTC';
insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
- ('2037-12-31 23:59:59'),('2038-01-01 00:00:00');
+ ('2038-01-19 03:14:07'),('2038-01-19 03:14:08');
select * from t1;
delete from t1;
# MET time zone has range shifted by one hour
set time_zone='MET';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
- ('2038-01-01 00:59:59'),('2038-01-01 01:00:00');
+ ('2038-01-19 04:14:07'),('2038-01-19 04:14:08');
select * from t1;
delete from t1;
# same for +01:30 time zone
set time_zone='+01:30';
insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
('1970-01-01 01:30:00'),('1970-01-01 01:30:01'),
- ('2038-01-01 01:29:59'),('2038-01-01 01:30:00');
+ ('2038-01-19 04:44:07'),('2038-01-19 04:44:08');
select * from t1;
drop table t1;
@@ -171,8 +171,8 @@ select convert_tz('2003-10-26 01:00:00', 'MET', 'UTC');
select convert_tz('2003-10-26 02:00:00', 'MET', 'UTC');
select convert_tz('2003-10-26 02:59:59', 'MET', 'UTC');
select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
-select convert_tz('2038-01-01 00:59:59', 'MET', 'UTC');
-select convert_tz('2038-01-01 01:00:00', 'MET', 'UTC');
+select convert_tz('2038-01-19 04:14:07', 'MET', 'UTC');
+select convert_tz('2038-01-19 04:14:08', 'MET', 'UTC');
select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
# Let us test variable time zone argument
diff --git a/mysql-test/t/timezone4-master.opt b/mysql-test/t/timezone4-master.opt
new file mode 100644
index 00000000000..d1ab6207933
--- /dev/null
+++ b/mysql-test/t/timezone4-master.opt
@@ -0,0 +1 @@
+--timezone=GMT+10
diff --git a/mysql-test/t/timezone4.test b/mysql-test/t/timezone4.test
new file mode 100644
index 00000000000..d7372c75d5a
--- /dev/null
+++ b/mysql-test/t/timezone4.test
@@ -0,0 +1,13 @@
+#
+# Tests for time functions. The difference from func_time test is the
+# timezone. In func_time it's GMT-3. In our case it's GMT+10
+#
+
+#
+# Test for bug bug #9191 "TIMESTAMP/from_unixtime() no longer accepts 2^31-1"
+#
+
+select from_unixtime(0);
+# check 0 boundary
+select unix_timestamp('1969-12-31 14:00:01');
+