summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.local>2006-11-02 01:08:39 +0300
committerunknown <kostja@bodhi.local>2006-11-02 01:08:39 +0300
commit2886e07d3fa72d8aac8091c581adccb7a666a411 (patch)
tree5d5deeab993fb48853f3373233849f8d87d0423a /mysql-test
parent142a4485947b6f0af2ae010e59e723584197b6a0 (diff)
parent49c9509a5f485c73b12f9f971a274e2e31624a91 (diff)
downloadmariadb-git-2886e07d3fa72d8aac8091c581adccb7a666a411.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into bodhi.local:/opt/local/work/mysql-4.1-runtime mysql-test/r/ps.result: Auto merged mysql-test/t/func_gconcat.test: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_sum.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_update.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/innodb_mysql.result16
-rw-r--r--mysql-test/r/ps.result97
-rw-r--r--mysql-test/r/rpl_insert_id.result27
-rw-r--r--mysql-test/t/func_gconcat.test2
-rw-r--r--mysql-test/t/innodb_mysql.test29
-rw-r--r--mysql-test/t/ps.test75
-rw-r--r--mysql-test/t/rpl_insert_id.test32
7 files changed, 276 insertions, 2 deletions
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index ee4c114087d..68995565752 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -104,3 +104,19 @@ SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` =
id1
2
DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t2, t1;
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
+CREATE TABLE t2 (
+i INT NOT NULL,
+FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
+) ENGINE= InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+DELETE IGNORE FROM t1 WHERE i = 1;
+Warnings:
+Error 1217 Cannot delete or update a parent row: a foreign key constraint fails
+SELECT * FROM t1, t2;
+i i
+1 1
+DROP TABLE t2, t1;
+End of 4.1 tests.
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 4abc7bb7709..2bb5df6e6cf 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -936,3 +936,100 @@ GROUP_CONCAT(Track SEPARATOR ', ')
CAD
DEALLOCATE PREPARE STMT;
DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT, INDEX(i));
+INSERT INTO t1 VALUES (1);
+PREPARE stmt FROM "SELECT (COUNT(i) = 1), COUNT(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+(COUNT(i) = 1) COUNT(i)
+0 0
+SET @a = 1;
+EXECUTE stmt USING @a;
+(COUNT(i) = 1) COUNT(i)
+1 1
+SET @a = 0;
+EXECUTE stmt USING @a;
+(COUNT(i) = 1) COUNT(i)
+0 0
+PREPARE stmt FROM "SELECT (AVG(i) = 1), AVG(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+(AVG(i) = 1) AVG(i)
+NULL NULL
+SET @a = 1;
+EXECUTE stmt USING @a;
+(AVG(i) = 1) AVG(i)
+1 1.0000
+SET @a = 0;
+EXECUTE stmt USING @a;
+(AVG(i) = 1) AVG(i)
+NULL NULL
+PREPARE stmt FROM "SELECT (VARIANCE(i) = 1), VARIANCE(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+(VARIANCE(i) = 1) VARIANCE(i)
+NULL NULL
+SET @a = 1;
+EXECUTE stmt USING @a;
+(VARIANCE(i) = 1) VARIANCE(i)
+0 0.0000
+SET @a = 0;
+EXECUTE stmt USING @a;
+(VARIANCE(i) = 1) VARIANCE(i)
+NULL NULL
+PREPARE stmt FROM "SELECT (STDDEV(i) = 1), STDDEV(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+(STDDEV(i) = 1) STDDEV(i)
+NULL NULL
+SET @a = 1;
+EXECUTE stmt USING @a;
+(STDDEV(i) = 1) STDDEV(i)
+0 0.0000
+SET @a = 0;
+EXECUTE stmt USING @a;
+(STDDEV(i) = 1) STDDEV(i)
+NULL NULL
+PREPARE stmt FROM "SELECT (BIT_OR(i) = 1), BIT_OR(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+(BIT_OR(i) = 1) BIT_OR(i)
+0 0
+SET @a = 1;
+EXECUTE stmt USING @a;
+(BIT_OR(i) = 1) BIT_OR(i)
+1 1
+SET @a = 0;
+EXECUTE stmt USING @a;
+(BIT_OR(i) = 1) BIT_OR(i)
+0 0
+PREPARE stmt FROM "SELECT (BIT_AND(i) = 1), BIT_AND(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+(BIT_AND(i) = 1) BIT_AND(i)
+0 18446744073709551615
+SET @a = 1;
+EXECUTE stmt USING @a;
+(BIT_AND(i) = 1) BIT_AND(i)
+1 1
+SET @a = 0;
+EXECUTE stmt USING @a;
+(BIT_AND(i) = 1) BIT_AND(i)
+0 18446744073709551615
+PREPARE stmt FROM "SELECT (BIT_XOR(i) = 1), BIT_XOR(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+(BIT_XOR(i) = 1) BIT_XOR(i)
+0 0
+SET @a = 1;
+EXECUTE stmt USING @a;
+(BIT_XOR(i) = 1) BIT_XOR(i)
+1 1
+SET @a = 0;
+EXECUTE stmt USING @a;
+(BIT_XOR(i) = 1) BIT_XOR(i)
+0 0
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+End of 4.1 tests.
diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result
index fbdc9dc06cf..43aba68d041 100644
--- a/mysql-test/r/rpl_insert_id.result
+++ b/mysql-test/r/rpl_insert_id.result
@@ -108,6 +108,33 @@ a
1
drop table t1;
drop table t2;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+j INT DEFAULT 0
+);
+INSERT INTO t1 VALUES (NULL, -1);
+INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
+(NULL, @@LAST_INSERT_ID);
+INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
+UPDATE t1 SET j= -1 WHERE i IS NULL;
+SELECT * FROM t1;
+i j
+1 -1
+2 1
+3 5
+4 1
+5 -1
+6 2
+SELECT * FROM t1;
+i j
+1 -1
+2 1
+3 5
+4 1
+5 -1
+6 2
+DROP TABLE t1;
#
# End of 4.1 tests
#
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index d51d88d50ef..40179ae7f38 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -98,7 +98,7 @@ select ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'withou
select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'with distinct: cutoff at length of shortname' from t1;
drop table t1;
-# check zero rows
+# check zero rows (bug#836)
create table t1(id int);
create table t2(id int);
insert into t1 values(0),(1);
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index a5fe248604f..9593982826b 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -117,3 +117,32 @@ INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
DROP TABLE t1, t2;
+
+
+#
+# BUG#18819: DELETE IGNORE hangs on foreign key parent delete
+#
+# The bug itself does not relate to InnoDB, but we have to use foreign
+# keys to reproduce it.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t2, t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
+CREATE TABLE t2 (
+ i INT NOT NULL,
+ FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
+) ENGINE= InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+DELETE IGNORE FROM t1 WHERE i = 1;
+
+SELECT * FROM t1, t2;
+
+DROP TABLE t2, t1;
+
+
+--echo End of 4.1 tests.
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 7c2a42404ad..76fcb49d598 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -951,6 +951,7 @@ execute stmt;
drop temporary table t1;
deallocate prepare stmt;
+
#
# BUG#22085: Crash on the execution of a prepared statement that
# uses an IN subquery with aggregate functions in HAVING
@@ -1003,4 +1004,76 @@ EXECUTE STMT USING @id,@id;
DEALLOCATE PREPARE STMT;
DROP TABLE t1;
-# End of 4.1 tests
+
+#
+# BUG#21354: (COUNT(*) = 1) not working in SELECT inside prepared
+# statement
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT, INDEX(i));
+INSERT INTO t1 VALUES (1);
+
+PREPARE stmt FROM "SELECT (COUNT(i) = 1), COUNT(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (AVG(i) = 1), AVG(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (VARIANCE(i) = 1), VARIANCE(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (STDDEV(i) = 1), STDDEV(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (BIT_OR(i) = 1), BIT_OR(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (BIT_AND(i) = 1), BIT_AND(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+PREPARE stmt FROM "SELECT (BIT_XOR(i) = 1), BIT_XOR(i) FROM t1 WHERE i = ?";
+SET @a = 0;
+EXECUTE stmt USING @a;
+SET @a = 1;
+EXECUTE stmt USING @a;
+SET @a = 0;
+EXECUTE stmt USING @a;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
+
+--echo End of 4.1 tests.
diff --git a/mysql-test/t/rpl_insert_id.test b/mysql-test/t/rpl_insert_id.test
index 327094a1394..7fb514fb7af 100644
--- a/mysql-test/t/rpl_insert_id.test
+++ b/mysql-test/t/rpl_insert_id.test
@@ -108,6 +108,38 @@ drop table t1;
drop table t2;
sync_slave_with_master;
+
+#
+# BUG#21726: Incorrect result with multiple invocations of
+# LAST_INSERT_ID
+#
+connection master;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (
+ i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ j INT DEFAULT 0
+);
+
+INSERT INTO t1 VALUES (NULL, -1);
+INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
+ (NULL, @@LAST_INSERT_ID);
+# Test replication of substitution "IS NULL" -> "= LAST_INSERT_ID".
+INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
+UPDATE t1 SET j= -1 WHERE i IS NULL;
+
+SELECT * FROM t1;
+
+sync_slave_with_master;
+SELECT * FROM t1;
+
+connection master;
+DROP TABLE t1;
+
+
--echo #
--echo # End of 4.1 tests
--echo #