Commit b9d37b83 authored by Martin Hansson's avatar Martin Hansson

Merge of fix for Bug#48157.

parents e57ea46d 18be529b
...@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM ...@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
# #
# When changing major version number please also check switch statement # When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version(). # in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE(mysql, 5.1.42) AM_INIT_AUTOMAKE(mysql, 5.1.43)
AM_CONFIG_HEADER([include/config.h:config.h.in]) AM_CONFIG_HEADER([include/config.h:config.h.in])
# Request support for automake silent-rules if available. # Request support for automake silent-rules if available.
...@@ -31,12 +31,14 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0 ...@@ -31,12 +31,14 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# Remember that regexps needs to quote [ and ] since this is run through m4 # Remember that regexps needs to quote [ and ] since this is run through m4
# We take some made up examples # We take some made up examples
# #
# VERSION 5.1.40sp1-alpha 5.0.34a # VERSION 5.1.40sp1-alpha 5.0.34a 5.5.1-m2
# MYSQL_NO_DASH_VERSION 5.1.40sp1 5.0.34a # MYSQL_U_SCORE_VERSION 5.1.40sp1_alpha 5.0.34a 5.5.1_m2
# MYSQL_NUMERIC_VERSION 5.1.40 5.0.34 # MYSQL_NO_DASH_VERSION 5.1.40sp1 5.0.34a 5.5.1
# MYSQL_BASE_VERSION 5.1 5.0 # MYSQL_NUMERIC_VERSION 5.1.40 5.0.34 5.5.1
# MYSQL_VERSION_ID 50140 50034 # MYSQL_BASE_VERSION 5.1 5.0 5.5
# MYSQL_VERSION_ID 50140 50034 50501
# #
MYSQL_U_SCORE_VERSION=`echo $VERSION | sed -e "s|-|_|"`
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"` MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"` MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"` MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
...@@ -73,6 +75,7 @@ romanian russian serbian slovak spanish swedish ukrainian" ...@@ -73,6 +75,7 @@ romanian russian serbian slovak spanish swedish ukrainian"
##### #####
##### #####
AC_SUBST(MYSQL_U_SCORE_VERSION)
AC_SUBST(MYSQL_NO_DASH_VERSION) AC_SUBST(MYSQL_NO_DASH_VERSION)
AC_SUBST(MYSQL_BASE_VERSION) AC_SUBST(MYSQL_BASE_VERSION)
AC_SUBST(MYSQL_VERSION_ID) AC_SUBST(MYSQL_VERSION_ID)
......
...@@ -305,6 +305,7 @@ private: ...@@ -305,6 +305,7 @@ private:
bool ValidateSignature(SignerList*); bool ValidateSignature(SignerList*);
bool ConfirmSignature(Source&); bool ConfirmSignature(Source&);
void GetKey(); void GetKey();
char* AddTag(char*, const char*, const char*, word32, word32);
void GetName(NameType); void GetName(NameType);
void GetValidity(); void GetValidity();
void GetDate(DateType); void GetDate(DateType);
......
...@@ -652,6 +652,23 @@ word32 CertDecoder::GetDigest() ...@@ -652,6 +652,23 @@ word32 CertDecoder::GetDigest()
} }
char *CertDecoder::AddTag(char *ptr, const char *buf_end,
const char *tag_name, word32 tag_name_length,
word32 tag_value_length)
{
if (ptr + tag_name_length + tag_value_length > buf_end)
return 0;
memcpy(ptr, tag_name, tag_name_length);
ptr+= tag_name_length;
memcpy(ptr, source_.get_current(), tag_value_length);
ptr+= tag_value_length;
return ptr;
}
// process NAME, either issuer or subject // process NAME, either issuer or subject
void CertDecoder::GetName(NameType nt) void CertDecoder::GetName(NameType nt)
{ {
...@@ -659,11 +676,21 @@ void CertDecoder::GetName(NameType nt) ...@@ -659,11 +676,21 @@ void CertDecoder::GetName(NameType nt)
SHA sha; SHA sha;
word32 length = GetSequence(); // length of all distinguished names word32 length = GetSequence(); // length of all distinguished names
assert (length < ASN_NAME_MAX);
if (length >= ASN_NAME_MAX)
goto err;
length += source_.get_index(); length += source_.get_index();
char* ptr = (nt == ISSUER) ? issuer_ : subject_; char *ptr, *buf_end;
word32 idx = 0;
if (nt == ISSUER) {
ptr= issuer_;
buf_end= ptr + sizeof(issuer_) - 1; // 1 byte for trailing 0
}
else {
ptr= subject_;
buf_end= ptr + sizeof(subject_) - 1; // 1 byte for trailing 0
}
while (source_.get_index() < length) { while (source_.get_index() < length) {
GetSet(); GetSet();
...@@ -685,47 +712,36 @@ void CertDecoder::GetName(NameType nt) ...@@ -685,47 +712,36 @@ void CertDecoder::GetName(NameType nt)
byte id = source_.next(); byte id = source_.next();
b = source_.next(); // strType b = source_.next(); // strType
word32 strLen = GetLength(source_); word32 strLen = GetLength(source_);
bool copy = false;
if (id == COMMON_NAME) { switch (id) {
memcpy(&ptr[idx], "/CN=", 4); case COMMON_NAME:
idx += 4; if (!(ptr= AddTag(ptr, buf_end, "/CN=", 4, strLen)))
copy = true; goto err;
} break;
else if (id == SUR_NAME) { case SUR_NAME:
memcpy(&ptr[idx], "/SN=", 4); if (!(ptr= AddTag(ptr, buf_end, "/SN=", 4, strLen)))
idx += 4; goto err;
copy = true; break;
} case COUNTRY_NAME:
else if (id == COUNTRY_NAME) { if (!(ptr= AddTag(ptr, buf_end, "/C=", 3, strLen)))
memcpy(&ptr[idx], "/C=", 3); goto err;
idx += 3; break;
copy = true; case LOCALITY_NAME:
} if (!(ptr= AddTag(ptr, buf_end, "/L=", 3, strLen)))
else if (id == LOCALITY_NAME) { goto err;
memcpy(&ptr[idx], "/L=", 3); break;
idx += 3; case STATE_NAME:
copy = true; if (!(ptr= AddTag(ptr, buf_end, "/ST=", 4, strLen)))
} goto err;
else if (id == STATE_NAME) { break;
memcpy(&ptr[idx], "/ST=", 4); case ORG_NAME:
idx += 4; if (!(ptr= AddTag(ptr, buf_end, "/O=", 3, strLen)))
copy = true; goto err;
} break;
else if (id == ORG_NAME) { case ORGUNIT_NAME:
memcpy(&ptr[idx], "/O=", 3); if (!(ptr= AddTag(ptr, buf_end, "/OU=", 4, strLen)))
idx += 3; goto err;
copy = true; break;
}
else if (id == ORGUNIT_NAME) {
memcpy(&ptr[idx], "/OU=", 4);
idx += 4;
copy = true;
}
if (copy) {
memcpy(&ptr[idx], source_.get_current(), strLen);
idx += strLen;
} }
sha.Update(source_.get_current(), strLen); sha.Update(source_.get_current(), strLen);
...@@ -739,23 +755,20 @@ void CertDecoder::GetName(NameType nt) ...@@ -739,23 +755,20 @@ void CertDecoder::GetName(NameType nt)
source_.advance(oidSz + 1); source_.advance(oidSz + 1);
word32 length = GetLength(source_); word32 length = GetLength(source_);
if (email) { if (email && !(ptr= AddTag(ptr, buf_end, "/emailAddress=", 14, length)))
memcpy(&ptr[idx], "/emailAddress=", 14); goto err;
idx += 14;
memcpy(&ptr[idx], source_.get_current(), length);
idx += length;
}
source_.advance(length); source_.advance(length);
} }
} }
ptr[idx++] = 0; *ptr= 0;
if (nt == ISSUER) sha.Final(nt == ISSUER ? issuerHash_ : subjectHash_);
sha.Final(issuerHash_);
else return;
sha.Final(subjectHash_);
err:
source_.SetError(CONTENT_E);
} }
......
...@@ -13,7 +13,6 @@ funcs_1.ndb* # joro : NDB tests marked as experiment ...@@ -13,7 +13,6 @@ funcs_1.ndb* # joro : NDB tests marked as experiment
funcs_2.ndb_charset # joro : NDB tests marked as experimental as agreed with bochklin funcs_2.ndb_charset # joro : NDB tests marked as experimental as agreed with bochklin
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
main.innodb-autoinc* # Bug#47809 2009-10-04 joro innodb-autoinc.test fails with valgrind errors with the innodb plugin
main.plugin_load @solaris # Bug#42144 main.plugin_load @solaris # Bug#42144
ndb.* # joro : NDB tests marked as experimental as agreed with bochklin ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# Vs slave. # # Vs slave. #
############################################################################# #############################################################################
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
# Begin clean up test section # Begin clean up test section
connection master; connection master;
--disable_warnings --disable_warnings
...@@ -43,10 +45,12 @@ RETURN tmp; ...@@ -43,10 +45,12 @@ RETURN tmp;
END| END|
delimiter ;| delimiter ;|
--disable_warnings
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1()); INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
sleep 6; sleep 6;
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1()); INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
sleep 6; sleep 6;
--enable_warnings
#Select in this test are used for debugging #Select in this test are used for debugging
#select * from test.t1; #select * from test.t1;
...@@ -56,7 +60,9 @@ sleep 6; ...@@ -56,7 +60,9 @@ sleep 6;
connection master; connection master;
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
START TRANSACTION; START TRANSACTION;
--disable_warnings
INSERT INTO test.t1 VALUES (null,test.f1()); INSERT INTO test.t1 VALUES (null,test.f1());
--enable_warnings
ROLLBACK; ROLLBACK;
SET AUTOCOMMIT=1; SET AUTOCOMMIT=1;
#select * from test.t1; #select * from test.t1;
......
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL ); CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL );
INSERT INTO t1 VALUES (1413006,'idlfmv'), INSERT INTO t1 VALUES (1413006,'idlfmv'),
(1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd'); (1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd');
...@@ -119,4 +120,14 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -119,4 +120,14 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL PRIMARY 102 NULL 3 Using index 1 SIMPLE t2 index NULL PRIMARY 102 NULL 3 Using index
1 SIMPLE t1 eq_ref PRIMARY,a PRIMARY 318 func,const,const 1 1 SIMPLE t1 eq_ref PRIMARY,a PRIMARY 318 func,const,const 1
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug #50096: CONCAT_WS inside procedure returning wrong data
#
CREATE PROCEDURE p1(a varchar(255), b int, c int)
SET @query = CONCAT_WS(",", a, b, c);
CALL p1("abcde", "0", "1234");
SELECT @query;
@query
abcde,0,1234
DROP PROCEDURE p1;
# End of 5.1 tests # End of 5.1 tests
...@@ -4704,4 +4704,19 @@ c1 ...@@ -4704,4 +4704,19 @@ c1
9.1234 9.1234
DROP TABLE t1; DROP TABLE t1;
# End of test for bug#49489. # End of test for bug#49489.
#
# Bug #49517: Inconsistent behavior while using
# NULLable BIGINT and INT columns in comparison
#
CREATE TABLE t1(a BIGINT UNSIGNED NOT NULL, b BIGINT NULL, c INT NULL);
INSERT INTO t1 VALUES(105, NULL, NULL);
SELECT * FROM t1 WHERE b < 102;
a b c
SELECT * FROM t1 WHERE c < 102;
a b c
SELECT * FROM t1 WHERE 102 < b;
a b c
SELECT * FROM t1 WHERE 102 < c;
a b c
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -379,6 +379,9 @@ Note 1592 Statement may not be safe to log in statement format. ...@@ -379,6 +379,9 @@ Note 1592 Statement may not be safe to log in statement format.
INSERT INTO t1 VALUES (VERSION()); INSERT INTO t1 VALUES (VERSION());
Warnings: Warnings:
Note 1592 Statement may not be safe to log in statement format. Note 1592 Statement may not be safe to log in statement format.
INSERT INTO t1 VALUES (RAND());
Warnings:
Note 1592 Statement may not be safe to log in statement format.
DELETE FROM t1; DELETE FROM t1;
SET TIMESTAMP=1000000; SET TIMESTAMP=1000000;
INSERT INTO t1 VALUES INSERT INTO t1 VALUES
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed # BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
# BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0 # BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
# BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode) # BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
# BUG#47995: Mark user functions as unsafe
# BUG#49222: Mare RAND() unsafe
# #
# ==== Related test cases ==== # ==== Related test cases ====
# #
...@@ -391,6 +393,7 @@ SET @@SESSION.SQL_MODE = @save_sql_mode; ...@@ -391,6 +393,7 @@ SET @@SESSION.SQL_MODE = @save_sql_mode;
# #
# BUG#47995: Mark user functions as unsafe # BUG#47995: Mark user functions as unsafe
# BUG#49222: Mare RAND() unsafe
# #
# Test that the system functions that are supposed to be marked unsafe # Test that the system functions that are supposed to be marked unsafe
# generate a warning. Each INSERT statement below should generate a # generate a warning. Each INSERT statement below should generate a
...@@ -400,27 +403,28 @@ SET @@SESSION.SQL_MODE = @save_sql_mode; ...@@ -400,27 +403,28 @@ SET @@SESSION.SQL_MODE = @save_sql_mode;
CREATE TABLE t1 (a VARCHAR(1000)); CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CURRENT_USER()); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (CURRENT_USER()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (FOUND_ROWS()); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (FOUND_ROWS()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1)); INSERT INTO t1 VALUES (GET_LOCK('tmp', 1)); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp')); INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp')); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp')); INSERT INTO t1 VALUES (IS_USED_LOCK('tmp')); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); #marked unsafe in BUG#39701
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1)); INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp')); INSERT INTO t1 VALUES (RELEASE_LOCK('tmp')); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (ROW_COUNT()); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (ROW_COUNT()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (SESSION_USER()); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (SESSION_USER()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (SLEEP(1)); INSERT INTO t1 VALUES (SLEEP(1)); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (SYSDATE()); INSERT INTO t1 VALUES (SYSDATE()); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (SYSTEM_USER()); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (SYSTEM_USER()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (USER()); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (USER()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (UUID()); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (UUID()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (UUID_SHORT()); #marked unsafe before BUG#47995 INSERT INTO t1 VALUES (UUID_SHORT()); #marked unsafe before BUG#47995
INSERT INTO t1 VALUES (VERSION()); INSERT INTO t1 VALUES (VERSION()); #marked unsafe in BUG#47995
INSERT INTO t1 VALUES (RAND()); #marked unsafe in BUG#49222
DELETE FROM t1; DELETE FROM t1;
# Since we replicate the TIMESTAMP variable, functions affected by the # Since we replicate the TIMESTAMP variable, functions affected by the
# TIMESTAMP variable are safe to replicate. So we check that the # TIMESTAMP variable are safe to replicate. So we check that the
# following following functions depend on the TIMESTAMP variable and # following following functions that depend on the TIMESTAMP variable
# don't generate a warning. # are not unsafe and don't generate a warning.
SET TIMESTAMP=1000000; SET TIMESTAMP=1000000;
INSERT INTO t1 VALUES INSERT INTO t1 VALUES
......
...@@ -4,6 +4,7 @@ reset master; ...@@ -4,6 +4,7 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
create table t1(id int, i int, r1 int, r2 int, p varchar(100)); create table t1(id int, i int, r1 int, r2 int, p varchar(100));
insert into t1 values(1, connection_id(), 0, 0, ""); insert into t1 values(1, connection_id(), 0, 0, "");
insert into t1 values(2, 0, rand()*1000, rand()*1000, ""); insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
......
...@@ -4,6 +4,7 @@ reset master; ...@@ -4,6 +4,7 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
CREATE TABLE t1 (a VARCHAR(1000)); CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CONNECTION_ID()); INSERT INTO t1 VALUES (CONNECTION_ID());
INSERT INTO t1 VALUES (CONNECTION_ID()); INSERT INTO t1 VALUES (CONNECTION_ID());
......
...@@ -4,6 +4,7 @@ reset master; ...@@ -4,6 +4,7 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
create table t1 (a int not null auto_increment primary key, b int, key(b)); create table t1 (a int not null auto_increment primary key, b int, key(b));
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
INSERT INTO t1 (a) SELECT null FROM t1; INSERT INTO t1 (a) SELECT null FROM t1;
......
...@@ -4,6 +4,7 @@ reset master; ...@@ -4,6 +4,7 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
DROP FUNCTION IF EXISTS test.f1; DROP FUNCTION IF EXISTS test.f1;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=INNODB; CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=INNODB;
......
...@@ -3,12 +3,16 @@ ...@@ -3,12 +3,16 @@
# #
source include/master-slave.inc; source include/master-slave.inc;
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
create table t1(id int, i int, r1 int, r2 int, p varchar(100)); create table t1(id int, i int, r1 int, r2 int, p varchar(100));
insert into t1 values(1, connection_id(), 0, 0, ""); insert into t1 values(1, connection_id(), 0, 0, "");
# don't put rand and password in the same query, to see if they replicate # don't put rand and password in the same query, to see if they replicate
# independently # independently
# Pure rand test # Pure rand test
--disable_warnings
insert into t1 values(2, 0, rand()*1000, rand()*1000, ""); insert into t1 values(2, 0, rand()*1000, rand()*1000, "");
--enable_warnings
# change the rand suite on the master (we do this because otherwise password() # change the rand suite on the master (we do this because otherwise password()
# benefits from the fact that the above rand() is well replicated : # benefits from the fact that the above rand() is well replicated :
# it picks the same sequence element, which hides a possible bug in password() replication. # it picks the same sequence element, which hides a possible bug in password() replication.
...@@ -19,7 +23,9 @@ set sql_log_bin=1; ...@@ -19,7 +23,9 @@ set sql_log_bin=1;
# Pure password test # Pure password test
insert into t1 values(3, 0, 0, 0, password('does_this_work?')); insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
# "altogether now" # "altogether now"
--disable_warnings
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
--enable_warnings
select * into outfile 'rpl_misc_functions.outfile' from t1; select * into outfile 'rpl_misc_functions.outfile' from t1;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
sync_slave_with_master; sync_slave_with_master;
...@@ -73,11 +79,13 @@ DELIMITER ;| ...@@ -73,11 +79,13 @@ DELIMITER ;|
# Exercise the functions and procedures then compare the results on # Exercise the functions and procedures then compare the results on
# the master to those on the slave. # the master to those on the slave.
--disable_warnings
CALL test_replication_sp1(); CALL test_replication_sp1();
CALL test_replication_sp2(); CALL test_replication_sp2();
INSERT INTO t1 (col_a) VALUES (test_replication_sf()); INSERT INTO t1 (col_a) VALUES (test_replication_sf());
INSERT INTO t1 (col_a) VALUES (test_replication_sf()); INSERT INTO t1 (col_a) VALUES (test_replication_sf());
INSERT INTO t1 (col_a) VALUES (test_replication_sf()); INSERT INTO t1 (col_a) VALUES (test_replication_sf());
--enable_warnings
--sync_slave_with_master --sync_slave_with_master
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
--source include/master-slave.inc --source include/master-slave.inc
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
CREATE TABLE t1 (a VARCHAR(1000)); CREATE TABLE t1 (a VARCHAR(1000));
# We replicate the connection_id in the query_log_event # We replicate the connection_id in the query_log_event
...@@ -41,7 +43,9 @@ INSERT INTO t1 VALUES ...@@ -41,7 +43,9 @@ INSERT INTO t1 VALUES
(UTC_TIMESTAMP()); (UTC_TIMESTAMP());
# We replicate the random seed in a rand_log_event # We replicate the random seed in a rand_log_event
--disable_warnings
INSERT INTO t1 VALUES (RAND()); INSERT INTO t1 VALUES (RAND());
--enable_warnings
# We replicate the last_insert_id in an intvar_log_event # We replicate the last_insert_id in an intvar_log_event
INSERT INTO t1 VALUES (LAST_INSERT_ID()); INSERT INTO t1 VALUES (LAST_INSERT_ID());
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
-- source include/not_ndb_default.inc -- source include/not_ndb_default.inc
-- source include/master-slave.inc -- source include/master-slave.inc
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
create table t1 (a int not null auto_increment primary key, b int, key(b)); create table t1 (a int not null auto_increment primary key, b int, key(b));
INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
INSERT INTO t1 (a) SELECT null FROM t1; INSERT INTO t1 (a) SELECT null FROM t1;
...@@ -30,8 +32,8 @@ INSERT INTO t1 (a) SELECT null FROM t1; ...@@ -30,8 +32,8 @@ INSERT INTO t1 (a) SELECT null FROM t1;
INSERT INTO t1 (a) SELECT null FROM t1; INSERT INTO t1 (a) SELECT null FROM t1;
save_master_pos; save_master_pos;
# a few updates to force OPTIMIZE to do something # a few updates to force OPTIMIZE to do something
update t1 set b=(a/2*rand());
--disable_warnings --disable_warnings
update t1 set b=(a/2*rand());
delete from t1 order by b limit 10000; delete from t1 order by b limit 10000;
--enable_warnings --enable_warnings
......
...@@ -40,10 +40,12 @@ insert into t3 values(100,"log",0,0,0); ...@@ -40,10 +40,12 @@ insert into t3 values(100,"log",0,0,0);
SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186; SET @@RAND_SEED1=658490765, @@RAND_SEED2=635893186;
# Emulate that we have rows 2-9 deleted on the slave # Emulate that we have rows 2-9 deleted on the slave
--disable_warnings
insert into t1 values(1,1,rand()),(NULL,2,rand()); insert into t1 values(1,1,rand()),(NULL,2,rand());
insert into t2 (b) values(last_insert_id()); insert into t2 (b) values(last_insert_id());
insert into t2 values(3,0),(NULL,0); insert into t2 values(3,0),(NULL,0);
insert into t2 values(NULL,0),(500,0); insert into t2 values(NULL,0),(500,0);
--enable_warnings
select a,b, truncate(rand_value,4) from t1; select a,b, truncate(rand_value,4) from t1;
select * from t2; select * from t2;
......
...@@ -4,6 +4,7 @@ reset master; ...@@ -4,6 +4,7 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
CALL mtr.add_suppression('Statement may not be safe to log in statement format.');
DROP FUNCTION IF EXISTS test.f1; DROP FUNCTION IF EXISTS test.f1;
DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=NDB; CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=NDB;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
--enable_warnings --enable_warnings
CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL ); CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL );
...@@ -111,4 +112,16 @@ EXPLAIN SELECT CONCAT('gui_', t2.a), t1.d FROM t2 ...@@ -111,4 +112,16 @@ EXPLAIN SELECT CONCAT('gui_', t2.a), t1.d FROM t2
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # Bug #50096: CONCAT_WS inside procedure returning wrong data
--echo #
CREATE PROCEDURE p1(a varchar(255), b int, c int)
SET @query = CONCAT_WS(",", a, b, c);
CALL p1("abcde", "0", "1234");
SELECT @query;
DROP PROCEDURE p1;
--echo # End of 5.1 tests --echo # End of 5.1 tests
...@@ -4023,4 +4023,18 @@ SELECT * FROM t1 WHERE c1 < 9.12345; ...@@ -4023,4 +4023,18 @@ SELECT * FROM t1 WHERE c1 < 9.12345;
DROP TABLE t1; DROP TABLE t1;
--echo # End of test for bug#49489. --echo # End of test for bug#49489.
--echo #
--echo # Bug #49517: Inconsistent behavior while using
--echo # NULLable BIGINT and INT columns in comparison
--echo #
CREATE TABLE t1(a BIGINT UNSIGNED NOT NULL, b BIGINT NULL, c INT NULL);
INSERT INTO t1 VALUES(105, NULL, NULL);
SELECT * FROM t1 WHERE b < 102;
SELECT * FROM t1 WHERE c < 102;
SELECT * FROM t1 WHERE 102 < b;
SELECT * FROM t1 WHERE 102 < c;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -895,9 +895,9 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg, ...@@ -895,9 +895,9 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg,
ulonglong const_value= (ulonglong)-1; ulonglong const_value= (ulonglong)-1;
thd= current_thd; thd= current_thd;
owner= owner_arg; owner= owner_arg;
set_null= set_null && owner_arg;
a= a1; a= a1;
b= a2; b= a2;
owner= owner_arg;
thd= current_thd; thd= current_thd;
if ((cmp_type= can_compare_as_dates(*a, *b, &const_value))) if ((cmp_type= can_compare_as_dates(*a, *b, &const_value)))
......
...@@ -54,10 +54,10 @@ public: ...@@ -54,10 +54,10 @@ public:
/* Allow owner function to use string buffers. */ /* Allow owner function to use string buffers. */
String value1, value2; String value1, value2;
Arg_comparator(): thd(0), a_cache(0), b_cache(0), set_null(0), Arg_comparator(): thd(0), a_cache(0), b_cache(0), set_null(TRUE),
get_value_a_func(0), get_value_b_func(0) {}; get_value_a_func(0), get_value_b_func(0) {};
Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), thd(0), Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), thd(0),
a_cache(0), b_cache(0), set_null(0), a_cache(0), b_cache(0), set_null(TRUE),
get_value_a_func(0), get_value_b_func(0) {}; get_value_a_func(0), get_value_b_func(0) {};
int set_compare_func(Item_result_field *owner, Item_result type); int set_compare_func(Item_result_field *owner, Item_result type);
......
...@@ -4178,6 +4178,16 @@ Create_func_rand::create_native(THD *thd, LEX_STRING name, ...@@ -4178,6 +4178,16 @@ Create_func_rand::create_native(THD *thd, LEX_STRING name,
if (item_list != NULL) if (item_list != NULL)
arg_count= item_list->elements; arg_count= item_list->elements;
/*
When RAND() is binlogged, the seed is binlogged too. So the
sequence of random numbers is the same on a replication slave as
on the master. However, if several RAND() values are inserted
into a table, the order in which the rows are modified may differ
between master and slave, because the order is undefined. Hence,
the statement is unsafe to log in statement format.
*/
thd->lex->set_stmt_unsafe();
switch (arg_count) { switch (arg_count) {
case 0: case 0:
{ {
......
...@@ -677,8 +677,8 @@ String *Item_func_concat_ws::val_str(String *str) ...@@ -677,8 +677,8 @@ String *Item_func_concat_ws::val_str(String *str)
res->length() + sep_str->length() + res2->length()) res->length() + sep_str->length() + res2->length())
{ {
/* We have room in str; We can't get any errors here */ /* We have room in str; We can't get any errors here */
if (str == res2) if (str->ptr() == res2->ptr())
{ // This is quote uncommon! { // This is quite uncommon!
str->replace(0,0,*sep_str); str->replace(0,0,*sep_str);
str->replace(0,0,*res); str->replace(0,0,*res);
} }
......
# Copyright 2000-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. # Copyright (C) 2000-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -65,6 +65,19 @@ ...@@ -65,6 +65,19 @@
# See BUG#998 for details. # See BUG#998 for details.
%define _unpackaged_files_terminate_build 0 %define _unpackaged_files_terminate_build 0
# ------------------------------------------------------------------------------
# RPM build tools now automatically detects Perl module dependencies. This
# detection gives problems as it is broken in some versions, and it also
# give unwanted dependencies from mandatory scripts in our package.
# Might not be possible to disable in all RPM tool versions, but here we
# try. We keep the "AutoReqProv: no" for the "test" sub package, as disabling
# here might fail, and that package has the most problems.
# See http://fedoraproject.org/wiki/Packaging/Perl#Filtering_Requires:_and_Provides
# http://www.wideopen.com/archives/rpm-list/2002-October/msg00343.html
# ------------------------------------------------------------------------------
%undefine __perl_provides
%undefine __perl_requires
%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com %define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
# On SuSE 9 no separate "debuginfo" package is built. To enable basic # On SuSE 9 no separate "debuginfo" package is built. To enable basic
...@@ -205,7 +218,7 @@ They should be used with caution. ...@@ -205,7 +218,7 @@ They should be used with caution.
%endif %endif
%package test %package test
Requires: %{name}-client perl-DBI perl Requires: %{name}-client perl
Summary: MySQL - Test suite Summary: MySQL - Test suite
Group: Applications/Databases Group: Applications/Databases
Provides: mysql-test Provides: mysql-test
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment