Commit 6a8945e3 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into neptunus.(none):/home/msvensson/mysql/mysql-4.1


sql/sql_base.cc:
  Auto merged
parents 406673b0 31d07866
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -2,8 +2,17 @@ This directory contains a test suite for mysql daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it.

If you want to run the test with a running MySQL server use the --external
option to mysql-test-run.
If you want to run a test with a running MySQL server use the --extern
option to mysql-test-run. Please note that in this mode the test suite
expects user to specify test names to run. Otherwise it falls back to the
normal "non-extern" behaviour. The reason is that some tests
could not run with external server. Here is the sample command
to test "alias" and "analyze" tests on external server:

mysql-test-run --extern alias analyze

To match your setup you might also need to provide --socket, --user and
other relevant options.

Note that you do not have to have to do make install, and you could
actually have a co-existing MySQL installation - the tests will not
+12 −4
Original line number Diff line number Diff line
@@ -772,7 +772,8 @@ sub executable_setup () {
  {
    if ( $glob_win32 )
    {
      $path_client_bindir= mtr_path_exists("$glob_basedir/client_release");
      $path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
                                           "$glob_basedir/bin");
      $exe_mysqld=         mtr_exe_exists ("$path_client_bindir/mysqld-nt");
      $path_language=      mtr_path_exists("$glob_basedir/share/english/");
      $path_charsetsdir=   mtr_path_exists("$glob_basedir/share/charsets");
@@ -794,7 +795,7 @@ sub executable_setup () {
    }
    else
    {
      $exe_mysqltest=  mtr_exe_exists("$glob_basedir/client/mysqltest");
      $exe_mysqltest=  mtr_exe_exists("$path_client_bindir/mysqltest");
      $exe_mysql_client_test=
        mtr_exe_exists("$glob_basedir/tests/mysql_client_test");
    }
@@ -2013,6 +2014,14 @@ sub run_mysqltest ($$) {
    "--port=$master->[0]->{'path_myport'} " .
    "--socket=$master->[0]->{'path_mysock'}";

  if ( $glob_use_embedded_server )
  {
    $cmdline_mysql_client_test.=
      " -A --language=$path_language" .
      " -A --datadir=$slave->[0]->{'path_myddir'}" .
      " -A --character-sets-dir=$path_charsetsdir";
  }

  my $cmdline_mysql_fix_system_tables=
    "$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " .
    "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
@@ -2129,8 +2138,7 @@ sub run_mysqltest ($$) {
#
##############################################################################

sub usage ($)
{
sub usage ($) {
  print STDERR <<HERE;

mysql-test-run [ OPTIONS ] [ TESTCASE ]
+10 −0
Original line number Diff line number Diff line
@@ -741,3 +741,13 @@ SELECT dt DIV 1 AS f, id FROM t1 GROUP BY f;
f	id
20050501123000	1
DROP TABLE t1;
CREATE TABLE t1 (id varchar(20) NOT NULL);
INSERT INTO t1 VALUES ('trans1'), ('trans2');
CREATE TABLE t2 (id varchar(20) NOT NULL, err_comment blob NOT NULL);
INSERT INTO t2 VALUES ('trans1', 'a problem');
SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS err_comment
FROM t1 LEFT JOIN t2 ON t1.id=t2.id GROUP BY err_comment;
COUNT(DISTINCT(t1.id))	err_comment
1	NULL
1	a problem
DROP TABLE t1, t2;
+24 −0
Original line number Diff line number Diff line
@@ -625,3 +625,27 @@ select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
ID	NO	SEQ
1	1	1
drop table t1;
create table t1 (f1 int);
create table t2 (ff1 int unique, ff2 int default 1);
insert into t1 values (1),(1),(2);
insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1;
select * from t2;
ff1	ff2
1	2
2	1
drop table t1, t2;
create table t1 (a int unique);
create table t2 (a int, b int);
insert into t1 values (1),(2);
insert into t2 values (1,2);
select * from t1;
a
1
2
insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b;
select * from t1;
a
2
3
drop table t1;
drop table t2;
+124 −0
Original line number Diff line number Diff line
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;

-------- Test for BUG#9361 --------
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=MyISAM;
CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
SELECT * FROM t1 ORDER BY a;
a	b
1	0
2	0
SELECT * FROM t2 ORDER BY a;
a	b
1	0
2	1
UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
SELECT * FROM t1 ORDER BY a;
a	b
1	0
2	0
SELECT * FROM t2 ORDER BY a;
a	b
1	6
2	6
SELECT * FROM t1 ORDER BY a;
a	b
1	0
2	0
SELECT * FROM t2 ORDER BY a;
a	b
1	6
2	6
drop table t1,t2;

-------- Test 1 for BUG#9361 --------
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (
a1  char(30),
a2  int,
a3  int,
a4  char(30),
a5  char(30)
);
CREATE TABLE t2 (
b1  int,
b2  char(30)
);
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
INSERT INTO t2 VALUES (1, 'baz');
UPDATE t1 a, t2 
SET    a.a1 = 'No' 
WHERE  a.a2 = 
(SELECT  b1 
FROM    t2 
WHERE   b2 = 'baz') 
AND a.a3 IS NULL 
AND a.a4 = 'foo' 
AND a.a5 = 'bar';
SELECT * FROM t1;
a1	a2	a3	a4	a5
No	1	NULL	foo	bar
SELECT * FROM t2;
b1	b2
1	baz
DROP TABLE t1, t2;

-------- Test 2 for BUG#9361 --------
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
CREATE TABLE t1 (
i   INT,
j   INT,
x   INT,
y   INT,
z   INT
);
CREATE TABLE t2 (
i   INT,
k   INT,
x   INT,
y   INT,
z   INT
);
CREATE TABLE t3 (
j   INT,
k   INT,
x   INT,
y   INT,
z   INT
);
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
UPDATE      t1 AS a  
INNER JOIN  t2 AS b 
ON a.i = b.i
INNER JOIN  t3 AS c 
ON a.j = c.j  AND  b.k = c.k
SET         a.x = b.x, 
a.y = b.y, 
a.z = (
SELECT  sum(z) 
FROM    t3
WHERE   y = 34 
) 
WHERE       b.x = 23;
SELECT * FROM t1;
i	j	x	y	z
1	2	23	24	71
DROP TABLE t1, t2, t3;
Loading