summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2004-04-28 19:27:56 +0400
committerunknown <sergefp@mysql.com>2004-04-28 19:27:56 +0400
commit2902f9e8a57ca76cc52863d70d02dcf7693ce8cd (patch)
tree4864372894fc29ff2e4d9de93f2c438b29184acb /mysql-test
parent15e207b0e7d1cd010b9e0eea4663c98e1eb209de (diff)
parent5605374b668068ef5ede826b3d04e2fe7ead4f9f (diff)
downloadmariadb-git-2902f9e8a57ca76cc52863d70d02dcf7693ce8cd.tar.gz
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge sql/lex.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/have_ndb.inc4
-rw-r--r--mysql-test/install_test_db.sh3
-rw-r--r--mysql-test/mysql-test-run.sh9
-rwxr-xr-xmysql-test/ndb/install_ndbcluster12
-rw-r--r--mysql-test/r/func_group.result119
-rw-r--r--mysql-test/r/have_ndb.require2
-rw-r--r--mysql-test/r/mysqldump.result76
-rw-r--r--mysql-test/r/ndb_basic.result82
-rw-r--r--mysql-test/r/show_check.result16
-rw-r--r--mysql-test/std_data/init_file.dat2
-rw-r--r--mysql-test/t/func_group.test68
-rw-r--r--mysql-test/t/mysqldump.test42
-rw-r--r--mysql-test/t/ndb_basic.test98
13 files changed, 383 insertions, 150 deletions
diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc
new file mode 100644
index 00000000000..095c2dcaaa4
--- /dev/null
+++ b/mysql-test/include/have_ndb.inc
@@ -0,0 +1,4 @@
+-- require r/have_ndb.require
+disable_query_log;
+show variables like "have_ndbcluster";
+enable_query_log;
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
index ac5435f9832..8db338f0f58 100644
--- a/mysql-test/install_test_db.sh
+++ b/mysql-test/install_test_db.sh
@@ -77,7 +77,8 @@ EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/ch
fi
mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
- --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $EXTRA_ARG"
+ --basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --skip-bdb \
+ $EXTRA_ARG"
echo "running $mysqld_boot"
if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index f47c63160eb..36f11220862 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -244,9 +244,9 @@ while test $# -gt 0; do
--local) USE_RUNNING_SERVER="" ;;
--extern) USE_RUNNING_SERVER="1" ;;
--with-ndbcluster)
- USE_NDBCLUSTER="--with-ndbcluster" ;;
+ USE_NDBCLUSTER="--ndbcluster" ;;
--ndbconnectstring=*)
- USE_NDBCLUSTER="--with-ndbcluster" ;
+ USE_NDBCLUSTER="--ndbcluster" ;
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndbconnectstring=;;"` ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--local-master)
@@ -1040,7 +1040,7 @@ start_slave()
--core --init-rpl-role=slave \
--tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \
- --skip-innodb --skip-slave-start \
+ --skip-innodb --skip-ndbcluster --skip-slave-start \
--slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
--report-host=127.0.0.1 --report-user=root \
--report-port=$slave_port \
@@ -1421,6 +1421,7 @@ then
fi
# Remove files that can cause problems
+ $RM -rf $MYSQL_TEST_DIR/var/ndbcluster
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
# Remove old berkeley db log files that can confuse the server
@@ -1436,7 +1437,7 @@ then
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
echo "Starting ndbcluster"
- ./ndb/install_ndbcluster --initial --data-dir=$MASTER_MYDDIR || exit 1
+ ./ndb/install_ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
export NDB_CONNECTSTRING=`cat Ndb.cfg`
else
export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
diff --git a/mysql-test/ndb/install_ndbcluster b/mysql-test/ndb/install_ndbcluster
index dab94db759e..6cb3985b831 100755
--- a/mysql-test/ndb/install_ndbcluster
+++ b/mysql-test/ndb/install_ndbcluster
@@ -64,12 +64,12 @@ start_default_ndbcluster() {
NDB_CONNECTSTRING=
if [ $initial_ndb ] ; then
- mkdir $fs_ndb
- mkdir $fs_mgm_1
- mkdir $fs_ndb_2
- mkdir $fs_ndb_3
- mkdir $fs_name_2
- mkdir $fs_name_3
+ [ -d $fs_ndb ] || mkdir $fs_ndb
+ [ -d $fs_mgm_1 ] || mkdir $fs_mgm_1
+ [ -d $fs_ndb_2 ] || mkdir $fs_ndb_2
+ [ -d $fs_ndb_3 ] || mkdir $fs_ndb_3
+ [ -d $fs_name_2 ] || mkdir $fs_name_2
+ [ -d $fs_name_3 ] || mkdir $fs_name_3
fi
if [ -d "$fs_ndb" -a -d "$fs_mgm_1" -a -d "$fs_ndb_2" -a -d "$fs_ndb_3" -a -d "$fs_name_2" -a -d "$fs_name_3" ]; then :; else
echo "$fs_ndb filesystem directory does not exist"
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 147d7776e4d..5192251795b 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -221,6 +221,68 @@ select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
max(t1.a2) max(t2.a1)
zzz BBB
drop table t1,t2;
+CREATE TABLE t1 (a int, b int);
+select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
+count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
+0 NULL NULL NULL NULL NULL 18446744073709551615 0
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
+insert into t1 values (1,null);
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+insert into t1 values (1,null);
+insert into t1 values (2,null);
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+insert into t1 values (2,1);
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 1 1 1.0000 0.0000 1 1 1 1
+select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 1 1 1.0000 0.0000 1 1 1 1
+insert into t1 values (3,1);
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 1 1 1.0000 0.0000 1 1 1 1
+3 1 1 1.0000 0.0000 1 1 1 1
+select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
+a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
+2 1 1 1.0000 0.0000 1 1 1 1 1
+3 1 1 1.0000 0.0000 1 1 1 1 1
+explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
+Warnings:
+Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
+drop table t1;
+create table t1 (col int);
+insert into t1 values (-1), (-2), (-3);
+select bit_and(col), bit_or(col) from t1;
+bit_and(col) bit_or(col)
+18446744073709551612 18446744073709551615
+select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
+bit_and(col) bit_or(col)
+18446744073709551613 18446744073709551613
+18446744073709551614 18446744073709551614
+18446744073709551615 18446744073709551615
+drop table t1;
+create table t1 (a int);
+select avg(2) from t1;
+avg(2)
+NULL
+drop table t1;
create table t1(
a1 char(3) primary key,
a2 smallint,
@@ -562,52 +624,6 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
1 SIMPLE t1 index NULL PRIMARY 3 NULL 14 Using index
drop table t1, t2;
-CREATE TABLE t1 (a int, b int);
-select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
-count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-0 NULL NULL NULL NULL NULL 18446744073709551615 0
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-insert into t1 values (1,null);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-insert into t1 values (1,null);
-insert into t1 values (2,null);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-insert into t1 values (2,1);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-2 1 1 1.0000 0.0000 1 1 1 1
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-2 1 1 1.0000 0.0000 1 1 1 1
-insert into t1 values (3,1);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
-2 1 1 1.0000 0.0000 1 1 1 1
-3 1 1 1.0000 0.0000 1 1 1 1
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
-a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
-1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
-2 1 1 1.0000 0.0000 1 1 1 1 1
-3 1 1 1.0000 0.0000 1 1 1 1 1
-explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
-Warnings:
-Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
-drop table t1;
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
insert into t1 values (1, 3);
select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
@@ -632,14 +648,3 @@ select a from t1 having a=1;
a
1
drop table t1;
-create table t1 (col int);
-insert into t1 values (-1), (-2), (-3);
-select bit_and(col), bit_or(col) from t1;
-bit_and(col) bit_or(col)
-18446744073709551612 18446744073709551615
-select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
-bit_and(col) bit_or(col)
-18446744073709551613 18446744073709551613
-18446744073709551614 18446744073709551614
-18446744073709551615 18446744073709551615
-drop table t1;
diff --git a/mysql-test/r/have_ndb.require b/mysql-test/r/have_ndb.require
new file mode 100644
index 00000000000..f0402b72c6a
--- /dev/null
+++ b/mysql-test/r/have_ndb.require
@@ -0,0 +1,2 @@
+Variable_name Value
+have_ndbcluster YES
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index b0a15d9a021..01114104088 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -21,6 +21,38 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
+CREATE TABLE `t1` (
+ `a` decimal(240,20) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000');
+DROP TABLE t1;
+CREATE TABLE t1 (a double);
+INSERT INTO t1 VALUES (-9e999999);
+CREATE TABLE `t1` (
+ `a` double default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES (RES);
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+ERROR 42S22: Unknown column '1.2345' in 'field list'
+SET SQL_MODE=@OLD_SQL_MODE;
+CREATE TABLE `t1` (
+ `a` decimal(10,5) default NULL,
+ `b` float default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
+CREATE TABLE `t1` (
+ `a` decimal(10,5) default NULL,
+ `b` float default NULL
+);
+INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
@@ -28,13 +60,14 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` decimal(240,20) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+ `a` decimal(10,5) default NULL,
+ `b` float default NULL
+);
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
-INSERT INTO `t1` VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
+INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
@@ -43,30 +76,19 @@ UNLOCK TABLES;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-DROP TABLE t1;
-CREATE TABLE t1 (a double);
-INSERT INTO t1 VALUES (-9e999999);
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=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" */;
-DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
- `a` double default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
+ `a` decimal(10,5) default NULL,
+ `b` float default NULL
+);
-/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-LOCK TABLES `t1` WRITE;
-INSERT INTO `t1` VALUES (RES);
-UNLOCK TABLES;
-/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!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 */;
DROP TABLE t1;
CREATE TABLE t1(a int, b text, c varchar(3));
@@ -180,27 +202,9 @@ UNLOCK TABLES;
DROP TABLE t1;
create table ```a` (i int);
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=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" */;
-DROP TABLE IF EXISTS ```a`;
CREATE TABLE ```a` (
`i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-
-/*!40000 ALTER TABLE ```a` DISABLE KEYS */;
-LOCK TABLES ```a` WRITE;
-UNLOCK TABLES;
-/*!40000 ALTER TABLE ```a` ENABLE KEYS */;
-
-/*!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 */;
-
drop table ```a`;
create table t1(a int);
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
new file mode 100644
index 00000000000..ac550937146
--- /dev/null
+++ b/mysql-test/r/ndb_basic.result
@@ -0,0 +1,82 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (9410,9412);
+SELECT pk1 FROM t1;
+pk1
+9410
+SELECT * FROM t1;
+pk1 attr1
+9410 9412
+SELECT t1.* FROM t1;
+pk1 attr1
+9410 9412
+UPDATE t1 SET attr1=1 WHERE pk1=9410;
+SELECT * FROM t1;
+pk1 attr1
+9410 1
+UPDATE t1 SET pk1=2 WHERE attr1=1;
+ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
+SELECT * FROM t1;
+pk1 attr1
+9410 1
+DELETE FROM t1;
+SELECT * FROM t1;
+pk1 attr1
+INSERT INTO t1 VALUES (9410,9412);
+DELETE FROM t1 WHERE pk1 = 9410;
+SELECT * FROM t1;
+pk1 attr1
+INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765);
+DELETE FROM t1;
+SELECT * FROM t1;
+pk1 attr1
+INSERT INTO t1 values (1, 4), (2, 4), (3, 5), (4, 4), (5, 5);
+DELETE FROM t1 WHERE attr1=4;
+SELECT * FROM t1 order by pk1;
+pk1 attr1
+3 5
+5 5
+DELETE FROM t1;
+INSERT INTO t1 VALUES (9410,9412), (9411, 9413);
+DELETE FROM t1 WHERE pk1 = 9410;
+SELECT * FROM t1;
+pk1 attr1
+9411 9413
+DROP TABLE t1;
+CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
+INSERT INTO t1 values(3456, 7890);
+SELECT * FROM t1;
+id id2
+3456 7890
+UPDATE t1 SET id=2 WHERE id2=12;
+SELECT * FROM t1;
+id id2
+3456 7890
+UPDATE t1 SET id=1234 WHERE id2=7890;
+SELECT * FROM t1;
+id id2
+1234 7890
+DELETE FROM t1;
+INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890);
+SELECT * FROM t1;
+id id2
+3456 7890
+3456 7890
+3456 7890
+DELETE FROM t1 WHERE id = 3456;
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL
+) ENGINE=NDBCLUSTER;
+INSERT INTO t1 values(1, 9999);
+DROP TABLE t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+attr1 INT NOT NULL
+) ENGINE=NDB;
+INSERT INTO t1 values(1, 9999);
+DROP TABLE t1;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index b54d4b5a342..c462a88ac1b 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -43,7 +43,7 @@ wait_timeout 28800
show variables like "this_doesn't_exists%";
Variable_name Value
show table status from test like "this_doesn't_exists%";
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+Name Engine Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
show databases;
Database
mysql
@@ -309,7 +309,7 @@ insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1,1),(2,2);
show table status;
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+Name Engine Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 2 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 2 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 2 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
@@ -317,7 +317,7 @@ insert into t1 values (3),(4);
insert into t2 values (3),(4);
insert into t3 values (3,3),(4,4);
show table status;
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+Name Engine Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 4 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 4 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 4 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
@@ -325,7 +325,7 @@ insert into t1 values (5);
insert into t2 values (5);
insert into t3 values (5,5);
show table status;
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+Name Engine Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 5 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 5 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 5 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
@@ -333,7 +333,7 @@ delete from t1 where a=3;
delete from t2 where b=3;
delete from t3 where a=3;
show table status;
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+Name Engine Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 4 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 4 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 4 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
@@ -341,7 +341,7 @@ delete from t1;
delete from t2;
delete from t3;
show table status;
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+Name Engine Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 0 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
@@ -349,7 +349,7 @@ insert into t1 values (5);
insert into t2 values (5);
insert into t3 values (5,5);
show table status;
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+Name Engine Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 1 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 1 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 1 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
@@ -357,7 +357,7 @@ delete from t1 where a=5;
delete from t2 where b=5;
delete from t3 where a=5;
show table status;
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+Name Engine Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t2 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
t3 HEAP Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
diff --git a/mysql-test/std_data/init_file.dat b/mysql-test/std_data/init_file.dat
index 4236ada1142..6105ca2ac1b 100644
--- a/mysql-test/std_data/init_file.dat
+++ b/mysql-test/std_data/init_file.dat
@@ -1 +1 @@
-select * from mysql.user as t1, mysql.user as t2, mysql.user as t3, mysql.user as t4, mysql.user as t5, mysql.user as t6, mysql.user as t7, mysql.user as t8; \ No newline at end of file
+select * from mysql.user as t1, mysql.user as t2, mysql.user as t3;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 2bd4838f934..a1acf5f89eb 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -135,6 +135,45 @@ select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
drop table t1,t2;
#
+# Test of group function and NULL values
+#
+
+CREATE TABLE t1 (a int, b int);
+select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+insert into t1 values (1,null);
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+insert into t1 values (1,null);
+insert into t1 values (2,null);
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+insert into t1 values (2,1);
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+insert into t1 values (3,1);
+select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
+select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
+explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
+drop table t1;
+
+#
+# Bug #1972: test for bit_and(), bit_or() and negative values
+#
+create table t1 (col int);
+insert into t1 values (-1), (-2), (-3);
+select bit_and(col), bit_or(col) from t1;
+select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
+drop table t1;
+
+#
+# Bug #3376: avg() and an empty table
+#
+
+create table t1 (a int);
+select avg(2) from t1;
+drop table t1;
+
+#
# Tests to check MIN/MAX query optimization
#
@@ -327,27 +366,6 @@ explain
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
drop table t1, t2;
-#
-# Test of group function and NULL values
-#
-
-CREATE TABLE t1 (a int, b int);
-select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-insert into t1 values (1,null);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-insert into t1 values (1,null);
-insert into t1 values (2,null);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-insert into t1 values (2,1);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-insert into t1 values (3,1);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
-explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
-drop table t1;
--disable_warnings
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
--enable_warnings
@@ -369,11 +387,3 @@ insert into t1 values (1);
select max(a) as b from t1 having b=1;
select a from t1 having a=1;
drop table t1;
-#
-# Bug #1972: test for bit_and(), bit_or() and negative values
-#
-create table t1 (col int);
-insert into t1 values (-1), (-2), (-3);
-select bit_and(col), bit_or(col) from t1;
-select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
-drop table t1;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 28992655bd2..bcfe81dc95f 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -6,7 +6,7 @@ DROP TABLE IF EXISTS t1, `"t"1`;
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
---exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
+--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1;
#
@@ -16,7 +16,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
---exec $MYSQL_DUMP --skip-comments test t1
+--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;
#
@@ -28,12 +28,38 @@ INSERT INTO t1 VALUES (-9e999999);
# The following replaces is here because some systems replaces the above
# double with '-inf' and others with MAX_DOUBLE
--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
---exec $MYSQL_DUMP --skip-comments test t1
+--exec $MYSQL_DUMP --compact test t1
+DROP TABLE t1;
+
+#
+# Bug #3361 mysqldump quotes DECIMAL values inconsistently
+#
+
+CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
+
+# check at first how mysql work with quoted decimal
+
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+--error 1054
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+SET SQL_MODE=@OLD_SQL_MODE;
+
+# check how mysqldump make quoting
+--exec $MYSQL_DUMP --compact test t1
+--exec $MYSQL_DUMP --compact --skip-create test t1
+--exec $MYSQL_DUMP --skip-create --skip-comments test t1
+--exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments test t1
DROP TABLE t1;
CREATE TABLE t1(a int, b text, c varchar(3));
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
---exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
+--exec $MYSQL_DUMP --skip-create --compact -X test t1
DROP TABLE t1;
#
@@ -42,7 +68,7 @@ DROP TABLE t1;
CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2");
---exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
+--exec $MYSQL_DUMP --compact --skip-create -X test t1
DROP TABLE t1;
#
@@ -51,7 +77,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
---exec $MYSQL_DUMP --skip-comments test t1
+--exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1;
#
@@ -65,11 +91,11 @@ INSERT INTO t1 VALUES (1), (2);
DROP TABLE t1;
#
-# Bug #2592 'mysqldum doesn't quote "tricky" names correctly'
+# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
#
create table ```a` (i int);
---exec $MYSQL_DUMP --skip-comments test
+--exec $MYSQL_DUMP --compact test
drop table ```a`;
#
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
new file mode 100644
index 00000000000..d03abc34633
--- /dev/null
+++ b/mysql-test/t/ndb_basic.test
@@ -0,0 +1,98 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# Basic test to show that the NDB
+# table handler is working
+#
+
+#
+# Create a normal table with primary key
+#
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL
+) ENGINE=ndbcluster;
+
+INSERT INTO t1 VALUES (9410,9412);
+
+SELECT pk1 FROM t1;
+SELECT * FROM t1;
+SELECT t1.* FROM t1;
+
+UPDATE t1 SET attr1=1 WHERE pk1=9410;
+SELECT * FROM t1;
+
+# Can't UPDATE PK! Test that correct error is returned
+-- error 1112
+UPDATE t1 SET pk1=2 WHERE attr1=1;
+SELECT * FROM t1;
+
+# Delete the record
+DELETE FROM t1;
+SELECT * FROM t1;
+
+# Delete the record by specifying pk
+INSERT INTO t1 VALUES (9410,9412);
+DELETE FROM t1 WHERE pk1 = 9410;
+SELECT * FROM t1;
+
+# Insert three records and delete the
+INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765);
+DELETE FROM t1;
+SELECT * FROM t1;
+
+# Insert three records with attr1=4 and two with attr1=5
+# Delete all with attr1=4
+INSERT INTO t1 values (1, 4), (2, 4), (3, 5), (4, 4), (5, 5);
+DELETE FROM t1 WHERE attr1=4;
+SELECT * FROM t1 order by pk1;
+DELETE FROM t1;
+
+# Insert two records and delete one
+INSERT INTO t1 VALUES (9410,9412), (9411, 9413);
+DELETE FROM t1 WHERE pk1 = 9410;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Create table without primary key
+# a hidden primary key column is created by handler
+#
+CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
+INSERT INTO t1 values(3456, 7890);
+SELECT * FROM t1;
+UPDATE t1 SET id=2 WHERE id2=12;
+SELECT * FROM t1;
+UPDATE t1 SET id=1234 WHERE id2=7890;
+SELECT * FROM t1;
+DELETE FROM t1;
+
+INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890);
+SELECT * FROM t1;
+DELETE FROM t1 WHERE id = 3456;
+
+DROP TABLE t1;
+
+# test create with the keyword "engine=NDBCLUSTER"
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL
+) ENGINE=NDBCLUSTER;
+
+INSERT INTO t1 values(1, 9999);
+
+DROP TABLE t1;
+
+# test create with the keyword "engine=NDB"
+CREATE TABLE t1 (
+ pk1 INT NOT NULL PRIMARY KEY,
+ attr1 INT NOT NULL
+) ENGINE=NDB;
+
+INSERT INTO t1 values(1, 9999);
+
+DROP TABLE t1;