summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-12-04 19:06:42 +0100
committerunknown <msvensson@neptunus.(none)>2006-12-04 19:06:42 +0100
commitc0612e453e3364255a1f88c7f3ac4849fb8965df (patch)
treed1ad41db4406b4986f9f3b7475df088707a265be /mysql-test
parent33fc8d50640ddfbece9142126ee5909139a57bf3 (diff)
parent0184996b991dbb0d27e8a709894db0109f539a8d (diff)
downloadmariadb-git-c0612e453e3364255a1f88c7f3ac4849fb8965df.tar.gz
Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-4.1-maint Makefile.am: Auto merged client/mysqltest.c: Auto merged mysql-test/lib/mtr_process.pl: Auto merged mysql-test/mysql-test-run.pl: Auto merged sql/mysqld.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/lib/mtr_process.pl2
-rwxr-xr-xmysql-test/mysql-test-run.pl1
-rw-r--r--mysql-test/r/func_in.result8
-rw-r--r--mysql-test/r/ps.result101
-rw-r--r--mysql-test/t/func_in.test22
-rw-r--r--mysql-test/t/ps.test57
6 files changed, 107 insertions, 84 deletions
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 37a82177f46..cf0dc0dc6f8 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -1052,7 +1052,7 @@ sub sleep_until_file_created ($$$) {
# Print extra message every 60 seconds
my $seconds= ($loop * $sleeptime) / 1000;
- if ( $seconds > 1 and int($seconds) % 60 == 0 )
+ if ( $seconds > 1 and int($seconds * 10) % 600 == 0 )
{
my $left= $timeout - $seconds;
mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 7ed84f9cc3f..5002f778da5 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -63,7 +63,6 @@ use Getopt::Long;
use Sys::Hostname;
use IO::Socket;
use IO::Socket::INET;
-use Data::Dumper;
use strict;
use warnings;
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 3cf2afc83d1..f74c63f7260 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -202,3 +202,11 @@ select count(*) from t1 where id not in (1,2);
count(*)
1
drop table t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 SELECT 1 IN (2, NULL);
+SELECT should return NULL.
+SELECT * FROM t1;
+1 IN (2, NULL)
+NULL
+DROP TABLE t1;
+End of 4.1 tests
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 2bb5df6e6cf..94c51fdc18b 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -775,12 +775,12 @@ set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
show variables like 'max_prepared_stmt_count';
Variable_name Value
max_prepared_stmt_count 16382
-show variables like 'prepared_stmt_count';
+show status like 'prepared_stmt_count';
Variable_name Value
-prepared_stmt_count 0
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
-@@max_prepared_stmt_count @@prepared_stmt_count
-16382 0
+Prepared_stmt_count 0
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
+16382
set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
@@ -799,67 +799,70 @@ set max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
-set local prepared_stmt_count=0;
-ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
-set @@prepared_stmt_count=0;
-ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
-set global prepared_stmt_count=1;
-ERROR 42000: Incorrect argument type to variable 'prepared_stmt_count'
set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1
set global max_prepared_stmt_count=0;
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
-@@max_prepared_stmt_count @@prepared_stmt_count
-0 0
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
+0
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 0
prepare stmt from "select 1";
ERROR HY000: Unknown error
-select @@prepared_stmt_count;
-@@prepared_stmt_count
-0
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 0
set global max_prepared_stmt_count=1;
prepare stmt from "select 1";
-select @@prepared_stmt_count;
-@@prepared_stmt_count
-1
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 1
prepare stmt1 from "select 1";
ERROR HY000: Unknown error
-select @@prepared_stmt_count;
-@@prepared_stmt_count
-1
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 1
deallocate prepare stmt;
-select @@prepared_stmt_count;
-@@prepared_stmt_count
-0
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 0
prepare stmt from "select 1";
-select @@prepared_stmt_count;
-@@prepared_stmt_count
-1
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 1
prepare stmt from "select 2";
-select @@prepared_stmt_count;
-@@prepared_stmt_count
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 1
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 1
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
1
-select @@prepared_stmt_count, @@max_prepared_stmt_count;
-@@prepared_stmt_count @@max_prepared_stmt_count
-1 1
set global max_prepared_stmt_count=0;
prepare stmt from "select 1";
ERROR HY000: Unknown error
execute stmt;
ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE
-select @@prepared_stmt_count;
-@@prepared_stmt_count
-0
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 0
prepare stmt from "select 1";
ERROR HY000: Unknown error
-select @@prepared_stmt_count;
-@@prepared_stmt_count
-0
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 0
set global max_prepared_stmt_count=3;
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
-@@max_prepared_stmt_count @@prepared_stmt_count
-3 0
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
+3
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 0
prepare stmt from "select 1";
prepare stmt from "select 2";
prepare stmt1 from "select 3";
@@ -867,13 +870,13 @@ prepare stmt2 from "select 4";
ERROR HY000: Unknown error
prepare stmt2 from "select 4";
ERROR HY000: Unknown error
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
-@@max_prepared_stmt_count @@prepared_stmt_count
-3 3
+select @@max_prepared_stmt_count;
+@@max_prepared_stmt_count
+3
+show status like 'prepared_stmt_count';
+Variable_name Value
+Prepared_stmt_count 3
deallocate prepare stmt;
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
-@@max_prepared_stmt_count @@prepared_stmt_count
-3 0
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
drop table if exists t1;
create temporary table if not exists t1 (a1 int);
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 2ffe5a2d5f7..ffed2aac2a0 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -109,4 +109,24 @@ select count(*) from t1 where id not in (1);
select count(*) from t1 where id not in (1,2);
drop table t1;
-# End of 4.1 tests
+
+#
+# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
+# result
+#
+# The problem was in the IN() function that ignored maybe_null flags
+# of all arguments except the first (the one _before_ the IN
+# keyword, '1' in the test case below).
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 SELECT 1 IN (2, NULL);
+--echo SELECT should return NULL.
+SELECT * FROM t1;
+
+DROP TABLE t1;
+
+
+--echo End of 4.1 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 5b488ae4393..fbeaaa494e0 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -811,6 +811,9 @@ drop table t1;
# Bug#16365 Prepared Statements: DoS with too many open statements
# Check that the limit @@max_prpeared_stmt_count works.
#
+# This is also the test for bug#23159 prepared_stmt_count should be
+# status variable.
+#
# Save the old value
set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
#
@@ -820,17 +823,17 @@ set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
#
--disable_ps_protocol
#
-# A. Check that the new variables are present in SHOW VARIABLES list.
+# A. Check that the new variables are present in SHOW VARIABLES and
+# SHOW STATUS lists.
#
show variables like 'max_prepared_stmt_count';
-show variables like 'prepared_stmt_count';
+show status like 'prepared_stmt_count';
#
-# B. Check that the new variables are selectable.
+# B. Check that the new system variable is selectable.
#
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
+select @@max_prepared_stmt_count;
#
-# C. Check that max_prepared_stmt_count is settable (global only),
-# whereas prepared_stmt_count is readonly.
+# C. Check that max_prepared_stmt_count is settable (global only).
#
set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count;
@@ -844,12 +847,6 @@ set @@max_prepared_stmt_count=1;
set max_prepared_stmt_count=1;
--error 1229 # ER_GLOBAL_VARIABLE
set local max_prepared_stmt_count=1;
---error 1229 # ER_GLOBAL_VARIABLE
-set local prepared_stmt_count=0;
---error 1229 # ER_GLOBAL_VARIABLE
-set @@prepared_stmt_count=0;
---error 1232 # ER_WRONG_TYPE_FOR_VAR
-set global prepared_stmt_count=1;
# set to a reasonable limit works
set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count;
@@ -857,47 +854,50 @@ select @@max_prepared_stmt_count;
# D. Check that the variables actually work.
#
set global max_prepared_stmt_count=0;
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
+select @@max_prepared_stmt_count;
+show status like 'prepared_stmt_count';
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
-select @@prepared_stmt_count;
+show status like 'prepared_stmt_count';
set global max_prepared_stmt_count=1;
prepare stmt from "select 1";
-select @@prepared_stmt_count;
+show status like 'prepared_stmt_count';
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt1 from "select 1";
-select @@prepared_stmt_count;
+show status like 'prepared_stmt_count';
deallocate prepare stmt;
-select @@prepared_stmt_count;
+show status like 'prepared_stmt_count';
#
# E. Check that we can prepare a statement with the same name
# successfully, without hitting the limit.
#
prepare stmt from "select 1";
-select @@prepared_stmt_count;
+show status like 'prepared_stmt_count';
prepare stmt from "select 2";
-select @@prepared_stmt_count;
+show status like 'prepared_stmt_count';
#
# F. We can set the max below the current count. In this case no new
# statements should be allowed to prepare.
#
-select @@prepared_stmt_count, @@max_prepared_stmt_count;
+show status like 'prepared_stmt_count';
+select @@max_prepared_stmt_count;
set global max_prepared_stmt_count=0;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
# Result: the old statement is deallocated, the new is not created.
--error 1243 # ER_UNKNOWN_STMT_HANDLER
execute stmt;
-select @@prepared_stmt_count;
+show status like 'prepared_stmt_count';
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt from "select 1";
-select @@prepared_stmt_count;
+show status like 'prepared_stmt_count';
#
# G. Show that the variables are up to date even after a connection with all
# statements in it was terminated.
#
set global max_prepared_stmt_count=3;
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
+select @@max_prepared_stmt_count;
+show status like 'prepared_stmt_count';
prepare stmt from "select 1";
connect (con1,localhost,root,,);
connection con1;
@@ -908,18 +908,11 @@ prepare stmt2 from "select 4";
connection default;
--error 1105 # ER_UNKNOWN_ERROR
prepare stmt2 from "select 4";
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
+select @@max_prepared_stmt_count;
+show status like 'prepared_stmt_count';
disconnect con1;
connection default;
-# Wait for the connection to die: deal with a possible race
deallocate prepare stmt;
-let $count= `select @@prepared_stmt_count`;
-if ($count)
-{
---sleep 2
- let $count= `select @@prepared_stmt_count`;
-}
-select @@max_prepared_stmt_count, @@prepared_stmt_count;
#
# Restore the old value.
#