Commit d1ffce69 authored by unknown's avatar unknown

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

into  mysql.com:/opt/local/work/mysql-5.0-12736

parents 32a0bac1 371f8c69
...@@ -367,3 +367,6 @@ DROP TABLE t1; ...@@ -367,3 +367,6 @@ DROP TABLE t1;
select cast(NULL as decimal(6)) as t1; select cast(NULL as decimal(6)) as t1;
t1 t1
NULL NULL
select cast(1.0e+300 as signed int);
cast(1.0e+300 as signed int)
9223372036854775807
...@@ -92,3 +92,6 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -92,3 +92,6 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: Warnings:
Note 1003 select password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')` Note 1003 select password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
select encrypt('1234','_.');
encrypt('1234','_.')
#
...@@ -1254,6 +1254,440 @@ flush logs; ...@@ -1254,6 +1254,440 @@ flush logs;
SHOW PROCEDURE STATUS LIKE 'p1'; SHOW PROCEDURE STATUS LIKE 'p1';
-------- switch to slave ------- -------- switch to slave -------
SHOW PROCEDURE STATUS LIKE 'p1'; SHOW PROCEDURE STATUS LIKE 'p1';
######## CREATE OR REPLACE VIEW v1 as select * from t1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 18 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
19
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
18
-------- switch to master -------
CREATE OR REPLACE VIEW v1 as select * from t1;
SELECT MAX(f1) FROM t1;
MAX(f1)
19
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
19
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
19
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
19
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
-------- switch to slave -------
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
######## ALTER VIEW v1 AS select f1 from t1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 19 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
20
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
19
-------- switch to master -------
ALTER VIEW v1 AS select f1 from t1;
SELECT MAX(f1) FROM t1;
MAX(f1)
20
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
20
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
20
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
20
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
-------- switch to slave -------
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1`
######## DROP VIEW IF EXISTS v1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 20 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
21
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
20
-------- switch to master -------
DROP VIEW IF EXISTS v1;
SELECT MAX(f1) FROM t1;
MAX(f1)
21
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
21
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
21
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
21
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW CREATE VIEW v1;
ERROR 42S02: Table 'mysqltest1.v1' doesn't exist
-------- switch to slave -------
SHOW CREATE VIEW v1;
ERROR 42S02: Table 'mysqltest1.v1' doesn't exist
######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 21 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
22
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
21
-------- switch to master -------
CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
SELECT MAX(f1) FROM t1;
MAX(f1)
22
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
22
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
22
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
22
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode
trg1 INSERT t1 SET @a:=1 BEFORE NULL
-------- switch to slave -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode
trg1 INSERT t1 SET @a:=1 BEFORE NULL
######## DROP TRIGGER trg1 ########
-------- switch to master -------
INSERT INTO t1 SET f1= 22 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
23
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
22
-------- switch to master -------
DROP TRIGGER trg1;
SELECT MAX(f1) FROM t1;
MAX(f1)
23
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
23
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
23
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
23
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode
-------- switch to slave -------
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode
######## CREATE USER user1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 23 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
24
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
23
-------- switch to master -------
CREATE USER user1@localhost;
SELECT MAX(f1) FROM t1;
MAX(f1)
24
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
24
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
24
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
24
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SELECT user FROM mysql.user WHERE user = 'user1';
user
user1
-------- switch to slave -------
SELECT user FROM mysql.user WHERE user = 'user1';
user
user1
######## RENAME USER user1@localhost TO rename1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 24 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
25
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
24
-------- switch to master -------
RENAME USER user1@localhost TO rename1@localhost;
SELECT MAX(f1) FROM t1;
MAX(f1)
25
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
25
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
25
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
25
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
rename1
-------- switch to slave -------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
rename1
######## DROP USER rename1@localhost ########
-------- switch to master -------
INSERT INTO t1 SET f1= 25 + 1;
SELECT MAX(f1) FROM t1;
MAX(f1)
26
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
25
-------- switch to master -------
DROP USER rename1@localhost;
SELECT MAX(f1) FROM t1;
MAX(f1)
26
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
26
-------- switch to master -------
ROLLBACK;
SELECT MAX(f1) FROM t1;
MAX(f1)
26
TEST-INFO: MASTER: The INSERT is committed (Succeeded)
-------- switch to slave --------
SELECT MAX(f1) FROM t1;
MAX(f1)
26
TEST-INFO: SLAVE: The INSERT is committed (Succeeded)
-------- switch to master -------
flush logs;
-------- switch to slave --------
flush logs;
-------- switch to master -------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
-------- switch to slave -------
SELECT user FROM mysql.user WHERE user = 'rename1';
user
DROP DATABASE IF EXISTS mysqltest1; DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2; DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3; DROP DATABASE IF EXISTS mysqltest3;
...@@ -160,6 +160,11 @@ select cast(concat('184467440','73709551615') as signed); ...@@ -160,6 +160,11 @@ select cast(concat('184467440','73709551615') as signed);
select cast(repeat('1',20) as unsigned); select cast(repeat('1',20) as unsigned);
select cast(repeat('1',20) as signed); select cast(repeat('1',20) as signed);
#
# Bug #13344: cast of large decimal to signed int not handled correctly
#
select cast(1.0e+300 as signed int);
# End of 4.1 tests # End of 4.1 tests
......
...@@ -49,4 +49,10 @@ select old_password(' i d k f a '); ...@@ -49,4 +49,10 @@ select old_password(' i d k f a ');
explain extended select password('idkfa '), old_password('idkfa'); explain extended select password('idkfa '), old_password('idkfa');
#
# Bug #13619: Crash on FreeBSD with salt like '_.'
#
--replace_column 1 #
select encrypt('1234','_.');
# End of 4.1 tests # End of 4.1 tests
...@@ -25,6 +25,7 @@ select ((@id := kill_id) - kill_id) from t1; ...@@ -25,6 +25,7 @@ select ((@id := kill_id) - kill_id) from t1;
kill @id; kill @id;
connection con1; connection con1;
--sleep 1
# this statement should fail # this statement should fail
--error 2006,2013 --error 2006,2013
......
...@@ -391,6 +391,113 @@ SHOW PROCEDURE STATUS LIKE 'p1'; ...@@ -391,6 +391,113 @@ SHOW PROCEDURE STATUS LIKE 'p1';
connection master; connection master;
--horizontal_results --horizontal_results
###############################################################
# Cases with VIEWs
###############################################################
let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW CREATE VIEW v1;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW CREATE VIEW v1;
connection master;
let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW CREATE VIEW v1;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW CREATE VIEW v1;
connection master;
let $my_stmt= DROP VIEW IF EXISTS v1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--error 1146
SHOW CREATE VIEW v1;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
--error 1146
SHOW CREATE VIEW v1;
connection master;
###############################################################
# Cases with TRIGGERs
###############################################################
let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TRIGGERS;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW TRIGGERS;
connection master;
let $my_stmt= DROP TRIGGER trg1;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TRIGGERS;
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SHOW TRIGGERS;
connection master;
###############################################################
# Cases with USERs
###############################################################
let $my_stmt= CREATE USER user1@localhost;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'user1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SELECT user FROM mysql.user WHERE user = 'user1';
connection master;
let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'rename1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
connection master;
let $my_stmt= DROP USER rename1@localhost;
let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'rename1';
--disable_query_log
SELECT '-------- switch to slave -------' as "";
--enable_query_log
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
connection master;
############################################################### ###############################################################
# Cleanup # Cleanup
############################################################### ###############################################################
......
...@@ -1331,6 +1331,14 @@ public: ...@@ -1331,6 +1331,14 @@ public:
longlong val_int() longlong val_int()
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
if (value <= (double) LONGLONG_MIN)
{
return LONGLONG_MIN;
}
else if (value >= (double) (ulonglong) LONGLONG_MAX)
{
return LONGLONG_MAX;
}
return (longlong) (value+(value > 0 ? 0.5 : -0.5)); return (longlong) (value+(value > 0 ? 0.5 : -0.5));
} }
String *val_str(String*); String *val_str(String*);
......
...@@ -1504,7 +1504,13 @@ String *Item_func_encrypt::val_str(String *str) ...@@ -1504,7 +1504,13 @@ String *Item_func_encrypt::val_str(String *str)
salt_ptr= salt_str->c_ptr(); salt_ptr= salt_str->c_ptr();
} }
pthread_mutex_lock(&LOCK_crypt); pthread_mutex_lock(&LOCK_crypt);
char *tmp=crypt(res->c_ptr(),salt_ptr); char *tmp= crypt(res->c_ptr(),salt_ptr);
if (!tmp)
{
pthread_mutex_unlock(&LOCK_crypt);
null_value= 1;
return 0;
}
str->set(tmp,(uint) strlen(tmp),res->charset()); str->set(tmp,(uint) strlen(tmp),res->charset());
str->copy(); str->copy();
pthread_mutex_unlock(&LOCK_crypt); pthread_mutex_unlock(&LOCK_crypt);
......
...@@ -3684,6 +3684,8 @@ end_with_restore_list: ...@@ -3684,6 +3684,8 @@ end_with_restore_list:
if (check_access(thd, INSERT_ACL, "mysql", 0, 1, 1, 0) && if (check_access(thd, INSERT_ACL, "mysql", 0, 1, 1, 0) &&
check_global_access(thd,CREATE_USER_ACL)) check_global_access(thd,CREATE_USER_ACL))
break; break;
if (end_active_trans(thd))
goto error;
if (!(res= mysql_create_user(thd, lex->users_list))) if (!(res= mysql_create_user(thd, lex->users_list)))
{ {
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
...@@ -3700,6 +3702,8 @@ end_with_restore_list: ...@@ -3700,6 +3702,8 @@ end_with_restore_list:
if (check_access(thd, DELETE_ACL, "mysql", 0, 1, 1, 0) && if (check_access(thd, DELETE_ACL, "mysql", 0, 1, 1, 0) &&
check_global_access(thd,CREATE_USER_ACL)) check_global_access(thd,CREATE_USER_ACL))
break; break;
if (end_active_trans(thd))
goto error;
if (!(res= mysql_drop_user(thd, lex->users_list))) if (!(res= mysql_drop_user(thd, lex->users_list)))
{ {
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
...@@ -3716,6 +3720,8 @@ end_with_restore_list: ...@@ -3716,6 +3720,8 @@ end_with_restore_list:
if (check_access(thd, UPDATE_ACL, "mysql", 0, 1, 1, 0) && if (check_access(thd, UPDATE_ACL, "mysql", 0, 1, 1, 0) &&
check_global_access(thd,CREATE_USER_ACL)) check_global_access(thd,CREATE_USER_ACL))
break; break;
if (end_active_trans(thd))
goto error;
if (!(res= mysql_rename_user(thd, lex->users_list))) if (!(res= mysql_rename_user(thd, lex->users_list)))
{ {
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
...@@ -4510,6 +4516,9 @@ end_with_restore_list: ...@@ -4510,6 +4516,9 @@ end_with_restore_list:
} }
case SQLCOM_CREATE_VIEW: case SQLCOM_CREATE_VIEW:
{ {
if (end_active_trans(thd))
goto error;
if (!(res= mysql_create_view(thd, thd->lex->create_view_mode)) && if (!(res= mysql_create_view(thd, thd->lex->create_view_mode)) &&
mysql_bin_log.is_open()) mysql_bin_log.is_open())
{ {
...@@ -4557,6 +4566,9 @@ end_with_restore_list: ...@@ -4557,6 +4566,9 @@ end_with_restore_list:
} }
case SQLCOM_CREATE_TRIGGER: case SQLCOM_CREATE_TRIGGER:
{ {
if (end_active_trans(thd))
goto error;
res= mysql_create_or_drop_trigger(thd, all_tables, 1); res= mysql_create_or_drop_trigger(thd, all_tables, 1);
/* We don't care about trigger body after this point */ /* We don't care about trigger body after this point */
...@@ -4566,6 +4578,9 @@ end_with_restore_list: ...@@ -4566,6 +4578,9 @@ end_with_restore_list:
} }
case SQLCOM_DROP_TRIGGER: case SQLCOM_DROP_TRIGGER:
{ {
if (end_active_trans(thd))
goto error;
res= mysql_create_or_drop_trigger(thd, all_tables, 0); res= mysql_create_or_drop_trigger(thd, all_tables, 0);
break; break;
} }
......
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