mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Merge perch.ndb.mysql.com:/home/jonas/src/51-new
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new sql/ha_ndbcluster.cc: Auto merged sql/share/errmsg.txt: Auto merged storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: Auto merged storage/ndb/src/kernel/blocks/dbtup/DbtupScan.cpp: Auto merged storage/ndb/test/ndbapi/test_event.cpp: Auto merged storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: SCCS merged
This commit is contained in:
@@ -253,12 +253,17 @@ sub collect_one_test_case($$$$$$$) {
|
||||
}
|
||||
|
||||
if ( ( $::opt_with_ndbcluster or $::glob_use_running_ndbcluster ) and
|
||||
defined mtr_match_substring($tname,"ndb") )
|
||||
( $::opt_with_ndbcluster_all or defined mtr_match_substring($tname,"ndb") ))
|
||||
{
|
||||
$tinfo->{'ndb_test'}= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $::opt_with_ndbcluster_only )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
return;
|
||||
}
|
||||
$tinfo->{'ndb_test'}= 0;
|
||||
}
|
||||
|
||||
|
@@ -304,11 +304,13 @@ our $opt_warnings;
|
||||
|
||||
our $opt_udiff;
|
||||
|
||||
our $opt_skip_ndbcluster;
|
||||
our $opt_skip_ndbcluster= 0;
|
||||
our $opt_with_ndbcluster;
|
||||
our $opt_skip_ndbcluster_slave;
|
||||
our $opt_skip_ndbcluster_slave= 0;
|
||||
our $opt_with_ndbcluster_slave;
|
||||
our $opt_ndb_extra_test;
|
||||
our $opt_with_ndbcluster_all= 0;
|
||||
our $opt_with_ndbcluster_only= 0;
|
||||
our $opt_ndb_extra_test= 0;
|
||||
|
||||
our $exe_ndb_mgm;
|
||||
our $path_ndb_tools_dir;
|
||||
@@ -548,6 +550,8 @@ sub command_line_setup () {
|
||||
'with-ndbcluster-slave' => \$opt_with_ndbcluster_slave,
|
||||
'skip-ndbcluster-slave|skip-ndb-slave'
|
||||
=> \$opt_skip_ndbcluster_slave,
|
||||
'with-ndbcluster-all' => \$opt_with_ndbcluster_all,
|
||||
'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
|
||||
'ndb-extra-test' => \$opt_ndb_extra_test,
|
||||
'do-test=s' => \$opt_do_test,
|
||||
'suite=s' => \$opt_suite,
|
||||
@@ -1938,6 +1942,10 @@ sub run_testcase ($) {
|
||||
mtr_report_test_name($tinfo);
|
||||
|
||||
mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
|
||||
if ( $master->[1]->{'pid'} )
|
||||
{
|
||||
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
|
||||
}
|
||||
|
||||
# FIXME test cases that depend on each other, prevent this from
|
||||
# being at this location.
|
||||
@@ -1986,6 +1994,7 @@ sub run_testcase ($) {
|
||||
}
|
||||
if ( $using_ndbcluster_master and ! $master->[1]->{'pid'} )
|
||||
{
|
||||
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
|
||||
$master->[1]->{'pid'}=
|
||||
mysqld_start('master',1,$tinfo->{'master_opt'},[],
|
||||
$using_ndbcluster_master);
|
||||
@@ -3038,7 +3047,9 @@ Options to control what engine/variation to run
|
||||
Options to control what test suites or cases to run
|
||||
|
||||
force Continue to run the suite after failure
|
||||
with-ndbcluster Use cluster, and enable test cases that requres it
|
||||
with-ndbcluster Use cluster, and enable test cases that requires it
|
||||
with-ndbcluster-all Use cluster in all tests
|
||||
with-ndbcluster-only Run only tests that include "ndb" in the filename
|
||||
skip-ndb[cluster] Skip the ndb test cases, don't start cluster
|
||||
do-test=PREFIX Run test cases which name are prefixed with PREFIX
|
||||
start-from=PREFIX Run test cases starting from test prefixed with PREFIX
|
||||
|
@@ -630,7 +630,7 @@ export MASTER_MYHOST MASTER_MYPORT SLAVE_MYHOST SLAVE_MYPORT MYSQL_TCP_PORT MAST
|
||||
NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS"
|
||||
NDBCLUSTER_OPTS_SLAVE="--port=$NDBCLUSTER_PORT_SLAVE --data-dir=$MYSQL_TEST_DIR/var"
|
||||
if [ -n "$USE_NDBCLUSTER_SLAVE" ] ; then
|
||||
USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE"
|
||||
USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE --ndb-extra-logging"
|
||||
fi
|
||||
NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
|
||||
NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
|
||||
@@ -1016,6 +1016,10 @@ disable_test() {
|
||||
report_current_test () {
|
||||
tname=$1
|
||||
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
|
||||
eval "master1_running=\$MASTER1_RUNNING"
|
||||
if [ x$master1_running = x1 ] ; then
|
||||
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
|
||||
fi
|
||||
if [ -n "$PURIFY_LOGS" ] ; then
|
||||
for log in $PURIFY_LOGS
|
||||
do
|
||||
@@ -1297,7 +1301,7 @@ start_ndbcluster()
|
||||
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
|
||||
echo "Using ndbcluster at $NDB_CONNECTSTRING"
|
||||
fi
|
||||
USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\""
|
||||
USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\" --ndb-extra-logging"
|
||||
export NDB_CONNECTSTRING
|
||||
fi
|
||||
}
|
||||
@@ -1876,6 +1880,7 @@ run_testcase ()
|
||||
start_ndbcluster
|
||||
start_master
|
||||
if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
|
||||
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
|
||||
start_master 1
|
||||
fi
|
||||
TZ=$MY_TZ; export TZ
|
||||
@@ -1903,6 +1908,7 @@ run_testcase ()
|
||||
start_ndbcluster
|
||||
start_master
|
||||
if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
|
||||
echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
|
||||
start_master 1
|
||||
fi
|
||||
else
|
||||
|
@@ -234,5 +234,10 @@ insert into t1 values('test test '),('test'),('test'),('test'),
|
||||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test');
|
||||
delete from t1 limit 1;
|
||||
truncate table t1;
|
||||
insert into t1 values('ab c d');
|
||||
update t1 set a='ab c d';
|
||||
select * from t1 where match a against('ab c' in boolean mode);
|
||||
a
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
|
@@ -1126,6 +1126,19 @@ DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION func1;
|
||||
DROP FUNCTION func2;
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1(a int);
|
||||
select table_schema from information_schema.tables where table_schema='mysqltest';
|
||||
table_schema
|
||||
drop database mysqltest;
|
||||
select column_type, group_concat(table_schema, '.', table_name), count(*) as num
|
||||
from information_schema.columns where
|
||||
table_schema='information_schema' and
|
||||
(column_type = 'varchar(7)' or column_type = 'varchar(20)')
|
||||
group by column_type order by num;
|
||||
column_type group_concat(table_schema, '.', table_name) num
|
||||
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2
|
||||
varchar(20) information_schema.COLUMNS,information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS 6
|
||||
select * from information_schema.engines WHERE ENGINE="MyISAM";
|
||||
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
||||
MyISAM ENABLED Default engine as of MySQL 3.23 with great performance NO NO NO
|
||||
|
@@ -304,21 +304,56 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 p1_sp2,p2_sp2 system NULL NULL NULL NULL 1
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
drop table t1;
|
||||
create table t1 (a int) partition by list(a) (
|
||||
partition p0 values in (1,2),
|
||||
partition p1 values in (3,4)
|
||||
);
|
||||
insert into t1 values (1),(1),(2),(2),(3),(4),(3),(4);
|
||||
flush status;
|
||||
update t1 set a=100 where a=5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 0
|
||||
flush status;
|
||||
update t1 set a=100 where a+1=5+1;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 10
|
||||
flush status;
|
||||
delete from t1 where a=5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 0
|
||||
flush status;
|
||||
delete from t1 where a+1=5+1;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 10
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t2;
|
||||
flush status;
|
||||
update t1,t2 set t1.a=1000, t2.a=1000 where t1.a=5 and t2.a=5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 0
|
||||
flush status;
|
||||
delete t1,t2 from t1, t2 where t1.a=5 and t2.a=5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 0
|
||||
drop table t1,t2;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
);
|
||||
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't2'
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) default NULL,
|
||||
KEY `a` (`a`)
|
||||
) ;
|
||||
insert into t2 select A.a + 10*(B.a + 10* C.a) from t1 A, t1 B, t1 C ;
|
||||
insert into t1 select a from t2;
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
drop table t2;
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) default NULL,
|
||||
`b` int(11) default NULL
|
||||
@@ -367,23 +402,23 @@ flush status;
|
||||
update t2 set a = 1002 where a = 1001;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 1015
|
||||
Handler_read_rnd_next 0
|
||||
flush status;
|
||||
update t2 set b = 6 where a = 600;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 1015
|
||||
Handler_read_rnd_next 201
|
||||
flush status;
|
||||
update t2 set b = 6 where a > 600 and a < 800;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 1015
|
||||
Handler_read_rnd_next 201
|
||||
flush status;
|
||||
delete from t2 where a > 600;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
Variable_name Value
|
||||
Handler_read_rnd_next 1015
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
Handler_read_rnd_next 402
|
||||
drop table t2;
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) default NULL,
|
||||
`b` int(11) default NULL,
|
||||
|
25
mysql-test/r/rpl_multi_update4.result
Normal file
25
mysql-test/r/rpl_multi_update4.result
Normal file
@@ -0,0 +1,25 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop database if exists d1;
|
||||
drop database if exists d2;
|
||||
drop database if exists d2;
|
||||
create database d1;
|
||||
create table d1.t0 (id int);
|
||||
create database d2;
|
||||
use d2;
|
||||
create table t1 (id int);
|
||||
create table t2 (id int);
|
||||
insert into t1 values (1), (2), (3), (4), (5);
|
||||
insert into t2 select id + 3 from t1;
|
||||
update t1 join t2 using (id) set t1.id = 0;
|
||||
insert into d1.t0 values (0);
|
||||
use d1;
|
||||
select * from t0 where id=0;
|
||||
id
|
||||
0
|
||||
drop database d1;
|
||||
drop database d2;
|
126
mysql-test/r/rpl_ndb_blob.result
Normal file
126
mysql-test/r/rpl_ndb_blob.result
Normal file
@@ -0,0 +1,126 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null
|
||||
) engine=ndb;
|
||||
insert into t1 values(1, repeat('abc',10));
|
||||
insert into t1 values(2, repeat('def',200));
|
||||
insert into t1 values(3, repeat('ghi',3000));
|
||||
select 'M', a, sha1(b) from t1
|
||||
order by a;
|
||||
M a sha1(b)
|
||||
M 1 8a6c4cf7cf97e66c487c3e3b717e9ae13623d07d
|
||||
M 2 0ccd08c0fa6ad6a4382b27b1d36586d6ceb4fffa
|
||||
M 3 75e7b3299e0b776aeac2a4d1542d5b3c0ba2e05e
|
||||
select 'S', a, sha1(b) from t1
|
||||
order by a;
|
||||
S a sha1(b)
|
||||
S 1 8a6c4cf7cf97e66c487c3e3b717e9ae13623d07d
|
||||
S 2 0ccd08c0fa6ad6a4382b27b1d36586d6ceb4fffa
|
||||
S 3 75e7b3299e0b776aeac2a4d1542d5b3c0ba2e05e
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null,
|
||||
c int,
|
||||
d longblob,
|
||||
e tinyblob
|
||||
) engine=ndbcluster;
|
||||
insert into t1 values (
|
||||
0, repeat(@s2,454), 100, repeat(@s2,345), NULL);
|
||||
insert into t1 values (
|
||||
1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
2, '', 102, '', repeat(@s2,1));
|
||||
insert into t1 values (
|
||||
3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1));
|
||||
insert into t1 values (
|
||||
4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1));
|
||||
insert into t1 values (
|
||||
5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
6, repeat(@s1,242), 106, NULL, repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
7, repeat(@s1,30), 107, repeat(@s0,161), '');
|
||||
insert into t1 values (
|
||||
8, repeat(@s1,719), 108, repeat(@s2,104), NULL);
|
||||
insert into t1 values (
|
||||
9, repeat(@s2,427), NULL, NULL, NULL);
|
||||
select 'M', a, sha1(b), c, sha1(d), sha1(e)
|
||||
from t1 order by a;
|
||||
M a sha1(b) c sha1(d) sha1(e)
|
||||
M 0 9538f61e649383c0d1054de2a2f0171188129f33 100 2b6515f29c20b8e9e17cc597527e516c0de8d612 NULL
|
||||
M 1 dcb9a12ca86e718ff2564be041b7c1b3ff5ea559 NULL f23e7439d9a73c3954979b85a7ef6ef35faf4e9d abfe8ae5212b22d023aa6de84beeb1344ac5668a
|
||||
M 2 da39a3ee5e6b4b0d3255bfef95601890afd80709 102 da39a3ee5e6b4b0d3255bfef95601890afd80709 33deebe47470a40e960834bffa4cdc66790845a6
|
||||
M 3 ec8e06d9ac4695d6a898b519ba840590263a9bff 103 278629ad080c3c4377978c006c2e54d0992e43cc 700915801f853603510aeb67b331866d996fdbda
|
||||
M 4 0392fa8c425d293c79291f0f34779d1101d13fcb 104 5084b602c7203e0e9590a163415ac605da17ac32 700915801f853603510aeb67b331866d996fdbda
|
||||
M 5 0f9653f0c7a69cd1c617792d546582e974a7a24d 105 566588a04ff26d05160d61c83435292bfda2978e abfe8ae5212b22d023aa6de84beeb1344ac5668a
|
||||
M 6 a37e8b0ff4fc13a42be02cdecb36186436959bae 106 NULL abfe8ae5212b22d023aa6de84beeb1344ac5668a
|
||||
M 7 a6bae0cfe6b45ff8c3c12d2ce577a1cd3931190f 107 39ee712b4b9e47f2cf3ba7c9790b2bf0d8f378e8 da39a3ee5e6b4b0d3255bfef95601890afd80709
|
||||
M 8 e139adcb7b2974ee7ff227fd405709e5cb7c896c 108 ba8073b0e1a281d4111bd2d82c7722b01574c00b NULL
|
||||
M 9 1fc5168fe4be566b17b658d94e7813f0b5032cdb NULL NULL NULL
|
||||
select 'S', a, sha1(b), c, sha1(d), sha1(e)
|
||||
from t1 order by a;
|
||||
S a sha1(b) c sha1(d) sha1(e)
|
||||
S 0 9538f61e649383c0d1054de2a2f0171188129f33 100 2b6515f29c20b8e9e17cc597527e516c0de8d612 NULL
|
||||
S 1 dcb9a12ca86e718ff2564be041b7c1b3ff5ea559 NULL f23e7439d9a73c3954979b85a7ef6ef35faf4e9d abfe8ae5212b22d023aa6de84beeb1344ac5668a
|
||||
S 2 da39a3ee5e6b4b0d3255bfef95601890afd80709 102 da39a3ee5e6b4b0d3255bfef95601890afd80709 33deebe47470a40e960834bffa4cdc66790845a6
|
||||
S 3 ec8e06d9ac4695d6a898b519ba840590263a9bff 103 278629ad080c3c4377978c006c2e54d0992e43cc 700915801f853603510aeb67b331866d996fdbda
|
||||
S 4 0392fa8c425d293c79291f0f34779d1101d13fcb 104 5084b602c7203e0e9590a163415ac605da17ac32 700915801f853603510aeb67b331866d996fdbda
|
||||
S 5 0f9653f0c7a69cd1c617792d546582e974a7a24d 105 566588a04ff26d05160d61c83435292bfda2978e abfe8ae5212b22d023aa6de84beeb1344ac5668a
|
||||
S 6 a37e8b0ff4fc13a42be02cdecb36186436959bae 106 NULL abfe8ae5212b22d023aa6de84beeb1344ac5668a
|
||||
S 7 a6bae0cfe6b45ff8c3c12d2ce577a1cd3931190f 107 39ee712b4b9e47f2cf3ba7c9790b2bf0d8f378e8 da39a3ee5e6b4b0d3255bfef95601890afd80709
|
||||
S 8 e139adcb7b2974ee7ff227fd405709e5cb7c896c 108 ba8073b0e1a281d4111bd2d82c7722b01574c00b NULL
|
||||
S 9 1fc5168fe4be566b17b658d94e7813f0b5032cdb NULL NULL NULL
|
||||
drop table t1;
|
||||
show binlog events;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4
|
||||
master-bin.000001 102 Query 1 239 use `test`; create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null
|
||||
) engine=ndb
|
||||
master-bin.000001 239 Query 1 303 BEGIN
|
||||
master-bin.000001 303 Table_map 1 65 cluster_replication.apply_status
|
||||
master-bin.000001 368 Write_rows 1 107
|
||||
master-bin.000001 410 Table_map 1 147 test.t1
|
||||
master-bin.000001 450 Write_rows 1 818
|
||||
master-bin.000001 1121 Write_rows 1 9853
|
||||
master-bin.000001 10156 Query 1 10221 COMMIT
|
||||
master-bin.000001 10221 Query 1 10285 BEGIN
|
||||
master-bin.000001 10285 Table_map 1 65 cluster_replication.apply_status
|
||||
master-bin.000001 10350 Write_rows 1 107
|
||||
master-bin.000001 10392 Query 1 10457 COMMIT
|
||||
master-bin.000001 10457 Query 1 10533 use `test`; drop table t1
|
||||
master-bin.000001 10533 Query 1 10708 use `test`; create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null,
|
||||
c int,
|
||||
d longblob,
|
||||
e tinyblob
|
||||
) engine=ndbcluster
|
||||
master-bin.000001 10708 Query 1 10772 BEGIN
|
||||
master-bin.000001 10772 Table_map 1 65 cluster_replication.apply_status
|
||||
master-bin.000001 10837 Write_rows 1 107
|
||||
master-bin.000001 10879 Table_map 1 150 test.t1
|
||||
master-bin.000001 10922 Write_rows 1 48934
|
||||
master-bin.000001 59706 Write_rows 1 124436
|
||||
master-bin.000001 135208 Write_rows 1 124542
|
||||
master-bin.000001 135314 Write_rows 1 205961
|
||||
master-bin.000001 216733 Write_rows 1 224245
|
||||
master-bin.000001 235017 Write_rows 1 227523
|
||||
master-bin.000001 238295 Write_rows 1 242391
|
||||
master-bin.000001 253163 Write_rows 1 254087
|
||||
master-bin.000001 264859 Write_rows 1 304335
|
||||
master-bin.000001 315107 Write_rows 1 330427
|
||||
master-bin.000001 341199 Query 1 341264 COMMIT
|
||||
master-bin.000001 341264 Query 1 341328 BEGIN
|
||||
master-bin.000001 341328 Table_map 1 65 cluster_replication.apply_status
|
||||
master-bin.000001 341393 Write_rows 1 107
|
||||
master-bin.000001 341435 Query 1 341500 COMMIT
|
||||
master-bin.000001 341500 Query 1 341576 use `test`; drop table t1
|
@@ -401,5 +401,18 @@ drop function f1;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(col VARCHAR(10));
|
||||
CREATE PROCEDURE p1(arg VARCHAR(10))
|
||||
INSERT INTO t1 VALUES(arg);
|
||||
CALL p1('test');
|
||||
SELECT * FROM t1;
|
||||
col
|
||||
test
|
||||
SELECT * FROM t1;
|
||||
col
|
||||
test
|
||||
DROP PROCEDURE p1;
|
||||
drop table t1;
|
||||
reset master;
|
||||
|
@@ -1115,3 +1115,22 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
|
||||
drop function bug11555_1;
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
drop procedure if exists ` bug15658`;
|
||||
create procedure ``() select 1;
|
||||
ERROR 42000: Incorrect routine name ''
|
||||
create procedure ` `() select 1;
|
||||
ERROR 42000: Incorrect routine name ' '
|
||||
create procedure `bug15658 `() select 1;
|
||||
ERROR 42000: Incorrect routine name 'bug15658 '
|
||||
create procedure ``.bug15658() select 1;
|
||||
ERROR 42000: Incorrect database name ''
|
||||
create procedure `x `.bug15658() select 1;
|
||||
ERROR 42000: Incorrect database name 'x '
|
||||
create procedure ` bug15658`() select 1;
|
||||
call ` bug15658`();
|
||||
1
|
||||
1
|
||||
show procedure status;
|
||||
Db Name Type Definer Modified Created Security_type Comment
|
||||
test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
drop procedure ` bug15658`;
|
||||
|
@@ -263,3 +263,24 @@ CREATE VIEW v1 AS SELECT test.bug12812()|
|
||||
ERROR 42000: execute command denied to user 'user_bug12812'@'localhost' for routine 'test.bug12812'
|
||||
DROP USER user_bug12812@localhost|
|
||||
drop function bug12812|
|
||||
create database db_bug14834;
|
||||
create user user1_bug14834@localhost identified by '';
|
||||
grant all on `db\_bug14834`.* to user1_bug14834@localhost;
|
||||
create user user2_bug14834@localhost identified by '';
|
||||
grant all on `db\_bug14834`.* to user2_bug14834@localhost;
|
||||
create user user3_bug14834@localhost identified by '';
|
||||
grant all on `db__ug14834`.* to user3_bug14834@localhost;
|
||||
create procedure p_bug14834() select user(), current_user();
|
||||
call p_bug14834();
|
||||
user() current_user()
|
||||
user1_bug14834@localhost user1_bug14834@localhost
|
||||
call p_bug14834();
|
||||
user() current_user()
|
||||
user2_bug14834@localhost user1_bug14834@localhost
|
||||
call p_bug14834();
|
||||
user() current_user()
|
||||
user3_bug14834@localhost user1_bug14834@localhost
|
||||
drop user user1_bug14834@localhost;
|
||||
drop user user2_bug14834@localhost;
|
||||
drop user user3_bug14834@localhost;
|
||||
drop database db_bug14834;
|
||||
|
@@ -1178,8 +1178,8 @@ drop view v2|
|
||||
delete from t1 |
|
||||
delete from t2 |
|
||||
drop table t4|
|
||||
drop table if exists fac|
|
||||
create table fac (n int unsigned not null primary key, f bigint unsigned)|
|
||||
drop table if exists t3|
|
||||
create table t3 (n int unsigned not null primary key, f bigint unsigned)|
|
||||
drop procedure if exists ifac|
|
||||
create procedure ifac(n int unsigned)
|
||||
begin
|
||||
@@ -1189,13 +1189,13 @@ set n = 20; # bigint overflow otherwise
|
||||
end if;
|
||||
while i <= n do
|
||||
begin
|
||||
insert into test.fac values (i, fac(i));
|
||||
insert into test.t3 values (i, fac(i));
|
||||
set i = i + 1;
|
||||
end;
|
||||
end while;
|
||||
end|
|
||||
call ifac(20)|
|
||||
select * from fac|
|
||||
select * from t3|
|
||||
n f
|
||||
1 1
|
||||
2 2
|
||||
@@ -1217,7 +1217,7 @@ n f
|
||||
18 6402373705728000
|
||||
19 121645100408832000
|
||||
20 2432902008176640000
|
||||
drop table fac|
|
||||
drop table t3|
|
||||
show function status like '%f%'|
|
||||
Db Name Type Definer Modified Created Security_type Comment
|
||||
test fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
@@ -1225,12 +1225,12 @@ drop procedure ifac|
|
||||
drop function fac|
|
||||
show function status like '%f%'|
|
||||
Db Name Type Definer Modified Created Security_type Comment
|
||||
drop table if exists primes|
|
||||
create table primes (
|
||||
drop table if exists t3|
|
||||
create table t3 (
|
||||
i int unsigned not null primary key,
|
||||
p bigint unsigned not null
|
||||
)|
|
||||
insert into primes values
|
||||
insert into t3 values
|
||||
( 0, 3), ( 1, 5), ( 2, 7), ( 3, 11), ( 4, 13),
|
||||
( 5, 17), ( 6, 19), ( 7, 23), ( 8, 29), ( 9, 31),
|
||||
(10, 37), (11, 41), (12, 43), (13, 47), (14, 53),
|
||||
@@ -1253,7 +1253,7 @@ set b = b+200, s = 0;
|
||||
else
|
||||
begin
|
||||
declare p bigint unsigned;
|
||||
select t.p into p from test.primes t where t.i = s;
|
||||
select t.p into p from test.t3 t where t.i = s;
|
||||
if b+p > r then
|
||||
set pp = 1;
|
||||
leave again;
|
||||
@@ -1278,7 +1278,7 @@ begin
|
||||
declare pp bool default 0;
|
||||
call opp(p, pp);
|
||||
if pp then
|
||||
insert into test.primes values (i, p);
|
||||
insert into test.t3 values (i, p);
|
||||
set i = i+1;
|
||||
end if;
|
||||
set p = p+2;
|
||||
@@ -1299,7 +1299,7 @@ set b = b+200, s = 0;
|
||||
else
|
||||
begin
|
||||
declare p bigint unsigned;
|
||||
select t.p into p from test.primes t where t.i = s;
|
||||
select t.p into p from test.t3 t where t.i = s;
|
||||
if b+p > r then
|
||||
set pp = 1;
|
||||
leave again;
|
||||
@@ -1318,47 +1318,47 @@ Db Name Type Definer Modified Created Security_type Comment
|
||||
test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
call ip(200)|
|
||||
select * from primes where i=45 or i=100 or i=199|
|
||||
select * from t3 where i=45 or i=100 or i=199|
|
||||
i p
|
||||
45 211
|
||||
100 557
|
||||
199 1229
|
||||
drop table primes|
|
||||
drop table t3|
|
||||
drop procedure opp|
|
||||
drop procedure ip|
|
||||
show procedure status like '%p%'|
|
||||
Db Name Type Definer Modified Created Security_type Comment
|
||||
drop table if exists fib|
|
||||
create table fib ( f bigint unsigned not null )|
|
||||
drop table if exists t3|
|
||||
create table t3 ( f bigint unsigned not null )|
|
||||
drop procedure if exists fib|
|
||||
create procedure fib(n int unsigned)
|
||||
begin
|
||||
if n > 1 then
|
||||
begin
|
||||
declare x, y bigint unsigned;
|
||||
declare c cursor for select f from fib order by f desc limit 2;
|
||||
declare c cursor for select f from t3 order by f desc limit 2;
|
||||
open c;
|
||||
fetch c into y;
|
||||
fetch c into x;
|
||||
close c;
|
||||
insert into fib values (x+y);
|
||||
insert into t3 values (x+y);
|
||||
call fib(n-1);
|
||||
end;
|
||||
end if;
|
||||
end|
|
||||
set @@max_sp_recursion_depth= 20|
|
||||
insert into fib values (0), (1)|
|
||||
insert into t3 values (0), (1)|
|
||||
call fib(3)|
|
||||
select * from fib order by f asc|
|
||||
select * from t3 order by f asc|
|
||||
f
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
delete from fib|
|
||||
insert into fib values (0), (1)|
|
||||
call fib(20)|
|
||||
select * from fib order by f asc|
|
||||
delete from t3|
|
||||
insert into t3 values (0), (1)|
|
||||
call fib(10)|
|
||||
select * from t3 order by f asc|
|
||||
f
|
||||
0
|
||||
1
|
||||
@@ -1371,17 +1371,7 @@ f
|
||||
21
|
||||
34
|
||||
55
|
||||
89
|
||||
144
|
||||
233
|
||||
377
|
||||
610
|
||||
987
|
||||
1597
|
||||
2584
|
||||
4181
|
||||
6765
|
||||
drop table fib|
|
||||
drop table t3|
|
||||
drop procedure fib|
|
||||
set @@max_sp_recursion_depth= 0|
|
||||
drop procedure if exists bar|
|
||||
|
@@ -1,4 +1,4 @@
|
||||
drop table if exists t1, t2;
|
||||
drop table if exists t1, t2, t3;
|
||||
drop procedure if exists bug8850|
|
||||
create table t1 (a int) engine=innodb|
|
||||
create procedure bug8850()
|
||||
|
@@ -215,9 +215,9 @@ select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from
|
||||
a
|
||||
select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
|
||||
b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
|
||||
8 7.5000
|
||||
8 4.5000
|
||||
9 7.5000
|
||||
8 7.5
|
||||
8 4.5
|
||||
9 7.5
|
||||
explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t4 ALL NULL NULL NULL NULL 3
|
||||
|
@@ -46,6 +46,7 @@ db CREATE TABLE `db` (
|
||||
`Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Event_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Trigger_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`),
|
||||
KEY `User` (`User`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
|
||||
@@ -71,6 +72,7 @@ host CREATE TABLE `host` (
|
||||
`Create_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Trigger_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
PRIMARY KEY (`Host`,`Db`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges'
|
||||
show create table user;
|
||||
@@ -106,6 +108,7 @@ user CREATE TABLE `user` (
|
||||
`Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_user_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Event_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Trigger_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`ssl_type` enum('','ANY','X509','SPECIFIED') character set utf8 NOT NULL default '',
|
||||
`ssl_cipher` blob NOT NULL,
|
||||
`x509_issuer` blob NOT NULL,
|
||||
@@ -134,7 +137,7 @@ tables_priv CREATE TABLE `tables_priv` (
|
||||
`Table_name` char(64) collate utf8_bin NOT NULL default '',
|
||||
`Grantor` char(77) collate utf8_bin NOT NULL default '',
|
||||
`Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') character set utf8 NOT NULL default '',
|
||||
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') character set utf8 NOT NULL default '',
|
||||
`Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
|
@@ -110,109 +110,6 @@ user_str
|
||||
mysqltest_dfn@localhost
|
||||
mysqltest_dfn@localhost
|
||||
|
||||
---> connection: default
|
||||
use mysqltest_db1;
|
||||
REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
|
||||
|
||||
---> connection: wl2818_definer_con
|
||||
use mysqltest_db1;
|
||||
DROP TRIGGER trg1;
|
||||
SET @new_sum = 0;
|
||||
SET @old_sum = 0;
|
||||
---> INSERT INTO statement; BEFORE timing
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
INSERT INTO t1 VALUES(4);
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> INSERT INTO statement; AFTER timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
INSERT INTO t1 VALUES(5);
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> UPDATE statement; BEFORE timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 BEFORE UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
UPDATE t1 SET num_value = 10;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> UPDATE statement; AFTER timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 AFTER UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
UPDATE t1 SET num_value = 20;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> DELETE statement; BEFORE timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
DELETE FROM t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> DELETE statement; AFTER timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 AFTER DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
DELETE FROM t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
|
||||
---> connection: default
|
||||
use mysqltest_db1;
|
||||
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
|
||||
REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
|
||||
|
||||
---> connection: wl2818_definer_con
|
||||
use mysqltest_db1;
|
||||
DROP TRIGGER trg1;
|
||||
SET @new_sum = 0;
|
||||
SET @old_sum = 0;
|
||||
---> INSERT INTO statement; BEFORE timing
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
INSERT INTO t1 VALUES(4);
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> INSERT INTO statement; AFTER timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
INSERT INTO t1 VALUES(5);
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> UPDATE statement; BEFORE timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 BEFORE UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
UPDATE t1 SET num_value = 10;
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> UPDATE statement; AFTER timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 AFTER UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
UPDATE t1 SET num_value = 20;
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> DELETE statement; BEFORE timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
DELETE FROM t1;
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
---> DELETE statement; AFTER timing
|
||||
DROP TRIGGER trg1;
|
||||
CREATE TRIGGER trg1 AFTER DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
DELETE FROM t1;
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_dfn'@'localhost' for table 't1'
|
||||
|
||||
---> connection: wl2818_definer_con
|
||||
use mysqltest_db1;
|
||||
DROP TRIGGER trg1;
|
||||
@@ -284,3 +181,185 @@ DROP USER mysqltest_inv@localhost;
|
||||
DROP DATABASE mysqltest_db1;
|
||||
Warnings:
|
||||
Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
|
||||
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
|
||||
DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
|
||||
DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
|
||||
DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
|
||||
FLUSH PRIVILEGES;
|
||||
DROP DATABASE IF EXISTS mysqltest_db1;
|
||||
CREATE DATABASE mysqltest_db1;
|
||||
use mysqltest_db1;
|
||||
CREATE TABLE t1(col CHAR(20));
|
||||
CREATE TABLE t2(col CHAR(20));
|
||||
CREATE TABLE t3(col CHAR(20));
|
||||
CREATE TABLE t4(col CHAR(20));
|
||||
CREATE USER mysqltest_u1@localhost;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
|
||||
GRANT TRIGGER ON mysqltest_db1.* TO mysqltest_u1@localhost;
|
||||
SET @mysqltest_var = NULL;
|
||||
|
||||
---> connection: default
|
||||
use mysqltest_db1;
|
||||
GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
|
||||
SHOW GRANTS FOR mysqltest_u1@localhost;
|
||||
Grants for mysqltest_u1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost'
|
||||
GRANT DELETE, TRIGGER ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost'
|
||||
|
||||
---> connection: bug15166_u1_con
|
||||
use mysqltest_db1;
|
||||
CREATE TRIGGER t1_trg_after_delete AFTER DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = 'Hello, world!';
|
||||
|
||||
---> connection: default
|
||||
use mysqltest_db1;
|
||||
GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
||||
|
||||
---> connection: bug15166_u1_con
|
||||
use mysqltest_db1;
|
||||
CREATE TRIGGER t1_trg_err_1 BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = NEW.col;
|
||||
DROP TRIGGER t1_trg_err_1;
|
||||
CREATE TRIGGER t1_trg_err_2 BEFORE DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = OLD.col;
|
||||
DROP TRIGGER t1_trg_err_2;
|
||||
CREATE TRIGGER t2_trg_before_insert BEFORE INSERT ON t2
|
||||
FOR EACH ROW
|
||||
SET NEW.col = 't2_trg_before_insert';
|
||||
CREATE TRIGGER t3_trg_err_1 BEFORE INSERT ON t3
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = NEW.col;
|
||||
DROP TRIGGER t3_trg_err_1;
|
||||
CREATE TRIGGER t3_trg_err_2 BEFORE DELETE ON t3
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = OLD.col;
|
||||
DROP TRIGGER t3_trg_err_2;
|
||||
CREATE TRIGGER t4_trg_before_insert BEFORE INSERT ON t4
|
||||
FOR EACH ROW
|
||||
SET NEW.col = 't4_trg_before_insert';
|
||||
|
||||
---> connection: default
|
||||
use mysqltest_db1;
|
||||
REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
||||
REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
||||
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
||||
GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
||||
REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
||||
REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
||||
GRANT SELECT(col) on mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
||||
GRANT SELECT(col) on mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
||||
|
||||
---> connection: bug15166_u1_con
|
||||
use mysqltest_db1;
|
||||
CREATE TRIGGER t1_trg_after_insert AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = NEW.col;
|
||||
CREATE TRIGGER t1_trg_after_update AFTER UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = OLD.col;
|
||||
CREATE TRIGGER t2_trg_err_1 BEFORE UPDATE ON t2
|
||||
FOR EACH ROW
|
||||
SET NEW.col = 't2_trg_err_1';
|
||||
DROP TRIGGER t2_trg_err_1;
|
||||
CREATE TRIGGER t2_trg_err_2 BEFORE UPDATE ON t2
|
||||
FOR EACH ROW
|
||||
SET NEW.col = CONCAT(OLD.col, '(updated)');
|
||||
DROP TRIGGER t2_trg_err_2;
|
||||
CREATE TRIGGER t3_trg_after_insert AFTER INSERT ON t3
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = NEW.col;
|
||||
CREATE TRIGGER t3_trg_after_update AFTER UPDATE ON t3
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = OLD.col;
|
||||
CREATE TRIGGER t4_trg_err_1 BEFORE UPDATE ON t4
|
||||
FOR EACH ROW
|
||||
SET NEW.col = 't4_trg_err_1';
|
||||
DROP TRIGGER t4_trg_err_1;
|
||||
CREATE TRIGGER t4_trg_err_2 BEFORE UPDATE ON t4
|
||||
FOR EACH ROW
|
||||
SET NEW.col = CONCAT(OLD.col, '(updated)');
|
||||
DROP TRIGGER t4_trg_err_2;
|
||||
|
||||
---> connection: default
|
||||
use mysqltest_db1;
|
||||
REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
||||
REVOKE SELECT ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
||||
GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
||||
REVOKE SELECT(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
||||
REVOKE SELECT(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
||||
GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
||||
INSERT INTO t1 VALUES('line1');
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for column 'col' in table 't1'
|
||||
SELECT * FROM t1;
|
||||
col
|
||||
line1
|
||||
SELECT @mysqltest_var;
|
||||
@mysqltest_var
|
||||
NULL
|
||||
INSERT INTO t2 VALUES('line2');
|
||||
SELECT * FROM t2;
|
||||
col
|
||||
t2_trg_before_insert
|
||||
INSERT INTO t3 VALUES('t3_line1');
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for column 'col' in table 't3'
|
||||
SELECT * FROM t3;
|
||||
col
|
||||
t3_line1
|
||||
SELECT @mysqltest_var;
|
||||
@mysqltest_var
|
||||
NULL
|
||||
INSERT INTO t4 VALUES('t4_line2');
|
||||
SELECT * FROM t4;
|
||||
col
|
||||
t4_trg_before_insert
|
||||
|
||||
---> connection: default
|
||||
use mysqltest_db1;
|
||||
REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
||||
REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
||||
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
||||
GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
||||
REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
||||
REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
||||
GRANT SELECT(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
||||
GRANT SELECT(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
||||
INSERT INTO t1 VALUES('line3');
|
||||
SELECT * FROM t1;
|
||||
col
|
||||
line1
|
||||
line3
|
||||
SELECT @mysqltest_var;
|
||||
@mysqltest_var
|
||||
line3
|
||||
INSERT INTO t2 VALUES('line4');
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_u1'@'localhost' for column 'col' in table 't2'
|
||||
SELECT * FROM t2;
|
||||
col
|
||||
t2_trg_before_insert
|
||||
INSERT INTO t3 VALUES('t3_line2');
|
||||
SELECT * FROM t3;
|
||||
col
|
||||
t3_line1
|
||||
t3_line2
|
||||
SELECT @mysqltest_var;
|
||||
@mysqltest_var
|
||||
t3_line2
|
||||
INSERT INTO t4 VALUES('t4_line2');
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_u1'@'localhost' for column 'col' in table 't4'
|
||||
SELECT * FROM t4;
|
||||
col
|
||||
t4_trg_before_insert
|
||||
DELETE FROM t1;
|
||||
SELECT @mysqltest_var;
|
||||
@mysqltest_var
|
||||
Hello, world!
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
DROP DATABASE mysqltest_db1;
|
||||
|
@@ -240,6 +240,28 @@ t3 CREATE TABLE `t3` (
|
||||
`d` double(22,9) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t2, t3;
|
||||
create table t1 select 105213674794682365.00 + 0.0 x;
|
||||
show warnings;
|
||||
Level Code Message
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
x decimal(21,2) unsigned NO 0.00
|
||||
drop table t1;
|
||||
create table t1 select 0.0 x;
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
x decimal(2,1) unsigned NO 0.0
|
||||
create table t2 select 105213674794682365.00 y;
|
||||
desc t2;
|
||||
Field Type Null Key Default Extra
|
||||
y decimal(20,2) unsigned NO 0.00
|
||||
create table t3 select x+y a from t1,t2;
|
||||
show warnings;
|
||||
Level Code Message
|
||||
desc t3;
|
||||
Field Type Null Key Default Extra
|
||||
a decimal(21,2) unsigned NO 0.00
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (s1 float(0,2));
|
||||
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
|
||||
create table t1 (s1 float(1,2));
|
||||
|
@@ -415,3 +415,10 @@ t1 CREATE TABLE `t1` (
|
||||
KEY `index1` (`f1`(10))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(f1 VARCHAR(100) DEFAULT 'test');
|
||||
INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(f1 CHAR(100) DEFAULT 'test');
|
||||
INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
@@ -28,9 +28,6 @@ rpl_sp : Bug #16456
|
||||
#ndb_dd_disk2memory : Bug #16466
|
||||
ndb_autodiscover : Needs to be fixed w.r.t binlog
|
||||
ndb_autodiscover2 : Needs to be fixed w.r.t binlog
|
||||
ndb_blob : BLOB replication causes core in master1 (Pekka will fix)
|
||||
system_mysql_db : Needs fixing
|
||||
system_mysql_db_fix : Needs fixing
|
||||
#ndb_alter_table_row : sometimes wrong error 1015!=1046
|
||||
ndb_gis : garbled msgs from corrupt THD*
|
||||
ndb_binlog_ddl_multi : Bug #17038
|
||||
|
@@ -209,6 +209,14 @@ insert into t1 values('test test '),('test'),('test'),('test'),
|
||||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
|
||||
('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test');
|
||||
delete from t1 limit 1;
|
||||
|
||||
#
|
||||
# BUG#16489: utf8 + fulltext leads to corrupt index file.
|
||||
#
|
||||
truncate table t1;
|
||||
insert into t1 values('ab c d');
|
||||
update t1 set a='ab c d';
|
||||
select * from t1 where match a against('ab c' in boolean mode);
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
|
||||
|
@@ -121,7 +121,9 @@ drop table t1;
|
||||
#
|
||||
# InnoDB is required to reproduce the fault, but it is okay if we default to
|
||||
# MyISAM when testing.
|
||||
--disable_warnings
|
||||
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
|
||||
--enable_warnings
|
||||
insert into t1 values ('http://www.foo.com/', now());
|
||||
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
|
||||
drop table t1;
|
||||
|
@@ -794,6 +794,29 @@ DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION func1;
|
||||
DROP FUNCTION func2;
|
||||
|
||||
#
|
||||
# Bug #15851 Unlistable directories yield no info from information_schema
|
||||
#
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1(a int);
|
||||
--exec chmod -r $MYSQL_TEST_DIR/var/master-data/mysqltest
|
||||
select table_schema from information_schema.tables where table_schema='mysqltest';
|
||||
--exec chmod +r $MYSQL_TEST_DIR/var/master-data/mysqltest
|
||||
drop database mysqltest;
|
||||
|
||||
#
|
||||
# Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
|
||||
#
|
||||
select column_type, group_concat(table_schema, '.', table_name), count(*) as num
|
||||
from information_schema.columns where
|
||||
table_schema='information_schema' and
|
||||
(column_type = 'varchar(7)' or column_type = 'varchar(20)')
|
||||
group by column_type order by num;
|
||||
|
||||
#
|
||||
# End of 5.0 tests.
|
||||
#
|
||||
# Show engines
|
||||
#
|
||||
|
||||
|
@@ -348,7 +348,7 @@ select count(*)
|
||||
select * from t9_c) a;
|
||||
|
||||
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-2 2>&1 | grep Translate || true
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -b 2 -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-2 2>&1 | grep Translate || true
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
|
@@ -269,26 +269,71 @@ insert into t1 values (1,1),(2,2),(3,3);
|
||||
|
||||
explain partitions select * from t1 where b > 1 and b < 3;
|
||||
explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2);
|
||||
drop table t1;
|
||||
|
||||
# WL# 2986
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
# Test partition pruning for single-table UPDATE/DELETE.
|
||||
# TODO: Currently we test only "all partitions pruned away" case. Add more
|
||||
# tests when the patch that makes use of partition pruning results at
|
||||
# execution phase is pushed.
|
||||
|
||||
create table t1 (a int) partition by list(a) (
|
||||
partition p0 values in (1,2),
|
||||
partition p1 values in (3,4)
|
||||
);
|
||||
insert into t1 values (1),(1),(2),(2),(3),(4),(3),(4);
|
||||
|
||||
# This won't do any table access
|
||||
flush status;
|
||||
update t1 set a=100 where a=5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
|
||||
# ... as compared to this, which will scan both partitions
|
||||
flush status;
|
||||
update t1 set a=100 where a+1=5+1;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
|
||||
# Same as above for DELETE:
|
||||
flush status;
|
||||
delete from t1 where a=5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
|
||||
flush status;
|
||||
delete from t1 where a+1=5+1;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
|
||||
# Same as above multi-table UPDATE/DELETE
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t2;
|
||||
|
||||
flush status;
|
||||
update t1,t2 set t1.a=1000, t2.a=1000 where t1.a=5 and t2.a=5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
# ^ This shows 3 accesses, these are caused by const table reads.
|
||||
# They should vanish when partition pruning results are used.
|
||||
|
||||
flush status;
|
||||
delete t1,t2 from t1, t2 where t1.a=5 and t2.a=5;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# WL#2986 Tests (Checking if partition pruning results are used at query
|
||||
# execution phase)
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) default NULL,
|
||||
KEY `a` (`a`)
|
||||
) ;
|
||||
|
||||
insert into t2 select A.a + 10*(B.a + 10* C.a) from t1 A, t1 B, t1 C ;
|
||||
|
||||
insert into t1 select a from t2;
|
||||
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
drop table t2;
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) default NULL,
|
||||
`b` int(11) default NULL
|
||||
@@ -331,8 +376,7 @@ flush status;
|
||||
delete from t2 where a > 600;
|
||||
show status like 'Handler_read_rnd_next';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `t2`;
|
||||
drop table t2;
|
||||
CREATE TABLE `t2` (
|
||||
`a` int(11) default NULL,
|
||||
`b` int(11) default NULL,
|
||||
@@ -402,5 +446,6 @@ show status like 'Handler_read_prev';
|
||||
show status like 'Handler_read_next';
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
|
||||
# being fixed.
|
||||
|
1
mysql-test/t/rpl_multi_update4-slave.opt
Normal file
1
mysql-test/t/rpl_multi_update4-slave.opt
Normal file
@@ -0,0 +1 @@
|
||||
--replicate-wild-do-table=d1.%
|
44
mysql-test/t/rpl_multi_update4.test
Normal file
44
mysql-test/t/rpl_multi_update4.test
Normal file
@@ -0,0 +1,44 @@
|
||||
# Let's verify that multi-update is not always skipped by slave if
|
||||
# some replicate-* rules exist.
|
||||
# (BUG#15699)
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
### Clean-up
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
drop database if exists d1;
|
||||
drop database if exists d2;
|
||||
|
||||
connection slave;
|
||||
drop database if exists d2;
|
||||
--enable_warnings
|
||||
|
||||
### Test
|
||||
|
||||
connection master;
|
||||
create database d1; # accepted by slave
|
||||
create table d1.t0 (id int);
|
||||
create database d2; # ignored by slave
|
||||
use d2;
|
||||
create table t1 (id int);
|
||||
create table t2 (id int);
|
||||
insert into t1 values (1), (2), (3), (4), (5);
|
||||
insert into t2 select id + 3 from t1;
|
||||
# a problematic query which must be filter out by slave
|
||||
update t1 join t2 using (id) set t1.id = 0;
|
||||
insert into d1.t0 values (0); # replication works
|
||||
|
||||
sync_slave_with_master;
|
||||
use d1;
|
||||
#connection slave;
|
||||
select * from t0 where id=0; # must find
|
||||
|
||||
### Clean-up
|
||||
connection master;
|
||||
drop database d1;
|
||||
drop database d2;
|
||||
|
||||
|
||||
# End of test
|
93
mysql-test/t/rpl_ndb_blob.test
Normal file
93
mysql-test/t/rpl_ndb_blob.test
Normal file
@@ -0,0 +1,93 @@
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
#
|
||||
# basic test of blob replication for NDB
|
||||
#
|
||||
|
||||
# easy test
|
||||
|
||||
--connection master
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null
|
||||
) engine=ndb;
|
||||
|
||||
insert into t1 values(1, repeat('abc',10));
|
||||
insert into t1 values(2, repeat('def',200));
|
||||
insert into t1 values(3, repeat('ghi',3000));
|
||||
|
||||
select 'M', a, sha1(b) from t1
|
||||
order by a;
|
||||
|
||||
--sync_slave_with_master
|
||||
--sleep 5
|
||||
--connection slave
|
||||
select 'S', a, sha1(b) from t1
|
||||
order by a;
|
||||
|
||||
--connection master
|
||||
drop table t1;
|
||||
--sync_slave_with_master
|
||||
|
||||
# hard test
|
||||
|
||||
--connection master
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null,
|
||||
c int,
|
||||
d longblob,
|
||||
e tinyblob
|
||||
) engine=ndbcluster;
|
||||
|
||||
--disable_query_log
|
||||
# length 61
|
||||
set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau';
|
||||
set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz';
|
||||
set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah';
|
||||
--enable_query_log
|
||||
|
||||
insert into t1 values (
|
||||
0, repeat(@s2,454), 100, repeat(@s2,345), NULL);
|
||||
insert into t1 values (
|
||||
1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
2, '', 102, '', repeat(@s2,1));
|
||||
insert into t1 values (
|
||||
3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1));
|
||||
insert into t1 values (
|
||||
4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1));
|
||||
insert into t1 values (
|
||||
5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
6, repeat(@s1,242), 106, NULL, repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
7, repeat(@s1,30), 107, repeat(@s0,161), '');
|
||||
insert into t1 values (
|
||||
8, repeat(@s1,719), 108, repeat(@s2,104), NULL);
|
||||
insert into t1 values (
|
||||
9, repeat(@s2,427), NULL, NULL, NULL);
|
||||
|
||||
select 'M', a, sha1(b), c, sha1(d), sha1(e)
|
||||
from t1 order by a;
|
||||
|
||||
--sync_slave_with_master
|
||||
--sleep 5
|
||||
--connection slave
|
||||
select 'S', a, sha1(b), c, sha1(d), sha1(e)
|
||||
from t1 order by a;
|
||||
|
||||
--connection master
|
||||
drop table t1;
|
||||
--sync_slave_with_master
|
||||
|
||||
#
|
||||
# view the binlog
|
||||
#
|
||||
|
||||
--connection master
|
||||
let $VERSION=`select version()`;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
@@ -403,6 +403,42 @@ sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
|
||||
#
|
||||
# Bug#16621 "INSERTs in Stored Procedures causes data corruption in the Binary
|
||||
# Log for 5.0.18"
|
||||
#
|
||||
|
||||
# Prepare environment.
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
# Test case.
|
||||
|
||||
CREATE TABLE t1(col VARCHAR(10));
|
||||
|
||||
CREATE PROCEDURE p1(arg VARCHAR(10))
|
||||
INSERT INTO t1 VALUES(arg);
|
||||
|
||||
CALL p1('test');
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Cleanup.
|
||||
|
||||
connection master;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
# cleanup
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
@@ -1534,6 +1534,7 @@ drop procedure bug13012_1|
|
||||
drop function bug13012_2|
|
||||
delimiter ;|
|
||||
|
||||
#
|
||||
# BUG#11555 "Stored procedures: current SP tables locking make
|
||||
# impossible view security". We should not expose names of tables
|
||||
# which are implicitly used by view (via stored routines/triggers).
|
||||
@@ -1594,7 +1595,33 @@ drop function bug11555_1;
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# BUG#15658: Server crashes after creating function as empty string
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists ` bug15658`;
|
||||
--enable_warnings
|
||||
|
||||
--error ER_SP_WRONG_NAME
|
||||
create procedure ``() select 1;
|
||||
--error ER_SP_WRONG_NAME
|
||||
create procedure ` `() select 1;
|
||||
--error ER_SP_WRONG_NAME
|
||||
create procedure `bug15658 `() select 1;
|
||||
--error ER_WRONG_DB_NAME
|
||||
create procedure ``.bug15658() select 1;
|
||||
--error ER_WRONG_DB_NAME
|
||||
create procedure `x `.bug15658() select 1;
|
||||
|
||||
# This should work
|
||||
create procedure ` bug15658`() select 1;
|
||||
call ` bug15658`();
|
||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
show procedure status;
|
||||
drop procedure ` bug15658`;
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
#--disable_warnings
|
||||
|
@@ -437,4 +437,48 @@ disconnect test_user_12812|
|
||||
DROP USER user_bug12812@localhost|
|
||||
drop function bug12812|
|
||||
delimiter ;|
|
||||
|
||||
|
||||
#
|
||||
# BUG#14834: Server denies to execute Stored Procedure
|
||||
#
|
||||
# The problem here was with '_' in the database name.
|
||||
#
|
||||
create database db_bug14834;
|
||||
|
||||
create user user1_bug14834@localhost identified by '';
|
||||
# The exact name of the database (no wildcard)
|
||||
grant all on `db\_bug14834`.* to user1_bug14834@localhost;
|
||||
|
||||
create user user2_bug14834@localhost identified by '';
|
||||
# The exact name of the database (no wildcard)
|
||||
grant all on `db\_bug14834`.* to user2_bug14834@localhost;
|
||||
|
||||
create user user3_bug14834@localhost identified by '';
|
||||
# Wildcards in the database name
|
||||
grant all on `db__ug14834`.* to user3_bug14834@localhost;
|
||||
|
||||
connect (user1_bug14834,localhost,user1_bug14834,,db_bug14834);
|
||||
# Create the procedure and check that we can call it
|
||||
create procedure p_bug14834() select user(), current_user();
|
||||
call p_bug14834();
|
||||
|
||||
connect (user2_bug14834,localhost,user2_bug14834,,db_bug14834);
|
||||
# This didn't work before
|
||||
call p_bug14834();
|
||||
|
||||
connect (user3_bug14834,localhost,user3_bug14834,,db_bug14834);
|
||||
# Should also work
|
||||
call p_bug14834();
|
||||
|
||||
# Cleanup
|
||||
connection default;
|
||||
disconnect user1_bug14834;
|
||||
disconnect user2_bug14834;
|
||||
disconnect user3_bug14834;
|
||||
drop user user1_bug14834@localhost;
|
||||
drop user user2_bug14834@localhost;
|
||||
drop user user3_bug14834@localhost;
|
||||
drop database db_bug14834;
|
||||
|
||||
# End of 5.0 bugs.
|
||||
|
@@ -1419,9 +1419,9 @@ drop table t4|
|
||||
# fac
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists fac|
|
||||
drop table if exists t3|
|
||||
--enable_warnings
|
||||
create table fac (n int unsigned not null primary key, f bigint unsigned)|
|
||||
create table t3 (n int unsigned not null primary key, f bigint unsigned)|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists ifac|
|
||||
@@ -1435,15 +1435,15 @@ begin
|
||||
end if;
|
||||
while i <= n do
|
||||
begin
|
||||
insert into test.fac values (i, fac(i));
|
||||
insert into test.t3 values (i, fac(i));
|
||||
set i = i + 1;
|
||||
end;
|
||||
end while;
|
||||
end|
|
||||
|
||||
call ifac(20)|
|
||||
select * from fac|
|
||||
drop table fac|
|
||||
select * from t3|
|
||||
drop table t3|
|
||||
--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
show function status like '%f%'|
|
||||
drop procedure ifac|
|
||||
@@ -1455,15 +1455,15 @@ show function status like '%f%'|
|
||||
# primes
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists primes|
|
||||
drop table if exists t3|
|
||||
--enable_warnings
|
||||
|
||||
create table primes (
|
||||
create table t3 (
|
||||
i int unsigned not null primary key,
|
||||
p bigint unsigned not null
|
||||
)|
|
||||
|
||||
insert into primes values
|
||||
insert into t3 values
|
||||
( 0, 3), ( 1, 5), ( 2, 7), ( 3, 11), ( 4, 13),
|
||||
( 5, 17), ( 6, 19), ( 7, 23), ( 8, 29), ( 9, 31),
|
||||
(10, 37), (11, 41), (12, 43), (13, 47), (14, 53),
|
||||
@@ -1492,7 +1492,7 @@ begin
|
||||
begin
|
||||
declare p bigint unsigned;
|
||||
|
||||
select t.p into p from test.primes t where t.i = s;
|
||||
select t.p into p from test.t3 t where t.i = s;
|
||||
if b+p > r then
|
||||
set pp = 1;
|
||||
leave again;
|
||||
@@ -1523,7 +1523,7 @@ begin
|
||||
|
||||
call opp(p, pp);
|
||||
if pp then
|
||||
insert into test.primes values (i, p);
|
||||
insert into test.t3 values (i, p);
|
||||
set i = i+1;
|
||||
end if;
|
||||
set p = p+2;
|
||||
@@ -1545,8 +1545,8 @@ call ip(200)|
|
||||
# 45 211
|
||||
# 100 557
|
||||
# 199 1229
|
||||
select * from primes where i=45 or i=100 or i=199|
|
||||
drop table primes|
|
||||
select * from t3 where i=45 or i=100 or i=199|
|
||||
drop table t3|
|
||||
drop procedure opp|
|
||||
drop procedure ip|
|
||||
--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
@@ -1556,9 +1556,9 @@ show procedure status like '%p%'|
|
||||
# Fibonacci, for recursion test. (Yet Another Numerical series :)
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists fib|
|
||||
drop table if exists t3|
|
||||
--enable_warnings
|
||||
create table fib ( f bigint unsigned not null )|
|
||||
create table t3 ( f bigint unsigned not null )|
|
||||
|
||||
# We deliberately do it the awkward way, fetching the last two
|
||||
# values from the table, in order to exercise various statements
|
||||
@@ -1571,13 +1571,13 @@ begin
|
||||
if n > 1 then
|
||||
begin
|
||||
declare x, y bigint unsigned;
|
||||
declare c cursor for select f from fib order by f desc limit 2;
|
||||
declare c cursor for select f from t3 order by f desc limit 2;
|
||||
|
||||
open c;
|
||||
fetch c into y;
|
||||
fetch c into x;
|
||||
close c;
|
||||
insert into fib values (x+y);
|
||||
insert into t3 values (x+y);
|
||||
call fib(n-1);
|
||||
end;
|
||||
end if;
|
||||
@@ -1588,22 +1588,23 @@ set @@max_sp_recursion_depth= 20|
|
||||
|
||||
# Minimum test: recursion of 3 levels
|
||||
|
||||
insert into fib values (0), (1)|
|
||||
insert into t3 values (0), (1)|
|
||||
|
||||
call fib(3)|
|
||||
|
||||
select * from fib order by f asc|
|
||||
select * from t3 order by f asc|
|
||||
|
||||
delete from fib|
|
||||
delete from t3|
|
||||
|
||||
# Original test: 20 levels (may run into memory limits!)
|
||||
# The original test, 20 levels, ran into memory limits on some machines
|
||||
# and builds. Try 10 instead...
|
||||
|
||||
insert into fib values (0), (1)|
|
||||
insert into t3 values (0), (1)|
|
||||
|
||||
call fib(20)|
|
||||
call fib(10)|
|
||||
|
||||
select * from fib order by f asc|
|
||||
drop table fib|
|
||||
select * from t3 order by f asc|
|
||||
drop table t3|
|
||||
drop procedure fib|
|
||||
set @@max_sp_recursion_depth= 0|
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
drop table if exists t1, t2, t3;
|
||||
--enable_warnings
|
||||
|
||||
delimiter |;
|
||||
|
@@ -8,8 +8,6 @@
|
||||
#
|
||||
# Tests for WL#2818:
|
||||
# - Check that triggers are executed under the authorization of the definer.
|
||||
# - Check that if trigger contains NEW/OLD variables, the definer must have
|
||||
# SELECT privilege on the subject table.
|
||||
# - Check DEFINER clause of CREATE TRIGGER statement;
|
||||
# - Check that SUPER privilege required to create a trigger with different
|
||||
# definer.
|
||||
@@ -18,6 +16,8 @@
|
||||
# - Check that the definer of a trigger does not exist, the trigger will
|
||||
# not be activated.
|
||||
# - Check that SHOW TRIGGERS statement provides "Definer" column.
|
||||
# - Check that if trigger contains NEW/OLD variables, the definer must have
|
||||
# SELECT privilege on the subject table (aka BUG#15166/BUG#15196).
|
||||
#
|
||||
# Let's also check that user name part of definer can contain '@' symbol (to
|
||||
# check that triggers are not affected by BUG#13310 "incorrect user parsing
|
||||
@@ -254,223 +254,6 @@ INSERT INTO t1 VALUES(3);
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
#
|
||||
# Check that if trigger contains NEW/OLD variables, the definer must have
|
||||
# SELECT/UPDATE privilege on the subject table:
|
||||
# - drop the trigger;
|
||||
# - create a new trigger, which will use NEW variable;
|
||||
# - create another new trigger, which will use OLD variable;
|
||||
# - revoke SELECT/UPDATE privilege on the first table from "definer";
|
||||
# - insert a row into the first table;
|
||||
# - analyze error code;
|
||||
#
|
||||
|
||||
#
|
||||
# SELECT privilege.
|
||||
#
|
||||
|
||||
--connection default
|
||||
--echo
|
||||
--echo ---> connection: default
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
|
||||
|
||||
--connection wl2818_definer_con
|
||||
--echo
|
||||
--echo ---> connection: wl2818_definer_con
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
SET @new_sum = 0;
|
||||
SET @old_sum = 0;
|
||||
|
||||
# INSERT INTO statement; BEFORE timing
|
||||
|
||||
--echo ---> INSERT INTO statement; BEFORE timing
|
||||
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
INSERT INTO t1 VALUES(4);
|
||||
|
||||
# INSERT INTO statement; AFTER timing
|
||||
|
||||
--echo ---> INSERT INTO statement; AFTER timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
INSERT INTO t1 VALUES(5);
|
||||
|
||||
# UPDATE statement; BEFORE timing
|
||||
|
||||
--echo ---> UPDATE statement; BEFORE timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 BEFORE UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
UPDATE t1 SET num_value = 10;
|
||||
|
||||
# UPDATE statement; AFTER timing
|
||||
|
||||
--echo ---> UPDATE statement; AFTER timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 AFTER UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
UPDATE t1 SET num_value = 20;
|
||||
|
||||
# DELETE statement; BEFORE timing
|
||||
|
||||
--echo ---> DELETE statement; BEFORE timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
DELETE FROM t1;
|
||||
|
||||
# DELETE statement; AFTER timing
|
||||
|
||||
--echo ---> DELETE statement; AFTER timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 AFTER DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
DELETE FROM t1;
|
||||
|
||||
#
|
||||
# UPDATE privilege
|
||||
#
|
||||
# NOTE: At the moment, UPDATE privilege is required if the trigger contains
|
||||
# NEW/OLD variables, whenever the trigger modifies them or not. Moreover,
|
||||
# UPDATE privilege is checked for whole table, not for individual columns.
|
||||
#
|
||||
# The following test cases should be changed when full support of UPDATE
|
||||
# privilege will be done.
|
||||
#
|
||||
|
||||
--connection default
|
||||
--echo
|
||||
--echo ---> connection: default
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
|
||||
REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
|
||||
|
||||
--connection wl2818_definer_con
|
||||
--echo
|
||||
--echo ---> connection: wl2818_definer_con
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
SET @new_sum = 0;
|
||||
SET @old_sum = 0;
|
||||
|
||||
# INSERT INTO statement; BEFORE timing
|
||||
|
||||
--echo ---> INSERT INTO statement; BEFORE timing
|
||||
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
INSERT INTO t1 VALUES(4);
|
||||
|
||||
# INSERT INTO statement; AFTER timing
|
||||
|
||||
--echo ---> INSERT INTO statement; AFTER timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
INSERT INTO t1 VALUES(5);
|
||||
|
||||
# UPDATE statement; BEFORE timing
|
||||
|
||||
--echo ---> UPDATE statement; BEFORE timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 BEFORE UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
UPDATE t1 SET num_value = 10;
|
||||
|
||||
# UPDATE statement; AFTER timing
|
||||
|
||||
--echo ---> UPDATE statement; AFTER timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 AFTER UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @new_sum = @new_sum + NEW.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
UPDATE t1 SET num_value = 20;
|
||||
|
||||
# DELETE statement; BEFORE timing
|
||||
|
||||
--echo ---> DELETE statement; BEFORE timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 BEFORE DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
DELETE FROM t1;
|
||||
|
||||
# DELETE statement; AFTER timing
|
||||
|
||||
--echo ---> DELETE statement; AFTER timing
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
|
||||
CREATE TRIGGER trg1 AFTER DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @old_sum = @old_sum + OLD.num_value;
|
||||
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
DELETE FROM t1;
|
||||
|
||||
#
|
||||
# Check DEFINER clause of CREATE TRIGGER statement.
|
||||
#
|
||||
@@ -603,3 +386,310 @@ DROP USER mysqltest_dfn@localhost;
|
||||
DROP USER mysqltest_inv@localhost;
|
||||
|
||||
DROP DATABASE mysqltest_db1;
|
||||
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
# BUG#15166: Wrong update [was: select/update] permissions required to execute
|
||||
# triggers.
|
||||
#
|
||||
# BUG#15196: Wrong select permission required to execute triggers.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# Prepare environment.
|
||||
#
|
||||
|
||||
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
|
||||
DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
|
||||
DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
|
||||
DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest_db1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqltest_db1;
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
# Tables for tesing table-level privileges:
|
||||
CREATE TABLE t1(col CHAR(20)); # table for "read-value" trigger
|
||||
CREATE TABLE t2(col CHAR(20)); # table for "write-value" trigger
|
||||
|
||||
# Tables for tesing column-level privileges:
|
||||
CREATE TABLE t3(col CHAR(20)); # table for "read-value" trigger
|
||||
CREATE TABLE t4(col CHAR(20)); # table for "write-value" trigger
|
||||
|
||||
CREATE USER mysqltest_u1@localhost;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
|
||||
GRANT TRIGGER ON mysqltest_db1.* TO mysqltest_u1@localhost;
|
||||
|
||||
SET @mysqltest_var = NULL;
|
||||
|
||||
--connect (bug15166_u1_con,localhost,mysqltest_u1,,mysqltest_db1)
|
||||
|
||||
# parsing (CREATE TRIGGER) time:
|
||||
# - check that nor SELECT either UPDATE is required to execute triggger w/o
|
||||
# NEW/OLD variables.
|
||||
|
||||
--connection default
|
||||
--echo
|
||||
--echo ---> connection: default
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
|
||||
SHOW GRANTS FOR mysqltest_u1@localhost;
|
||||
|
||||
--connection bug15166_u1_con
|
||||
--echo
|
||||
--echo ---> connection: bug15166_u1_con
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
CREATE TRIGGER t1_trg_after_delete AFTER DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = 'Hello, world!';
|
||||
|
||||
# parsing (CREATE TRIGGER) time:
|
||||
# - check that UPDATE is not enough to read the value;
|
||||
# - check that UPDATE is required to modify the value;
|
||||
|
||||
--connection default
|
||||
--echo
|
||||
--echo ---> connection: default
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
||||
|
||||
GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
||||
|
||||
--connection bug15166_u1_con
|
||||
--echo
|
||||
--echo ---> connection: bug15166_u1_con
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
# - table-level privileges
|
||||
|
||||
# TODO: check privileges at CREATE TRIGGER time.
|
||||
# --error ER_COLUMNACCESS_DENIED_ERROR
|
||||
CREATE TRIGGER t1_trg_err_1 BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = NEW.col;
|
||||
DROP TRIGGER t1_trg_err_1;
|
||||
|
||||
# TODO: check privileges at CREATE TRIGGER time.
|
||||
# --error ER_COLUMNACCESS_DENIED_ERROR
|
||||
CREATE TRIGGER t1_trg_err_2 BEFORE DELETE ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = OLD.col;
|
||||
DROP TRIGGER t1_trg_err_2;
|
||||
|
||||
CREATE TRIGGER t2_trg_before_insert BEFORE INSERT ON t2
|
||||
FOR EACH ROW
|
||||
SET NEW.col = 't2_trg_before_insert';
|
||||
|
||||
# - column-level privileges
|
||||
|
||||
# TODO: check privileges at CREATE TRIGGER time.
|
||||
# --error ER_COLUMNACCESS_DENIED_ERROR
|
||||
CREATE TRIGGER t3_trg_err_1 BEFORE INSERT ON t3
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = NEW.col;
|
||||
DROP TRIGGER t3_trg_err_1;
|
||||
|
||||
# TODO: check privileges at CREATE TRIGGER time.
|
||||
# --error ER_COLUMNACCESS_DENIED_ERROR
|
||||
CREATE TRIGGER t3_trg_err_2 BEFORE DELETE ON t3
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = OLD.col;
|
||||
DROP TRIGGER t3_trg_err_2;
|
||||
|
||||
CREATE TRIGGER t4_trg_before_insert BEFORE INSERT ON t4
|
||||
FOR EACH ROW
|
||||
SET NEW.col = 't4_trg_before_insert';
|
||||
|
||||
# parsing (CREATE TRIGGER) time:
|
||||
# - check that SELECT is required to read the value;
|
||||
# - check that SELECT is not enough to modify the value;
|
||||
|
||||
--connection default
|
||||
--echo
|
||||
--echo ---> connection: default
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
||||
REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
||||
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
||||
GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
||||
|
||||
REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
||||
REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
||||
GRANT SELECT(col) on mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
||||
GRANT SELECT(col) on mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
||||
|
||||
--connection bug15166_u1_con
|
||||
--echo
|
||||
--echo ---> connection: bug15166_u1_con
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
# - table-level privileges
|
||||
|
||||
CREATE TRIGGER t1_trg_after_insert AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = NEW.col;
|
||||
|
||||
CREATE TRIGGER t1_trg_after_update AFTER UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = OLD.col;
|
||||
|
||||
# TODO: check privileges at CREATE TRIGGER time.
|
||||
# --error ER_COLUMNACCESS_DENIED_ERROR
|
||||
CREATE TRIGGER t2_trg_err_1 BEFORE UPDATE ON t2
|
||||
FOR EACH ROW
|
||||
SET NEW.col = 't2_trg_err_1';
|
||||
DROP TRIGGER t2_trg_err_1;
|
||||
|
||||
# TODO: check privileges at CREATE TRIGGER time.
|
||||
# --error ER_COLUMNACCESS_DENIED_ERROR
|
||||
CREATE TRIGGER t2_trg_err_2 BEFORE UPDATE ON t2
|
||||
FOR EACH ROW
|
||||
SET NEW.col = CONCAT(OLD.col, '(updated)');
|
||||
DROP TRIGGER t2_trg_err_2;
|
||||
|
||||
# - column-level privileges
|
||||
|
||||
CREATE TRIGGER t3_trg_after_insert AFTER INSERT ON t3
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = NEW.col;
|
||||
|
||||
CREATE TRIGGER t3_trg_after_update AFTER UPDATE ON t3
|
||||
FOR EACH ROW
|
||||
SET @mysqltest_var = OLD.col;
|
||||
|
||||
# TODO: check privileges at CREATE TRIGGER time.
|
||||
# --error ER_COLUMNACCESS_DENIED_ERROR
|
||||
CREATE TRIGGER t4_trg_err_1 BEFORE UPDATE ON t4
|
||||
FOR EACH ROW
|
||||
SET NEW.col = 't4_trg_err_1';
|
||||
DROP TRIGGER t4_trg_err_1;
|
||||
|
||||
# TODO: check privileges at CREATE TRIGGER time.
|
||||
# --error ER_COLUMNACCESS_DENIED_ERROR
|
||||
CREATE TRIGGER t4_trg_err_2 BEFORE UPDATE ON t4
|
||||
FOR EACH ROW
|
||||
SET NEW.col = CONCAT(OLD.col, '(updated)');
|
||||
DROP TRIGGER t4_trg_err_2;
|
||||
|
||||
# execution time:
|
||||
# - check that UPDATE is not enough to read the value;
|
||||
# - check that UPDATE is required to modify the value;
|
||||
|
||||
--connection default
|
||||
--echo
|
||||
--echo ---> connection: default
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
||||
REVOKE SELECT ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
||||
GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
||||
|
||||
REVOKE SELECT(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
||||
REVOKE SELECT(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
||||
GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
||||
GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
||||
|
||||
# - table-level privileges
|
||||
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
INSERT INTO t1 VALUES('line1');
|
||||
|
||||
SELECT * FROM t1;
|
||||
SELECT @mysqltest_var;
|
||||
|
||||
INSERT INTO t2 VALUES('line2');
|
||||
|
||||
SELECT * FROM t2;
|
||||
|
||||
# - column-level privileges
|
||||
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
INSERT INTO t3 VALUES('t3_line1');
|
||||
|
||||
SELECT * FROM t3;
|
||||
SELECT @mysqltest_var;
|
||||
|
||||
INSERT INTO t4 VALUES('t4_line2');
|
||||
|
||||
SELECT * FROM t4;
|
||||
|
||||
# execution time:
|
||||
# - check that SELECT is required to read the value;
|
||||
# - check that SELECT is not enough to modify the value;
|
||||
|
||||
--connection default
|
||||
--echo
|
||||
--echo ---> connection: default
|
||||
|
||||
use mysqltest_db1;
|
||||
|
||||
REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
|
||||
REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
|
||||
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
|
||||
GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
|
||||
|
||||
REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
|
||||
REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
|
||||
GRANT SELECT(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
|
||||
GRANT SELECT(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
|
||||
|
||||
# - table-level privileges
|
||||
|
||||
INSERT INTO t1 VALUES('line3');
|
||||
|
||||
SELECT * FROM t1;
|
||||
SELECT @mysqltest_var;
|
||||
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
INSERT INTO t2 VALUES('line4');
|
||||
|
||||
SELECT * FROM t2;
|
||||
|
||||
# - column-level privileges
|
||||
|
||||
INSERT INTO t3 VALUES('t3_line2');
|
||||
|
||||
SELECT * FROM t3;
|
||||
SELECT @mysqltest_var;
|
||||
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
INSERT INTO t4 VALUES('t4_line2');
|
||||
|
||||
SELECT * FROM t4;
|
||||
|
||||
# execution time:
|
||||
# - check that nor SELECT either UPDATE is required to execute triggger w/o
|
||||
# NEW/OLD variables.
|
||||
|
||||
DELETE FROM t1;
|
||||
|
||||
SELECT @mysqltest_var;
|
||||
|
||||
#
|
||||
# Cleanup.
|
||||
#
|
||||
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
|
||||
DROP DATABASE mysqltest_db1;
|
||||
|
@@ -159,6 +159,23 @@ show create table t3;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
|
||||
#
|
||||
# Bug #9855 (inconsistent column type for create select
|
||||
#
|
||||
create table t1 select 105213674794682365.00 + 0.0 x;
|
||||
show warnings;
|
||||
desc t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 select 0.0 x;
|
||||
desc t1;
|
||||
create table t2 select 105213674794682365.00 y;
|
||||
desc t2;
|
||||
create table t3 select x+y a from t1,t2;
|
||||
show warnings;
|
||||
desc t3;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@@ -130,3 +130,19 @@ show create table t1;
|
||||
alter table t1 modify f1 tinytext;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#15588: String overrun
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(f1 VARCHAR(100) DEFAULT 'test');
|
||||
INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
CREATE TABLE t1(f1 CHAR(100) DEFAULT 'test');
|
||||
INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
Reference in New Issue
Block a user