mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge may.pils.ru:/home/svoj/devel/mysql/merge/mysql-4.1
into may.pils.ru:/home/svoj/devel/mysql/merge/mysql-4.1-engines mysql-test/r/myisam.result: Auto merged mysql-test/t/myisam.test: Auto merged
This commit is contained in:
@ -34,7 +34,7 @@ benchdir_root= $(prefix)
|
||||
testdir = $(benchdir_root)/mysql-test
|
||||
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh $(PRESCRIPTS)
|
||||
EXTRA_DIST = $(EXTRA_SCRIPTS)
|
||||
GENSCRIPTS = mysql-test-run install_test_db
|
||||
GENSCRIPTS = mysql-test-run install_test_db mtr
|
||||
PRESCRIPTS = mysql-test-run.pl
|
||||
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
|
||||
test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \
|
||||
@ -105,6 +105,11 @@ std_data/server-cert.pem:
|
||||
std_data/server-key.pem:
|
||||
@CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
|
||||
|
||||
# mtr - a shortcut for executing mysql-test-run.pl
|
||||
mtr:
|
||||
$(RM) -f mtr
|
||||
$(LN_S) mysql-test-run.pl mtr
|
||||
|
||||
SUFFIXES = .sh
|
||||
|
||||
.sh:
|
||||
|
@ -193,6 +193,28 @@ sub collect_one_test_case($$$$$$) {
|
||||
$tinfo->{'slave_restart'}= 1;
|
||||
}
|
||||
|
||||
# Cluster is needed by test case if testname contains ndb
|
||||
if ( defined mtr_match_substring($tname,"ndb") )
|
||||
{
|
||||
$tinfo->{'ndb_test'}= 1;
|
||||
if ( $::opt_skip_ndbcluster )
|
||||
{
|
||||
# Skip all ndb tests
|
||||
$tinfo->{'skip'}= 1;
|
||||
return;
|
||||
}
|
||||
if ( ! $::opt_with_ndbcluster )
|
||||
{
|
||||
# Ndb is not supported, skip them
|
||||
$tinfo->{'skip'}= 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$tinfo->{'ndb_test'}= 0;
|
||||
}
|
||||
|
||||
# FIXME what about embedded_server + ndbcluster, skip ?!
|
||||
|
||||
my $master_opt_file= "$testdir/$tname-master.opt";
|
||||
|
@ -50,6 +50,23 @@ sub mtr_match_extension ($$) {
|
||||
}
|
||||
|
||||
|
||||
# Match a substring anywere in a string
|
||||
|
||||
sub mtr_match_substring ($$) {
|
||||
my $string= shift;
|
||||
my $substring= shift;
|
||||
|
||||
if ( $string =~ /(.*)\Q$substring\E(.*)$/ ) # strncmp
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return undef; # NULL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub mtr_match_any_exact ($$) {
|
||||
my $string= shift;
|
||||
my $mlist= shift;
|
||||
|
@ -82,7 +82,14 @@ sub mtr_path_exists (@) {
|
||||
sub mtr_script_exists (@) {
|
||||
foreach my $path ( @_ )
|
||||
{
|
||||
return $path if -x $path;
|
||||
if($::glob_win32)
|
||||
{
|
||||
return $path if -f $path;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $path if -x $path;
|
||||
}
|
||||
}
|
||||
if ( @_ == 1 )
|
||||
{
|
||||
@ -99,7 +106,14 @@ sub mtr_exe_exists (@) {
|
||||
map {$_.= ".exe"} @path if $::glob_win32;
|
||||
foreach my $path ( @path )
|
||||
{
|
||||
return $path if -x $path;
|
||||
if($::glob_win32)
|
||||
{
|
||||
return $path if -f $path;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $path if -x $path;
|
||||
}
|
||||
}
|
||||
if ( @path == 1 )
|
||||
{
|
||||
|
@ -233,6 +233,7 @@ our $opt_result_ext;
|
||||
|
||||
our $opt_skip;
|
||||
our $opt_skip_rpl;
|
||||
our $opt_skip_im; # --skip-im on command line will just be ignored
|
||||
our $opt_skip_test;
|
||||
|
||||
our $opt_sleep;
|
||||
@ -519,6 +520,7 @@ sub command_line_setup () {
|
||||
'do-test=s' => \$opt_do_test,
|
||||
'suite=s' => \$opt_suite,
|
||||
'skip-rpl' => \$opt_skip_rpl,
|
||||
'skip-im' => \$opt_skip_im,
|
||||
'skip-test=s' => \$opt_skip_test,
|
||||
|
||||
# Specify ports
|
||||
@ -898,7 +900,8 @@ sub executable_setup () {
|
||||
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt",
|
||||
"$path_client_bindir/mysqld",
|
||||
"$path_client_bindir/mysqld-debug",
|
||||
"$path_client_bindir/mysqld-max");
|
||||
"$path_client_bindir/mysqld-max",
|
||||
"$path_client_bindir/mysqld-max-nt");
|
||||
$path_language= mtr_path_exists("$glob_basedir/share/english/");
|
||||
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets");
|
||||
$exe_my_print_defaults=
|
||||
@ -1581,6 +1584,16 @@ sub run_testcase ($) {
|
||||
{
|
||||
$do_restart= 1; # Always restart if script to run
|
||||
}
|
||||
elsif ( $tinfo->{'ndb_test'} and $master->[0]->{'ndbcluster'} == 1 )
|
||||
{
|
||||
$do_restart= 1; # Restart with cluster
|
||||
# print "Restarting because cluster need to be enabled\n";
|
||||
}
|
||||
elsif ($tinfo->{'ndb_test'} == 0 and $master->[0]->{'ndbcluster'} == 0)
|
||||
{
|
||||
$do_restart= 1; # Restart without cluster
|
||||
# print "Restarting because cluster need to be disabled\n";
|
||||
}
|
||||
elsif ( $master->[0]->{'running_master_is_special'} and
|
||||
$master->[0]->{'running_master_is_special'}->{'timezone'} eq
|
||||
$tinfo->{'timezone'} and
|
||||
@ -1646,7 +1659,7 @@ sub run_testcase ($) {
|
||||
|
||||
if ( ! $opt_local_master )
|
||||
{
|
||||
if ( $master->[0]->{'ndbcluster'} )
|
||||
if ( $master->[0]->{'ndbcluster'} && $tinfo->{'ndb_test'})
|
||||
{
|
||||
$master->[0]->{'ndbcluster'}= ndbcluster_start();
|
||||
if ( $master->[0]->{'ndbcluster'} )
|
||||
@ -1659,8 +1672,22 @@ sub run_testcase ($) {
|
||||
{
|
||||
# FIXME not correct location for do_before_start_master()
|
||||
do_before_start_master($tname,$tinfo->{'master_sh'});
|
||||
|
||||
# Save skip_ndbcluster
|
||||
my $save_opt_skip_ndbcluster= $opt_skip_ndbcluster;
|
||||
if (!$tinfo->{'ndb_test'})
|
||||
{
|
||||
# Modify skip_ndbcluster so cluster is skipped for this
|
||||
# and subsequent testcases(until we find one that does not cluster)
|
||||
$opt_skip_ndbcluster= 1;
|
||||
}
|
||||
|
||||
$master->[0]->{'pid'}=
|
||||
mysqld_start('master',0,$tinfo->{'master_opt'},[]);
|
||||
|
||||
# Restore skip_ndbcluster
|
||||
$opt_skip_ndbcluster= $save_opt_skip_ndbcluster;
|
||||
|
||||
if ( ! $master->[0]->{'pid'} )
|
||||
{
|
||||
report_failure_and_restart($tinfo);
|
||||
@ -2026,7 +2053,7 @@ sub mysqld_arguments ($$$$$) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $opt_with_ndbcluster )
|
||||
if ( $opt_with_ndbcluster && !$opt_skip_ndbcluster && $type eq 'master')
|
||||
{
|
||||
mtr_add_arg($args, "%s--ndbcluster", $prefix);
|
||||
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
|
||||
|
@ -722,3 +722,42 @@ id MIN(s)
|
||||
1 ZZZ
|
||||
2 ZZZ
|
||||
DROP TABLE t1;
|
||||
drop table if exists bug20536;
|
||||
set names latin1;
|
||||
create table bug20536 (id bigint not null auto_increment primary key, name
|
||||
varchar(255) character set ucs2 not null);
|
||||
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
|
||||
select md5(name) from bug20536;
|
||||
md5(name)
|
||||
f4b7ce8b45a20e3c4e84bef515d1525c
|
||||
48d95db0d8305c2fe11548a3635c9385
|
||||
select sha1(name) from bug20536;
|
||||
sha1(name)
|
||||
e0b52f38deddb9f9e8d5336b153592794cb49baf
|
||||
677d4d505355eb5b0549b865fcae4b7f0c28aef5
|
||||
select make_set(3, name, upper(name)) from bug20536;
|
||||
make_set(3, name, upper(name))
|
||||
test1,TEST1
|
||||
'test\_2','TEST\_2'
|
||||
select export_set(5, name, upper(name)) from bug20536;
|
||||
export_set(5, name, upper(name))
|
||||
test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1
|
||||
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2'
|
||||
select export_set(5, name, upper(name), ",", 5) from bug20536;
|
||||
export_set(5, name, upper(name), ",", 5)
|
||||
test1,TEST1,test1,TEST1,TEST1
|
||||
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2'
|
||||
select password(name) from bug20536;
|
||||
password(name)
|
||||
????????????????????
|
||||
????????????????????
|
||||
select old_password(name) from bug20536;
|
||||
old_password(name)
|
||||
????????
|
||||
????????
|
||||
select quote(name) from bug20536;
|
||||
quote(name)
|
||||
????????
|
||||
????????????????
|
||||
drop table bug20536;
|
||||
End of 4.1 tests
|
||||
|
@ -1340,3 +1340,15 @@ select a from t1 group by a;
|
||||
a
|
||||
e
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
grant select on test.* to юзер_юзер@localhost;
|
||||
user()
|
||||
юзер_юзер@localhost
|
||||
revoke all on test.* from юзер_юзер@localhost;
|
||||
drop user юзер_юзер@localhost;
|
||||
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
select database();
|
||||
database()
|
||||
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
|
||||
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
|
@ -172,3 +172,7 @@ a
|
||||
0
|
||||
2
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int);
|
||||
delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
|
||||
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
|
||||
drop table t1;
|
||||
|
@ -555,3 +555,14 @@ EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a int primary key, b int);
|
||||
INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
|
||||
explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
SELECT DISTINCT a, b FROM t1 ORDER BY b;
|
||||
a b
|
||||
1 1
|
||||
3 2
|
||||
2 3
|
||||
DROP TABLE t1;
|
||||
|
@ -559,14 +559,14 @@ COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
|
||||
DROP TABLE t1,t2;
|
||||
select * from (select group_concat('c') from DUAL) t;
|
||||
group_concat('c')
|
||||
NULL
|
||||
c
|
||||
create table t1 ( a int not null default 0);
|
||||
select * from (select group_concat(a) from t1) t2;
|
||||
group_concat(a)
|
||||
NULL
|
||||
select group_concat('x') UNION ALL select 1;
|
||||
group_concat('x')
|
||||
NULL
|
||||
x
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id int, a varchar(9));
|
||||
|
@ -794,7 +794,7 @@ min(7)
|
||||
NULL
|
||||
select min(7) from DUAL;
|
||||
min(7)
|
||||
NULL
|
||||
7
|
||||
explain select min(7) from t2m join t1m;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
@ -809,7 +809,7 @@ max(7)
|
||||
NULL
|
||||
select max(7) from DUAL;
|
||||
max(7)
|
||||
NULL
|
||||
7
|
||||
explain select max(7) from t2m join t1m;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
@ -848,7 +848,7 @@ min(7)
|
||||
NULL
|
||||
select min(7) from DUAL;
|
||||
min(7)
|
||||
NULL
|
||||
7
|
||||
explain select min(7) from t2i join t1i;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||
@ -864,7 +864,7 @@ max(7)
|
||||
NULL
|
||||
select max(7) from DUAL;
|
||||
max(7)
|
||||
NULL
|
||||
7
|
||||
explain select max(7) from t2i join t1i;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||
@ -942,3 +942,19 @@ EXPLAIN SELECT MAX(b) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,1),(1,2),(2,3);
|
||||
SELECT (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
|
||||
(SELECT COUNT(DISTINCT t1.b))
|
||||
1
|
||||
1
|
||||
SELECT (SELECT COUNT(DISTINCT 12)) FROM t1 GROUP BY t1.a;
|
||||
(SELECT COUNT(DISTINCT 12))
|
||||
1
|
||||
1
|
||||
SELECT AVG(2), BIT_AND(2), BIT_OR(2), BIT_XOR(2), COUNT(*), COUNT(12),
|
||||
COUNT(DISTINCT 12), MIN(2),MAX(2),STD(2), VARIANCE(2),SUM(2),
|
||||
GROUP_CONCAT(2),GROUP_CONCAT(DISTINCT 2);
|
||||
AVG(2) BIT_AND(2) BIT_OR(2) BIT_XOR(2) COUNT(*) COUNT(12) COUNT(DISTINCT 12) MIN(2) MAX(2) STD(2) VARIANCE(2) SUM(2) GROUP_CONCAT(2) GROUP_CONCAT(DISTINCT 2)
|
||||
2.0000 2 2 2 1 1 1 2 2 0.0000 0.0000 2 2 2
|
||||
DROP TABLE t1;
|
||||
|
@ -93,3 +93,7 @@ SELECT IS_USED_LOCK('bug16501');
|
||||
IS_USED_LOCK('bug16501')
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
|
||||
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
|
||||
foo,foo,bar,bar
|
||||
End of 4.1 tests
|
||||
|
@ -646,37 +646,36 @@ drop table t1;
|
||||
create table t1(f1 date, f2 time, f3 datetime);
|
||||
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
|
||||
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
|
||||
select f1 from t1 where f1 between "2006-1-1" and 20060101;
|
||||
select f1 from t1 where f1 between CAST("2006-1-1" as date) and CAST(20060101 as date);
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where f1 between "2006-1-1" and "2006.1.1";
|
||||
select f1 from t1 where f1 between cast("2006-1-1" as date) and cast("2006.1.1" as date);
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where date(f1) between "2006-1-1" and "2006.1.1";
|
||||
select f1 from t1 where date(f1) between cast("2006-1-1" as date) and cast("2006.1.1" as date);
|
||||
f1
|
||||
2006-01-01
|
||||
select f2 from t1 where f2 between "12:1:2" and "12:2:2";
|
||||
select f2 from t1 where f2 between cast("12:1:2" as time) and cast("12:2:2" as time);
|
||||
f2
|
||||
12:01:02
|
||||
select f2 from t1 where time(f2) between "12:1:2" and "12:2:2";
|
||||
select f2 from t1 where time(f2) between cast("12:1:2" as time) and cast("12:2:2" as time);
|
||||
f2
|
||||
12:01:02
|
||||
select f3 from t1 where f3 between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
|
||||
select f3 from t1 where f3 between cast("2006-1-1 12:1:1" as datetime) and cast("2006-1-1 12:1:2" as datetime);
|
||||
f3
|
||||
2006-01-01 12:01:01
|
||||
select f3 from t1 where timestamp(f3) between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
|
||||
select f3 from t1 where timestamp(f3) between cast("2006-1-1 12:1:1" as datetime) and cast("2006-1-1 12:1:2" as datetime);
|
||||
f3
|
||||
2006-01-01 12:01:01
|
||||
select f1 from t1 where "2006-1-1" between f1 and f3;
|
||||
select f1 from t1 where cast("2006-1-1" as date) between f1 and f3;
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where "2006-1-1" between date(f1) and date(f3);
|
||||
select f1 from t1 where cast("2006-1-1" as date) between date(f1) and date(f3);
|
||||
f1
|
||||
2006-01-01
|
||||
select f1 from t1 where "2006-1-1" between f1 and 'zzz';
|
||||
select f1 from t1 where cast("2006-1-1" as date) between f1 and 'zzz';
|
||||
f1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect date value: 'zzz'
|
||||
2006-01-01
|
||||
select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
|
||||
f1
|
||||
2006-01-01
|
||||
@ -695,3 +694,24 @@ t1 CREATE TABLE `t1` (
|
||||
`from_unixtime(1) + 0` double(23,6) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
|
||||
H
|
||||
120
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
|
||||
H
|
||||
120
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
|
||||
H
|
||||
05
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
|
||||
H
|
||||
5
|
||||
End of 4.1 tests
|
||||
|
@ -83,3 +83,24 @@ b a
|
||||
3 3
|
||||
3 3
|
||||
DROP TABLE t1, t2, t3;
|
||||
CREATE TABLE `t1` (`id1` INT) ;
|
||||
INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
|
||||
CREATE TABLE `t2` (
|
||||
`id1` INT,
|
||||
`id2` INT NOT NULL,
|
||||
`id3` INT,
|
||||
`id4` INT NOT NULL,
|
||||
UNIQUE (`id2`,`id4`),
|
||||
KEY (`id1`)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
|
||||
(1,1,1,0),
|
||||
(1,1,2,1),
|
||||
(5,1,2,2),
|
||||
(6,1,2,3),
|
||||
(1,2,2,2),
|
||||
(1,2,1,1);
|
||||
SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
|
||||
id1
|
||||
2
|
||||
DROP TABLE t1, t2;
|
||||
|
@ -63,9 +63,9 @@ Warnings:
|
||||
Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c`,values(test.t1.a) AS `VALUES(a)` from test.t1
|
||||
explain extended select * from t1 where values(a);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
Warnings:
|
||||
Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1
|
||||
Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where values(test.t1.a)
|
||||
DROP TABLE t1;
|
||||
create table t1(a int primary key, b int);
|
||||
insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
@ -197,3 +197,25 @@ PRIMARY KEY (a)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a) ;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
a BIGINT UNSIGNED,
|
||||
b BIGINT UNSIGNED,
|
||||
PRIMARY KEY (a)
|
||||
);
|
||||
INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
45 1
|
||||
INSERT INTO t1 VALUES (45, 2) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
45 2
|
||||
INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
45 2
|
||||
DROP TABLE t1;
|
||||
|
@ -76,3 +76,17 @@ a
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
|
||||
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
c
|
||||
7
|
||||
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
|
||||
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
c
|
||||
28
|
||||
|
@ -801,12 +801,12 @@ show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TEMPORARY TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TEMPORARY TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
|
||||
create table t1 (a int) engine=myisam select 42 a;
|
||||
select * from t1;
|
||||
a
|
||||
|
@ -2,47 +2,3 @@
|
||||
1
|
||||
ERROR 1064 (42000) at line 3: 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 '' at line 1
|
||||
ERROR at line 1: USE must be followed by a database name
|
||||
? (\?) Synonym for `help'.
|
||||
clear (\c) Clear command.
|
||||
connect (\r) Reconnect to the server. Optional arguments are db and host.
|
||||
delimiter (\d) Set query delimiter.
|
||||
edit (\e) Edit command with $EDITOR.
|
||||
ego (\G) Send command to mysql server, display result vertically.
|
||||
exit (\q) Exit mysql. Same as quit.
|
||||
go (\g) Send command to mysql server.
|
||||
help (\h) Display this help.
|
||||
nopager (\n) Disable pager, print to stdout.
|
||||
notee (\t) Don't write into outfile.
|
||||
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
|
||||
print (\p) Print current command.
|
||||
prompt (\R) Change your mysql prompt.
|
||||
quit (\q) Quit mysql.
|
||||
rehash (\#) Rebuild completion hash.
|
||||
source (\.) Execute an SQL script file. Takes a file name as an argument.
|
||||
status (\s) Get status information from the server.
|
||||
system (\!) Execute a system shell command.
|
||||
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
|
||||
use (\u) Use another database. Takes database name as argument.
|
||||
charset_name(\C) Switch to another charset. Might be needed for processing binlog.
|
||||
? (\?) Synonym for `help'.
|
||||
clear (\c) Clear command.
|
||||
connect (\r) Reconnect to the server. Optional arguments are db and host.
|
||||
delimiter (\d) Set query delimiter.
|
||||
edit (\e) Edit command with $EDITOR.
|
||||
ego (\G) Send command to mysql server, display result vertically.
|
||||
exit (\q) Exit mysql. Same as quit.
|
||||
go (\g) Send command to mysql server.
|
||||
help (\h) Display this help.
|
||||
nopager (\n) Disable pager, print to stdout.
|
||||
notee (\t) Don't write into outfile.
|
||||
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
|
||||
print (\p) Print current command.
|
||||
prompt (\R) Change your mysql prompt.
|
||||
quit (\q) Quit mysql.
|
||||
rehash (\#) Rebuild completion hash.
|
||||
source (\.) Execute an SQL script file. Takes a file name as an argument.
|
||||
status (\s) Get status information from the server.
|
||||
system (\!) Execute a system shell command.
|
||||
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
|
||||
use (\u) Use another database. Takes database name as argument.
|
||||
charset_name(\C) Switch to another charset. Might be needed for processing binlog.
|
||||
|
@ -1557,4 +1557,31 @@ CREATE TABLE `t2` (
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int);
|
||||
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
|
||||
mysqldump: Got error: 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
|
@ -1001,7 +1001,7 @@ INSERT INTO t1 VALUES (1);
|
||||
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
|
||||
select * from t1;
|
||||
i
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int(1));
|
||||
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
|
||||
@ -1193,7 +1193,7 @@ UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
|
||||
ERROR 42S02: Unknown table 't' in field list
|
||||
select * from t1;
|
||||
i
|
||||
1
|
||||
3
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
id int(11) default NULL
|
||||
@ -2895,3 +2895,54 @@ select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
|
||||
s1
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
retailerID varchar(8) NOT NULL,
|
||||
statusID int(10) unsigned NOT NULL,
|
||||
changed datetime NOT NULL,
|
||||
UNIQUE KEY retailerID (retailerID, statusID, changed)
|
||||
);
|
||||
INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
|
||||
INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
|
||||
INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
|
||||
INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
|
||||
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
|
||||
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
|
||||
select * from t1 r1
|
||||
where (r1.retailerID,(r1.changed)) in
|
||||
(SELECT r2.retailerId,(max(changed)) from t1 r2
|
||||
group by r2.retailerId);
|
||||
retailerID statusID changed
|
||||
0026 2 2006-01-06 12:25:53
|
||||
0037 2 2006-01-06 12:25:53
|
||||
0048 1 2006-01-06 12:37:50
|
||||
0059 1 2006-01-06 12:37:50
|
||||
drop table t1;
|
||||
create table t1(a int, primary key (a));
|
||||
insert into t1 values (10);
|
||||
create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
|
||||
insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
|
||||
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 DEPENDENT SUBQUERY t2 range b b 38 NULL 2 Using where
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
a a b
|
||||
10 3 35989
|
||||
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
|
||||
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
|
||||
2 DEPENDENT SUBQUERY t2 range b b 38 NULL 2 Using where
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
a a b
|
||||
10 1 359
|
||||
drop table t1,t2;
|
||||
|
@ -27,12 +27,12 @@ INSERT INTO t1 VALUES ( "2000-1-2" );
|
||||
INSERT INTO t1 VALUES ( "2000-1-3" );
|
||||
INSERT INTO t1 VALUES ( "2000-1-4" );
|
||||
INSERT INTO t1 VALUES ( "2000-1-5" );
|
||||
SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND "2000-1-4";
|
||||
SELECT * FROM t1 WHERE datum BETWEEN cast("2000-1-2" as date) AND cast("2000-1-4" as date);
|
||||
datum
|
||||
2000-01-02
|
||||
2000-01-03
|
||||
2000-01-04
|
||||
SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND datum - INTERVAL 100 DAY;
|
||||
SELECT * FROM t1 WHERE datum BETWEEN cast("2000-1-2" as date) AND datum - INTERVAL 100 DAY;
|
||||
datum
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
@ -104,3 +104,9 @@ SELECT * FROM t1;
|
||||
y
|
||||
0000
|
||||
DROP TABLE t1;
|
||||
create table t1(start_date date, end_date date);
|
||||
insert into t1 values ('2000-01-01','2000-01-02');
|
||||
select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
|
@ -463,4 +463,37 @@ INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
|
||||
SELECT id, MIN(s) FROM t1 GROUP BY id;
|
||||
|
||||
DROP TABLE t1;
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists bug20536;
|
||||
--enable_warnings
|
||||
|
||||
set names latin1;
|
||||
create table bug20536 (id bigint not null auto_increment primary key, name
|
||||
varchar(255) character set ucs2 not null);
|
||||
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
|
||||
select md5(name) from bug20536;
|
||||
select sha1(name) from bug20536;
|
||||
select make_set(3, name, upper(name)) from bug20536;
|
||||
select export_set(5, name, upper(name)) from bug20536;
|
||||
select export_set(5, name, upper(name), ",", 5) from bug20536;
|
||||
|
||||
# Some broken functions: add these tests just to document current behavior.
|
||||
|
||||
# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
|
||||
# not be backwards compatible in all cases, so it's best to leave it alone
|
||||
select password(name) from bug20536;
|
||||
select old_password(name) from bug20536;
|
||||
|
||||
# QUOTE doesn't work with UCS2 data. It would require a total rewrite
|
||||
# of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
|
||||
# supported fully as a client character set.
|
||||
select quote(name) from bug20536;
|
||||
|
||||
drop table bug20536;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
@ -1072,4 +1072,20 @@ explain select a from t1 group by a;
|
||||
select a from t1 group by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#20393: User name truncation in mysql client
|
||||
# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
|
||||
#
|
||||
set names utf8;
|
||||
#create user юзер_юзер@localhost;
|
||||
grant select on test.* to юзер_юзер@localhost;
|
||||
--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
|
||||
revoke all on test.* from юзер_юзер@localhost;
|
||||
drop user юзер_юзер@localhost;
|
||||
|
||||
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
select database();
|
||||
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -153,4 +153,14 @@ DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #21392: multi-table delete with alias table name fails with
|
||||
# 1003: Incorrect table name
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
|
||||
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -378,4 +378,15 @@ EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug 21456: SELECT DISTINCT(x) produces incorrect results when using order by
|
||||
#
|
||||
CREATE TABLE t1 (a int primary key, b int);
|
||||
|
||||
INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
|
||||
|
||||
explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
|
||||
SELECT DISTINCT a, b FROM t1 ORDER BY b;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -617,4 +617,18 @@ SELECT MAX(b) FROM t1;
|
||||
EXPLAIN SELECT MAX(b) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #16792 query with subselect, join, and group not returning proper values
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,1),(1,2),(2,3);
|
||||
|
||||
SELECT (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
|
||||
SELECT (SELECT COUNT(DISTINCT 12)) FROM t1 GROUP BY t1.a;
|
||||
# an attempt to test all aggregate function with no table.
|
||||
SELECT AVG(2), BIT_AND(2), BIT_OR(2), BIT_XOR(2), COUNT(*), COUNT(12),
|
||||
COUNT(DISTINCT 12), MIN(2),MAX(2),STD(2), VARIANCE(2),SUM(2),
|
||||
GROUP_CONCAT(2),GROUP_CONCAT(DISTINCT 2);
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -83,4 +83,9 @@ connection default;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
#
|
||||
# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets
|
||||
#
|
||||
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
@ -341,20 +341,20 @@ drop table t1;
|
||||
#
|
||||
# Bug#16377 result of DATE/TIME functions were compared as strings which
|
||||
# can lead to a wrong result.
|
||||
#
|
||||
# Now wrong dates should be compared only with CAST()
|
||||
create table t1(f1 date, f2 time, f3 datetime);
|
||||
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
|
||||
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
|
||||
select f1 from t1 where f1 between "2006-1-1" and 20060101;
|
||||
select f1 from t1 where f1 between "2006-1-1" and "2006.1.1";
|
||||
select f1 from t1 where date(f1) between "2006-1-1" and "2006.1.1";
|
||||
select f2 from t1 where f2 between "12:1:2" and "12:2:2";
|
||||
select f2 from t1 where time(f2) between "12:1:2" and "12:2:2";
|
||||
select f3 from t1 where f3 between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
|
||||
select f3 from t1 where timestamp(f3) between "2006-1-1 12:1:1" and "2006-1-1 12:1:2";
|
||||
select f1 from t1 where "2006-1-1" between f1 and f3;
|
||||
select f1 from t1 where "2006-1-1" between date(f1) and date(f3);
|
||||
select f1 from t1 where "2006-1-1" between f1 and 'zzz';
|
||||
select f1 from t1 where f1 between CAST("2006-1-1" as date) and CAST(20060101 as date);
|
||||
select f1 from t1 where f1 between cast("2006-1-1" as date) and cast("2006.1.1" as date);
|
||||
select f1 from t1 where date(f1) between cast("2006-1-1" as date) and cast("2006.1.1" as date);
|
||||
select f2 from t1 where f2 between cast("12:1:2" as time) and cast("12:2:2" as time);
|
||||
select f2 from t1 where time(f2) between cast("12:1:2" as time) and cast("12:2:2" as time);
|
||||
select f3 from t1 where f3 between cast("2006-1-1 12:1:1" as datetime) and cast("2006-1-1 12:1:2" as datetime);
|
||||
select f3 from t1 where timestamp(f3) between cast("2006-1-1 12:1:1" as datetime) and cast("2006-1-1 12:1:2" as datetime);
|
||||
select f1 from t1 where cast("2006-1-1" as date) between f1 and f3;
|
||||
select f1 from t1 where cast("2006-1-1" as date) between date(f1) and date(f3);
|
||||
select f1 from t1 where cast("2006-1-1" as date) between f1 and 'zzz';
|
||||
select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
|
||||
select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
|
||||
drop table t1;
|
||||
@ -368,4 +368,22 @@ create table t1 select now() - now(), curtime() - curtime(),
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
#
|
||||
# Bug #19844 time_format in Union truncates values
|
||||
#
|
||||
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
|
||||
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
@ -90,3 +90,30 @@ SELECT STRAIGHT_JOIN SQL_NO_CACHE t1.b, t1.a FROM t1, t3, t2 WHERE
|
||||
t3.a = t2.a AND t2.b = t1.a AND t3.b = 1 AND t3.c IN (1, 2)
|
||||
ORDER BY t1.b LIMIT 5;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
|
||||
# BUG#21077 (The testcase is not deterministic so correct execution doesn't
|
||||
# prove anything) For proof one should track if sequence of ha_innodb::* func
|
||||
# calls is correct.
|
||||
CREATE TABLE `t1` (`id1` INT) ;
|
||||
INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
|
||||
|
||||
CREATE TABLE `t2` (
|
||||
`id1` INT,
|
||||
`id2` INT NOT NULL,
|
||||
`id3` INT,
|
||||
`id4` INT NOT NULL,
|
||||
UNIQUE (`id2`,`id4`),
|
||||
KEY (`id1`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
|
||||
(1,1,1,0),
|
||||
(1,1,2,1),
|
||||
(5,1,2,2),
|
||||
(6,1,2,3),
|
||||
(1,2,2,2),
|
||||
(1,2,1,1);
|
||||
|
||||
SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
|
||||
DROP TABLE t1, t2;
|
||||
|
@ -115,4 +115,27 @@ INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a) ;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#21555: incorrect behavior with INSERT ... ON DUPL KEY UPDATE and VALUES
|
||||
#
|
||||
|
||||
|
||||
# End of 4.1 tests
|
||||
CREATE TABLE t1
|
||||
(
|
||||
a BIGINT UNSIGNED,
|
||||
b BIGINT UNSIGNED,
|
||||
PRIMARY KEY (a)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (45, 2) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
|
||||
IF(VALUES(b) > t1.b, VALUES(b), t1.b);
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -60,4 +60,14 @@ select 1 as a from t1 union all select 1 from dual limit 1;
|
||||
(select 1 as a from t1) union all (select 1 from dual) limit 1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #21787: COUNT(*) + ORDER BY + LIMIT returns wrong result
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -770,14 +770,20 @@ connect (session2,localhost,root,,);
|
||||
|
||||
connection session1;
|
||||
disable_query_log;
|
||||
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" select 9 a;
|
||||
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 9 a;
|
||||
enable_query_log;
|
||||
# If running test suite with a non standard tmp dir, the "show create table"
|
||||
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
show create table t1;
|
||||
|
||||
connection session2;
|
||||
disable_query_log;
|
||||
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/tmp" select 99 a;
|
||||
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQL_TEST_DIR/var/log" select 99 a;
|
||||
enable_query_log;
|
||||
# If running test suite with a non standard tmp dir, the "show create table"
|
||||
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
show create table t1;
|
||||
|
||||
connection default;
|
||||
|
@ -29,7 +29,7 @@
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
|
||||
|
||||
#
|
||||
# Bug #20328: mysql client interprets commands in comments
|
||||
# Bug #20328: mysql client: dumb about trailing spaces on 'help' command
|
||||
#
|
||||
--exec echo 'help' | $MYSQL
|
||||
--exec echo 'help ' | $MYSQL
|
||||
--exec echo 'help' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp
|
||||
--exec echo 'help ' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp
|
||||
|
@ -694,4 +694,12 @@ create table t3(a int);
|
||||
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
|
||||
drop table t1, t2, t3;
|
||||
|
||||
#
|
||||
# Bug #21288: mysqldump segmentation fault when using --where
|
||||
#
|
||||
create table t1 (a int);
|
||||
--error 2
|
||||
--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
|
||||
drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
@ -1861,4 +1861,54 @@ select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
|
||||
select * from t1 where (s1 = ALL (select s1/s1 from t1));
|
||||
select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #16255: Subquery in where
|
||||
#
|
||||
create table t1 (
|
||||
retailerID varchar(8) NOT NULL,
|
||||
statusID int(10) unsigned NOT NULL,
|
||||
changed datetime NOT NULL,
|
||||
UNIQUE KEY retailerID (retailerID, statusID, changed)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
|
||||
INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
|
||||
INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
|
||||
INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
|
||||
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
|
||||
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
|
||||
|
||||
select * from t1 r1
|
||||
where (r1.retailerID,(r1.changed)) in
|
||||
(SELECT r2.retailerId,(max(changed)) from t1 r2
|
||||
group by r2.retailerId);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #21180: Subselect with index for both WHERE and ORDER BY
|
||||
# produces empty result
|
||||
#
|
||||
create table t1(a int, primary key (a));
|
||||
insert into t1 values (10);
|
||||
|
||||
create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
|
||||
insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
|
||||
|
||||
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
|
||||
|
||||
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
|
||||
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
|
||||
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -36,8 +36,8 @@ INSERT INTO t1 VALUES ( "2000-1-2" );
|
||||
INSERT INTO t1 VALUES ( "2000-1-3" );
|
||||
INSERT INTO t1 VALUES ( "2000-1-4" );
|
||||
INSERT INTO t1 VALUES ( "2000-1-5" );
|
||||
SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND "2000-1-4";
|
||||
SELECT * FROM t1 WHERE datum BETWEEN "2000-1-2" AND datum - INTERVAL 100 DAY;
|
||||
SELECT * FROM t1 WHERE datum BETWEEN cast("2000-1-2" as date) AND cast("2000-1-4" as date);
|
||||
SELECT * FROM t1 WHERE datum BETWEEN cast("2000-1-2" as date) AND datum - INTERVAL 100 DAY;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
@ -115,4 +115,11 @@ INSERT INTO t1 VALUES ('abc');
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#21677: Wrong result when comparing a DATE and a DATETIME in BETWEEN
|
||||
#
|
||||
create table t1(start_date date, end_date date);
|
||||
insert into t1 values ('2000-01-01','2000-01-02');
|
||||
select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
|
Reference in New Issue
Block a user