mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge quad.:/mnt/raid/alik/MySQL/devel/5.1
into quad.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged client/mysqltest.c: Auto merged mysql-test/r/view.result: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/ha_ndbcluster_binlog.cc: Auto merged sql/handler.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_connect.cc: Auto merged sql/sql_parse.cc: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/suite/rpl_ndb/t/disabled.def: Manually merged. mysql-test/t/disabled.def: Manually merged.
This commit is contained in:
742
mysql-test/include/commit.inc
Normal file
742
mysql-test/include/commit.inc
Normal file
@ -0,0 +1,742 @@
|
||||
## Bug#12713 (Error in a stored function called from a SELECT doesn't cause
|
||||
## ROLLBACK of statem)
|
||||
|
||||
##
|
||||
## Pre-Requisites :
|
||||
## - $engine_type should be set
|
||||
##
|
||||
|
||||
set sql_mode=no_engine_substitution;
|
||||
eval set storage_engine = $engine_type;
|
||||
set autocommit=1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
drop function if exists f2;
|
||||
drop procedure if exists bug12713_call;
|
||||
drop procedure if exists bug12713_dump_spvars;
|
||||
drop procedure if exists dummy;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int);
|
||||
create table t2 (a int unique);
|
||||
create table t3 (a int);
|
||||
|
||||
# a workaround for Bug#32633: Can not create any routine if
|
||||
# SQL_MODE=no_engine_substitution
|
||||
|
||||
set sql_mode=default;
|
||||
|
||||
insert into t1 (a) values (1), (2);
|
||||
insert into t3 (a) values (1), (2);
|
||||
|
||||
delimiter |;
|
||||
|
||||
## Cause a failure every time
|
||||
create function f2(x int) returns int
|
||||
begin
|
||||
insert into t2 (a) values (x);
|
||||
insert into t2 (a) values (x);
|
||||
return x;
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
set autocommit=0;
|
||||
|
||||
flush status;
|
||||
##============================================================================
|
||||
## Design notes
|
||||
##
|
||||
## In each case, statement rollback is expected.
|
||||
## for transactional engines, the rollback should be properly executed
|
||||
## for non transactional engines, the rollback may cause warnings.
|
||||
##
|
||||
## The test pattern is as follows
|
||||
## - insert 1000+N
|
||||
## - statement with a side effect, that fails to insert N twice
|
||||
## - a statement rollback is expected (expecting 1 row 1000+N only) in t2
|
||||
## - a rollback is performed
|
||||
## - expecting a clean table t2.
|
||||
##============================================================================
|
||||
|
||||
insert into t2 (a) values (1001);
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 (a) values (f2(1));
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1002);
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t3 (a) select f2(2) from t1;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1003);
|
||||
--error ER_DUP_ENTRY
|
||||
update t1 set a= a + f2(3);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1004);
|
||||
--error ER_DUP_ENTRY
|
||||
update t1, t3 set t1.a = 0, t3.a = 0 where (f2(4) = 4) and (t1.a = t3.a);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1005);
|
||||
--error ER_DUP_ENTRY
|
||||
delete from t1 where (a = f2(5));
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1006);
|
||||
--error ER_DUP_ENTRY
|
||||
delete from t1, t3 using t1, t3 where (f2(6) = 6) ;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1007);
|
||||
--error ER_DUP_ENTRY
|
||||
replace t1 values (f2(7));
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1008);
|
||||
--error ER_DUP_ENTRY
|
||||
replace into t3 (a) select f2(8) from t1;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1009);
|
||||
--error ER_DUP_ENTRY
|
||||
select f2(9) from t1 ;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1010);
|
||||
--error ER_DUP_ENTRY
|
||||
show databases where (f2(10) = 10);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1011);
|
||||
--error ER_DUP_ENTRY
|
||||
show tables where (f2(11) = 11);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1012);
|
||||
--error ER_DUP_ENTRY
|
||||
show triggers where (f2(12) = 12);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1013);
|
||||
--error ER_DUP_ENTRY
|
||||
show table status where (f2(13) = 13);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1014);
|
||||
--error ER_DUP_ENTRY
|
||||
show open tables where (f2(14) = 14);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1015);
|
||||
--error ER_DUP_ENTRY
|
||||
show columns in mysql.proc where (f2(15) = 15);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1016);
|
||||
--error ER_DUP_ENTRY
|
||||
show status where (f2(16) = 16);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1017);
|
||||
--error ER_DUP_ENTRY
|
||||
show variables where (f2(17) = 17);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1018);
|
||||
--error ER_DUP_ENTRY
|
||||
show charset where (f2(18) = 18);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1019);
|
||||
--error ER_DUP_ENTRY
|
||||
show collation where (f2(19) = 19);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo # We need at least one procedure to make sure the WHERE clause is
|
||||
--echo # evaluated
|
||||
create procedure dummy() begin end;
|
||||
insert into t2 (a) values (1020);
|
||||
--error ER_DUP_ENTRY
|
||||
show procedure status where (f2(20) = 20);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
drop procedure dummy;
|
||||
|
||||
insert into t2 (a) values (1021);
|
||||
--error ER_DUP_ENTRY
|
||||
show function status where (f2(21) = 21);
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1022);
|
||||
prepare stmt from "insert into t1 (a) values (f2(22))";
|
||||
--error ER_DUP_ENTRY
|
||||
execute stmt;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
insert into t2 (a) values (1023);
|
||||
do (f2(23));
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
## Please note :
|
||||
## This will insert a record 1024 in t1 (statement commit)
|
||||
## This will insert a record 24 in t1 (statement commit)
|
||||
## then will rollback the second insert only (24) (statement rollback)
|
||||
## then will rollback the complete transaction (transaction rollback)
|
||||
|
||||
delimiter |;
|
||||
|
||||
create procedure bug12713_call ()
|
||||
begin
|
||||
insert into t2 (a) values (24);
|
||||
insert into t2 (a) values (24);
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
insert into t2 (a) values (1024);
|
||||
--error ER_DUP_ENTRY
|
||||
call bug12713_call();
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo =======================================================================
|
||||
--echo Testing select_to_file
|
||||
--echo =======================================================================
|
||||
|
||||
insert into t2 (a) values (1025);
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR ..
|
||||
--error ER_DUP_ENTRY
|
||||
eval select f2(25) into outfile "$MYSQLTEST_VARDIR/tmp/dml.out" from t1;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/dml.out
|
||||
|
||||
insert into t2 (a) values (1026);
|
||||
--replace_result $MYSQLTEST_VARDIR ..
|
||||
--error ER_DUP_ENTRY
|
||||
eval load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26);
|
||||
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo =======================================================================
|
||||
--echo Testing select_dumpvar
|
||||
--echo =======================================================================
|
||||
|
||||
insert into t2 (a) values (1027);
|
||||
--error ER_DUP_ENTRY
|
||||
select f2(27) into @foo;
|
||||
select * from t2;
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo =======================================================================
|
||||
--echo Testing Select_fetch_into_spvars
|
||||
--echo =======================================================================
|
||||
|
||||
delimiter |;
|
||||
|
||||
create procedure bug12713_dump_spvars ()
|
||||
begin
|
||||
declare foo int;
|
||||
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
select "Exception trapped";
|
||||
end;
|
||||
|
||||
select f2(28) into foo;
|
||||
select * from t2;
|
||||
end|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
insert into t2 (a) values (1028);
|
||||
call bug12713_dump_spvars ();
|
||||
rollback;
|
||||
select * from t2;
|
||||
|
||||
--echo =======================================================================
|
||||
--echo Cleanup
|
||||
--echo =======================================================================
|
||||
|
||||
set autocommit=default;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop function f2;
|
||||
drop procedure bug12713_call;
|
||||
drop procedure bug12713_dump_spvars;
|
||||
--echo #
|
||||
--echo # Bug#12713 Error in a stored function called from a SELECT doesn't
|
||||
--echo # cause ROLLBACK of statem
|
||||
--echo #
|
||||
--echo # Verify that two-phase commit is not issued for read-only
|
||||
--echo # transactions.
|
||||
--echo #
|
||||
--echo # Verify that two-phase commit is issued for read-write transactions,
|
||||
--echo # even if the change is done inside a stored function called from
|
||||
--echo # SELECT or SHOW statement.
|
||||
--echo #
|
||||
set autocommit=0;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop function if exists f1;
|
||||
drop procedure if exists p_verify_status_increment;
|
||||
--enable_warnings
|
||||
|
||||
set sql_mode=no_engine_substitution;
|
||||
create table t1 (a int unique);
|
||||
create table t2 (a int) engine=myisam;
|
||||
set sql_mode=default;
|
||||
--echo #
|
||||
--echo # An auxiliary procedure to track Handler_prepare and Handler_commit
|
||||
--echo # statistics.
|
||||
--echo #
|
||||
delimiter |;
|
||||
create procedure
|
||||
p_verify_status_increment(commit_inc_mixed int, prepare_inc_mixed int,
|
||||
commit_inc_row int, prepare_inc_row int)
|
||||
begin
|
||||
declare commit_inc int;
|
||||
declare prepare_inc int;
|
||||
declare old_commit_count int default ifnull(@commit_count, 0);
|
||||
declare old_prepare_count int default ifnull(@prepare_count, 0);
|
||||
declare c_res int;
|
||||
# Use a cursor to have just one access to I_S instead of 2, it is very slow
|
||||
# and amounts for over 90% of test CPU time
|
||||
declare c cursor for
|
||||
select variable_value
|
||||
from information_schema.session_status
|
||||
where variable_name='Handler_commit' or variable_name='Handler_prepare'
|
||||
order by variable_name;
|
||||
|
||||
if @@global.binlog_format = 'ROW' then
|
||||
set commit_inc= commit_inc_row;
|
||||
set prepare_inc= prepare_inc_row;
|
||||
else
|
||||
set commit_inc= commit_inc_mixed;
|
||||
set prepare_inc= prepare_inc_mixed;
|
||||
end if;
|
||||
|
||||
open c;
|
||||
fetch c into c_res;
|
||||
set @commit_count=c_res;
|
||||
fetch c into c_res;
|
||||
set @prepare_count=c_res;
|
||||
close c;
|
||||
|
||||
if old_commit_count + commit_inc <> @commit_count then
|
||||
select concat("Expected commit increment: ", commit_inc,
|
||||
" actual: ", @commit_count - old_commit_count)
|
||||
as 'ERROR';
|
||||
elseif old_prepare_count + prepare_inc <> @prepare_count then
|
||||
select concat("Expected prepare increment: ", prepare_inc,
|
||||
" actual: ", @prepare_count - old_prepare_count)
|
||||
as 'ERROR';
|
||||
else
|
||||
select '' as 'SUCCESS';
|
||||
end if;
|
||||
end|
|
||||
delimiter ;|
|
||||
--echo # Reset Handler_commit and Handler_prepare counters
|
||||
flush status;
|
||||
--echo #
|
||||
--echo # 1. Read-only statement: SELECT
|
||||
--echo #
|
||||
select * from t1;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 2. Read-write statement: INSERT, insert 1 row.
|
||||
--echo #
|
||||
insert into t1 (a) values (1);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 3. Read-write statement: UPDATE, update 1 row.
|
||||
--echo #
|
||||
update t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE
|
||||
--echo #
|
||||
--echo # Note the wrong Handler_prepare/Handler_commit count is due to
|
||||
--echo # Bug#29157 "UPDATE, changed rows incorrect" and
|
||||
--echo # Bug#Bug #33846 UPDATE word:Wrong 'Changed rows' if InnoDB, unique
|
||||
--echo # key and no rows qualify WHERE
|
||||
--echo #
|
||||
update t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE
|
||||
--echo #
|
||||
--echo # In mixed replication mode, there is a read-only transaction
|
||||
--echo # in InnoDB and also the statement is written to the binary log.
|
||||
--echo # So we have two commits but no 2pc, since the first engine's
|
||||
--echo # transaction is read-only.
|
||||
--echo # In the row level replication mode, we only have the read-only
|
||||
--echo # transaction in InnoDB and nothing is written to the binary log.
|
||||
--echo #
|
||||
update t1 set a=3 where a=1;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 6. Read-write statement: DELETE, delete 0 rows.
|
||||
--echo #
|
||||
delete from t1 where a=1;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 7. Read-write statement: DELETE, delete 1 row.
|
||||
--echo #
|
||||
delete from t1 where a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 8. Read-write statement: unqualified DELETE
|
||||
--echo #
|
||||
--echo # In statement or mixed replication mode, we call
|
||||
--echo # handler::ha_delete_all_rows() and write statement text
|
||||
--echo # to the binary log. This results in two read-write transactions.
|
||||
--echo # In row level replication mode, we do not call
|
||||
--echo # handler::ha_delete_all_rows(), but delete rows one by one.
|
||||
--echo # Since there are no rows, nothing is written to the binary log.
|
||||
--echo # Thus we have just one read-only transaction in InnoDB.
|
||||
delete from t1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
|
||||
--echo # 9. Read-write statement: REPLACE, change 1 row.
|
||||
--echo #
|
||||
replace t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 10. Read-write statement: REPLACE, change 0 rows.
|
||||
--echo #
|
||||
replace t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 11. Read-write statement: IODKU, change 1 row.
|
||||
--echo #
|
||||
insert t1 set a=1 on duplicate key update a=a+1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
select * from t1;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 12. Read-write statement: IODKU, change 0 rows.
|
||||
--echo #
|
||||
insert t1 set a=2 on duplicate key update a=2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 13. Read-write statement: INSERT IGNORE, change 0 rows.
|
||||
--echo #
|
||||
insert ignore t1 set a=2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 14. Read-write statement: INSERT IGNORE, change 1 row.
|
||||
--echo #
|
||||
insert ignore t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
--echo # 15. Read-write statement: UPDATE IGNORE, change 0 rows.
|
||||
--echo #
|
||||
update ignore t1 set a=2 where a=1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
--echo #
|
||||
--echo # Create a stored function that modifies a
|
||||
--echo # non-transactional table. Demonstrate that changes in
|
||||
--echo # non-transactional tables do not affect the two phase commit
|
||||
--echo # algorithm.
|
||||
--echo #
|
||||
delimiter |;
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert t2 set a=2;
|
||||
return 2;
|
||||
end|
|
||||
delimiter ;|
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 16. A function changes non-trans-table.
|
||||
--echo #
|
||||
select f1();
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 17. Read-only statement, a function changes non-trans-table.
|
||||
--echo #
|
||||
select f1() from t1;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 18. Read-write statement: UPDATE, change 0 (transactional) rows.
|
||||
--echo #
|
||||
select count(*) from t2;
|
||||
update t1 set a=2 where a=f1()+10;
|
||||
select count(*) from t2;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
--echo #
|
||||
--echo # Replace the non-transactional table with a temporary
|
||||
--echo # transactional table. Demonstrate that a change to a temporary
|
||||
--echo # transactional table does not provoke 2-phase commit, although
|
||||
--echo # does trigger a commit and a binlog write (in statement mode).
|
||||
--echo #
|
||||
drop table t2;
|
||||
set sql_mode=no_engine_substitution;
|
||||
create temporary table t2 (a int);
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
set sql_mode=default;
|
||||
--echo # 19. A function changes temp-trans-table.
|
||||
--echo #
|
||||
select f1();
|
||||
--echo # Two commits because a binary log record is written
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 20. Read-only statement, a function changes non-trans-table.
|
||||
--echo #
|
||||
select f1() from t1;
|
||||
--echo # Two commits because a binary log record is written
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 21. Read-write statement: UPDATE, change 0 (transactional) rows.
|
||||
--echo #
|
||||
update t1 set a=2 where a=f1()+10;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 22. DDL: ALTER TEMPORARY TABLE, should not cause a 2pc
|
||||
--echo #
|
||||
alter table t2 add column b int default 5;
|
||||
--echo # A commit is done internally by ALTER.
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
commit;
|
||||
--echo # There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction
|
||||
--echo
|
||||
--echo # No test because of Bug#8729 "rename table fails on temporary table"
|
||||
|
||||
--echo # 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction
|
||||
--echo
|
||||
truncate table t2;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
commit;
|
||||
--echo # There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 25. Read-write statement: unqualified DELETE
|
||||
--echo
|
||||
delete from t2;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
commit;
|
||||
--echo # There is nothing left to commit
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
|
||||
--echo # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
|
||||
--echo #
|
||||
drop temporary table t2;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo # 26. Verify that SET AUTOCOMMIT issues an implicit commit
|
||||
--echo #
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
set autocommit=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
rollback;
|
||||
select a from t1 where a=3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
delete from t1 where a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
set autocommit=0;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
--echo # Sic: not actually changing the value of autocommit
|
||||
set autocommit=0;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
rollback;
|
||||
select a from t1 where a=3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 27. Savepoint management
|
||||
--echo #
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
savepoint a;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
insert t1 set a=4;
|
||||
--echo # Sic: a bug. Binlog did not register itself this time.
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
release savepoint a;
|
||||
rollback;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
select a from t1 where a=3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
|
||||
--echo # 28. Read-write statement: DO
|
||||
--echo #
|
||||
create table t2 (a int);
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
do (select f1() from t1 where a=2);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
|
||||
--echo # 29. Read-write statement: MULTI-DELETE
|
||||
--echo #
|
||||
delete t1, t2 from t1 join t2 on (t1.a=t2.a) where t1.a=2;
|
||||
commit;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
|
||||
--echo # 30. Read-write statement: INSERT-SELECT, MULTI-UPDATE, REPLACE-SELECT
|
||||
--echo #
|
||||
insert into t2 select a from t1;
|
||||
commit;
|
||||
replace into t2 select a from t1;
|
||||
commit;
|
||||
call p_verify_status_increment(8, 8, 8, 8);
|
||||
#
|
||||
# Multi-update is one of the few remaining statements that still
|
||||
# locks the tables at prepare step (and hence starts the transaction.
|
||||
# Disable the PS protocol, since in this protocol we get a different
|
||||
# number of commmits (there is an extra commit after prepare
|
||||
#
|
||||
--disable_ps_protocol
|
||||
update t1, t2 set t1.a=4, t2.a=8 where t1.a=t2.a and t1.a=1;
|
||||
--enable_ps_protocol
|
||||
commit;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
|
||||
--echo # 31. DDL: various DDL with transactional tables
|
||||
--echo #
|
||||
--echo # Sic: no table is created.
|
||||
create table if not exists t2 (a int) select 6 union select 7;
|
||||
--echo # Sic: first commits the statement, and then the transaction.
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
create table t3 select a from t2;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
alter table t3 add column (b int);
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
alter table t3 rename t4;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
rename table t4 to t3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
truncate table t3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
create view v1 as select * from t2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
check table t1;
|
||||
call p_verify_status_increment(3, 0, 3, 0);
|
||||
--echo # Sic: after this bug is fixed, CHECK leaves no pending transaction
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
check table t1, t2, t3;
|
||||
call p_verify_status_increment(6, 0, 6, 0);
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
drop view v1;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
drop table t1;
|
||||
drop procedure p_verify_status_increment;
|
||||
drop function f1;
|
@ -9,6 +9,10 @@ SHOW CREATE VIEW v1|
|
||||
|
||||
SHOW CREATE VIEW v2|
|
||||
|
||||
--echo
|
||||
|
||||
SHOW CREATE VIEW v3|
|
||||
|
||||
# - Check INFORMATION_SCHEMA;
|
||||
|
||||
--echo
|
||||
@ -20,6 +24,10 @@ SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
|
||||
|
||||
# - Execute the views;
|
||||
|
||||
--echo
|
||||
@ -30,3 +38,7 @@ SELECT COLLATION(c1), COLLATION(c2) FROM v1|
|
||||
--echo
|
||||
|
||||
SELECT COLLATION(c1) FROM v2|
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM v3|
|
||||
|
@ -1410,4 +1410,33 @@ SELECT * FROM t1 WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#21704: Renaming column does not update FK definition.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(id INT PRIMARY KEY)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE t2(
|
||||
t1_id INT PRIMARY KEY,
|
||||
CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
|
||||
ENGINE=innodb;
|
||||
|
||||
--echo
|
||||
|
||||
--disable_result_log
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t1 CHANGE id id2 INT;
|
||||
--enable_result_log
|
||||
|
||||
--echo
|
||||
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -27,7 +27,7 @@ explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" E
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
|
||||
Note 1003 select (case 1 when 1 then 'one' when 2 then 'two' else 'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
|
||||
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
|
||||
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
|
||||
two
|
||||
@ -147,7 +147,7 @@ COALESCE('a' COLLATE latin1_bin,'b');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate latin1_bin),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
|
||||
Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce('a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,'1') AS `COALESCE(1,'1')`,coalesce(1.1,'1') AS `COALESCE(1.1,'1')`,coalesce(('a' collate latin1_bin),'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
|
888
mysql-test/r/commit_1innodb.result
Normal file
888
mysql-test/r/commit_1innodb.result
Normal file
@ -0,0 +1,888 @@
|
||||
set sql_mode=no_engine_substitution;
|
||||
set storage_engine = InnoDB;
|
||||
set autocommit=1;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
drop function if exists f2;
|
||||
drop procedure if exists bug12713_call;
|
||||
drop procedure if exists bug12713_dump_spvars;
|
||||
drop procedure if exists dummy;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int unique);
|
||||
create table t3 (a int);
|
||||
set sql_mode=default;
|
||||
insert into t1 (a) values (1), (2);
|
||||
insert into t3 (a) values (1), (2);
|
||||
create function f2(x int) returns int
|
||||
begin
|
||||
insert into t2 (a) values (x);
|
||||
insert into t2 (a) values (x);
|
||||
return x;
|
||||
end|
|
||||
set autocommit=0;
|
||||
flush status;
|
||||
insert into t2 (a) values (1001);
|
||||
insert into t1 (a) values (f2(1));
|
||||
ERROR 23000: Duplicate entry '1' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1001
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1002);
|
||||
insert into t3 (a) select f2(2) from t1;
|
||||
ERROR 23000: Duplicate entry '2' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1002
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1003);
|
||||
update t1 set a= a + f2(3);
|
||||
ERROR 23000: Duplicate entry '3' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1003
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1004);
|
||||
update t1, t3 set t1.a = 0, t3.a = 0 where (f2(4) = 4) and (t1.a = t3.a);
|
||||
ERROR 23000: Duplicate entry '4' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1004
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1005);
|
||||
delete from t1 where (a = f2(5));
|
||||
ERROR 23000: Duplicate entry '5' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1005
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1006);
|
||||
delete from t1, t3 using t1, t3 where (f2(6) = 6) ;
|
||||
ERROR 23000: Duplicate entry '6' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1006
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1007);
|
||||
replace t1 values (f2(7));
|
||||
ERROR 23000: Duplicate entry '7' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1007
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1008);
|
||||
replace into t3 (a) select f2(8) from t1;
|
||||
ERROR 23000: Duplicate entry '8' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1008
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1009);
|
||||
select f2(9) from t1 ;
|
||||
ERROR 23000: Duplicate entry '9' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1009
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1010);
|
||||
show databases where (f2(10) = 10);
|
||||
ERROR 23000: Duplicate entry '10' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1010
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1011);
|
||||
show tables where (f2(11) = 11);
|
||||
ERROR 23000: Duplicate entry '11' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1011
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1012);
|
||||
show triggers where (f2(12) = 12);
|
||||
ERROR 23000: Duplicate entry '12' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1012
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1013);
|
||||
show table status where (f2(13) = 13);
|
||||
ERROR 23000: Duplicate entry '13' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1013
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1014);
|
||||
show open tables where (f2(14) = 14);
|
||||
ERROR 23000: Duplicate entry '14' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1014
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1015);
|
||||
show columns in mysql.proc where (f2(15) = 15);
|
||||
ERROR 23000: Duplicate entry '15' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1015
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1016);
|
||||
show status where (f2(16) = 16);
|
||||
ERROR 23000: Duplicate entry '16' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1016
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1017);
|
||||
show variables where (f2(17) = 17);
|
||||
ERROR 23000: Duplicate entry '17' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1017
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1018);
|
||||
show charset where (f2(18) = 18);
|
||||
ERROR 23000: Duplicate entry '18' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1018
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1019);
|
||||
show collation where (f2(19) = 19);
|
||||
ERROR 23000: Duplicate entry '19' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1019
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
# We need at least one procedure to make sure the WHERE clause is
|
||||
# evaluated
|
||||
create procedure dummy() begin end;
|
||||
insert into t2 (a) values (1020);
|
||||
show procedure status where (f2(20) = 20);
|
||||
ERROR 23000: Duplicate entry '20' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1020
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
drop procedure dummy;
|
||||
insert into t2 (a) values (1021);
|
||||
show function status where (f2(21) = 21);
|
||||
ERROR 23000: Duplicate entry '21' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1021
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1022);
|
||||
prepare stmt from "insert into t1 (a) values (f2(22))";
|
||||
execute stmt;
|
||||
ERROR 23000: Duplicate entry '22' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1022
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1023);
|
||||
do (f2(23));
|
||||
Warnings:
|
||||
Error 1062 Duplicate entry '23' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1023
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
create procedure bug12713_call ()
|
||||
begin
|
||||
insert into t2 (a) values (24);
|
||||
insert into t2 (a) values (24);
|
||||
end|
|
||||
insert into t2 (a) values (1024);
|
||||
call bug12713_call();
|
||||
ERROR 23000: Duplicate entry '24' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
24
|
||||
1024
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
=======================================================================
|
||||
Testing select_to_file
|
||||
=======================================================================
|
||||
insert into t2 (a) values (1025);
|
||||
select f2(25) into outfile "../tmp/dml.out" from t1;
|
||||
ERROR 23000: Duplicate entry '25' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1025
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1026);
|
||||
load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26);
|
||||
ERROR 23000: Duplicate entry '26' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1026
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
=======================================================================
|
||||
Testing select_dumpvar
|
||||
=======================================================================
|
||||
insert into t2 (a) values (1027);
|
||||
select f2(27) into @foo;
|
||||
ERROR 23000: Duplicate entry '27' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1027
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
=======================================================================
|
||||
Testing Select_fetch_into_spvars
|
||||
=======================================================================
|
||||
create procedure bug12713_dump_spvars ()
|
||||
begin
|
||||
declare foo int;
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
select "Exception trapped";
|
||||
end;
|
||||
select f2(28) into foo;
|
||||
select * from t2;
|
||||
end|
|
||||
insert into t2 (a) values (1028);
|
||||
call bug12713_dump_spvars ();
|
||||
Exception trapped
|
||||
Exception trapped
|
||||
a
|
||||
1028
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
=======================================================================
|
||||
Cleanup
|
||||
=======================================================================
|
||||
set autocommit=default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop function f2;
|
||||
drop procedure bug12713_call;
|
||||
drop procedure bug12713_dump_spvars;
|
||||
#
|
||||
# Bug#12713 Error in a stored function called from a SELECT doesn't
|
||||
# cause ROLLBACK of statem
|
||||
#
|
||||
# Verify that two-phase commit is not issued for read-only
|
||||
# transactions.
|
||||
#
|
||||
# Verify that two-phase commit is issued for read-write transactions,
|
||||
# even if the change is done inside a stored function called from
|
||||
# SELECT or SHOW statement.
|
||||
#
|
||||
set autocommit=0;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop function if exists f1;
|
||||
drop procedure if exists p_verify_status_increment;
|
||||
set sql_mode=no_engine_substitution;
|
||||
create table t1 (a int unique);
|
||||
create table t2 (a int) engine=myisam;
|
||||
set sql_mode=default;
|
||||
#
|
||||
# An auxiliary procedure to track Handler_prepare and Handler_commit
|
||||
# statistics.
|
||||
#
|
||||
create procedure
|
||||
p_verify_status_increment(commit_inc_mixed int, prepare_inc_mixed int,
|
||||
commit_inc_row int, prepare_inc_row int)
|
||||
begin
|
||||
declare commit_inc int;
|
||||
declare prepare_inc int;
|
||||
declare old_commit_count int default ifnull(@commit_count, 0);
|
||||
declare old_prepare_count int default ifnull(@prepare_count, 0);
|
||||
declare c_res int;
|
||||
# Use a cursor to have just one access to I_S instead of 2, it is very slow
|
||||
# and amounts for over 90% of test CPU time
|
||||
declare c cursor for
|
||||
select variable_value
|
||||
from information_schema.session_status
|
||||
where variable_name='Handler_commit' or variable_name='Handler_prepare'
|
||||
order by variable_name;
|
||||
if @@global.binlog_format = 'ROW' then
|
||||
set commit_inc= commit_inc_row;
|
||||
set prepare_inc= prepare_inc_row;
|
||||
else
|
||||
set commit_inc= commit_inc_mixed;
|
||||
set prepare_inc= prepare_inc_mixed;
|
||||
end if;
|
||||
open c;
|
||||
fetch c into c_res;
|
||||
set @commit_count=c_res;
|
||||
fetch c into c_res;
|
||||
set @prepare_count=c_res;
|
||||
close c;
|
||||
if old_commit_count + commit_inc <> @commit_count then
|
||||
select concat("Expected commit increment: ", commit_inc,
|
||||
" actual: ", @commit_count - old_commit_count)
|
||||
as 'ERROR';
|
||||
elseif old_prepare_count + prepare_inc <> @prepare_count then
|
||||
select concat("Expected prepare increment: ", prepare_inc,
|
||||
" actual: ", @prepare_count - old_prepare_count)
|
||||
as 'ERROR';
|
||||
else
|
||||
select '' as 'SUCCESS';
|
||||
end if;
|
||||
end|
|
||||
# Reset Handler_commit and Handler_prepare counters
|
||||
flush status;
|
||||
#
|
||||
# 1. Read-only statement: SELECT
|
||||
#
|
||||
select * from t1;
|
||||
a
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 2. Read-write statement: INSERT, insert 1 row.
|
||||
#
|
||||
insert into t1 (a) values (1);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 3. Read-write statement: UPDATE, update 1 row.
|
||||
#
|
||||
update t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE
|
||||
#
|
||||
# Note the wrong Handler_prepare/Handler_commit count is due to
|
||||
# Bug#29157 "UPDATE, changed rows incorrect" and
|
||||
# Bug#Bug #33846 UPDATE word:Wrong 'Changed rows' if InnoDB, unique
|
||||
# key and no rows qualify WHERE
|
||||
#
|
||||
update t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE
|
||||
#
|
||||
# In mixed replication mode, there is a read-only transaction
|
||||
# in InnoDB and also the statement is written to the binary log.
|
||||
# So we have two commits but no 2pc, since the first engine's
|
||||
# transaction is read-only.
|
||||
# In the row level replication mode, we only have the read-only
|
||||
# transaction in InnoDB and nothing is written to the binary log.
|
||||
#
|
||||
update t1 set a=3 where a=1;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 6. Read-write statement: DELETE, delete 0 rows.
|
||||
#
|
||||
delete from t1 where a=1;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 7. Read-write statement: DELETE, delete 1 row.
|
||||
#
|
||||
delete from t1 where a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 8. Read-write statement: unqualified DELETE
|
||||
#
|
||||
# In statement or mixed replication mode, we call
|
||||
# handler::ha_delete_all_rows() and write statement text
|
||||
# to the binary log. This results in two read-write transactions.
|
||||
# In row level replication mode, we do not call
|
||||
# handler::ha_delete_all_rows(), but delete rows one by one.
|
||||
# Since there are no rows, nothing is written to the binary log.
|
||||
# Thus we have just one read-only transaction in InnoDB.
|
||||
delete from t1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 9. Read-write statement: REPLACE, change 1 row.
|
||||
#
|
||||
replace t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 10. Read-write statement: REPLACE, change 0 rows.
|
||||
#
|
||||
replace t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 11. Read-write statement: IODKU, change 1 row.
|
||||
#
|
||||
insert t1 set a=1 on duplicate key update a=a+1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 12. Read-write statement: IODKU, change 0 rows.
|
||||
#
|
||||
insert t1 set a=2 on duplicate key update a=2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 13. Read-write statement: INSERT IGNORE, change 0 rows.
|
||||
#
|
||||
insert ignore t1 set a=2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 14. Read-write statement: INSERT IGNORE, change 1 row.
|
||||
#
|
||||
insert ignore t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 15. Read-write statement: UPDATE IGNORE, change 0 rows.
|
||||
#
|
||||
update ignore t1 set a=2 where a=1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
#
|
||||
# Create a stored function that modifies a
|
||||
# non-transactional table. Demonstrate that changes in
|
||||
# non-transactional tables do not affect the two phase commit
|
||||
# algorithm.
|
||||
#
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert t2 set a=2;
|
||||
return 2;
|
||||
end|
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 16. A function changes non-trans-table.
|
||||
#
|
||||
select f1();
|
||||
f1()
|
||||
2
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 17. Read-only statement, a function changes non-trans-table.
|
||||
#
|
||||
select f1() from t1;
|
||||
f1()
|
||||
2
|
||||
2
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 18. Read-write statement: UPDATE, change 0 (transactional) rows.
|
||||
#
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
3
|
||||
update t1 set a=2 where a=f1()+10;
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
5
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
#
|
||||
# Replace the non-transactional table with a temporary
|
||||
# transactional table. Demonstrate that a change to a temporary
|
||||
# transactional table does not provoke 2-phase commit, although
|
||||
# does trigger a commit and a binlog write (in statement mode).
|
||||
#
|
||||
drop table t2;
|
||||
set sql_mode=no_engine_substitution;
|
||||
create temporary table t2 (a int);
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
set sql_mode=default;
|
||||
# 19. A function changes temp-trans-table.
|
||||
#
|
||||
select f1();
|
||||
f1()
|
||||
2
|
||||
# Two commits because a binary log record is written
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 20. Read-only statement, a function changes non-trans-table.
|
||||
#
|
||||
select f1() from t1;
|
||||
f1()
|
||||
2
|
||||
2
|
||||
# Two commits because a binary log record is written
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 21. Read-write statement: UPDATE, change 0 (transactional) rows.
|
||||
#
|
||||
update t1 set a=2 where a=f1()+10;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 22. DDL: ALTER TEMPORARY TABLE, should not cause a 2pc
|
||||
#
|
||||
alter table t2 add column b int default 5;
|
||||
# A commit is done internally by ALTER.
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
# There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction
|
||||
|
||||
# No test because of Bug#8729 "rename table fails on temporary table"
|
||||
# 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction
|
||||
|
||||
truncate table t2;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
# There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 25. Read-write statement: unqualified DELETE
|
||||
|
||||
delete from t2;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
# There is nothing left to commit
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
|
||||
#
|
||||
drop temporary table t2;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 26. Verify that SET AUTOCOMMIT issues an implicit commit
|
||||
#
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
set autocommit=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
rollback;
|
||||
select a from t1 where a=3;
|
||||
a
|
||||
3
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
delete from t1 where a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
set autocommit=0;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# Sic: not actually changing the value of autocommit
|
||||
set autocommit=0;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
rollback;
|
||||
select a from t1 where a=3;
|
||||
a
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 27. Savepoint management
|
||||
#
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
savepoint a;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
insert t1 set a=4;
|
||||
# Sic: a bug. Binlog did not register itself this time.
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
release savepoint a;
|
||||
rollback;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
select a from t1 where a=3;
|
||||
a
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 28. Read-write statement: DO
|
||||
#
|
||||
create table t2 (a int);
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
do (select f1() from t1 where a=2);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 29. Read-write statement: MULTI-DELETE
|
||||
#
|
||||
delete t1, t2 from t1 join t2 on (t1.a=t2.a) where t1.a=2;
|
||||
commit;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
# 30. Read-write statement: INSERT-SELECT, MULTI-UPDATE, REPLACE-SELECT
|
||||
#
|
||||
insert into t2 select a from t1;
|
||||
commit;
|
||||
replace into t2 select a from t1;
|
||||
commit;
|
||||
call p_verify_status_increment(8, 8, 8, 8);
|
||||
SUCCESS
|
||||
|
||||
update t1, t2 set t1.a=4, t2.a=8 where t1.a=t2.a and t1.a=1;
|
||||
commit;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
# 31. DDL: various DDL with transactional tables
|
||||
#
|
||||
# Sic: no table is created.
|
||||
create table if not exists t2 (a int) select 6 union select 7;
|
||||
Warnings:
|
||||
Note 1050 Table 't2' already exists
|
||||
# Sic: first commits the statement, and then the transaction.
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
create table t3 select a from t2;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
alter table t3 add column (b int);
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
alter table t3 rename t4;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
rename table t4 to t3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
truncate table t3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
create view v1 as select * from t2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
call p_verify_status_increment(3, 0, 3, 0);
|
||||
SUCCESS
|
||||
|
||||
# Sic: after this bug is fixed, CHECK leaves no pending transaction
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
check table t1, t2, t3;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
test.t2 check status OK
|
||||
test.t3 check status OK
|
||||
call p_verify_status_increment(6, 0, 6, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
drop view v1;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
drop table t1;
|
||||
drop procedure p_verify_status_increment;
|
||||
drop function f1;
|
@ -1511,7 +1511,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
|
||||
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
|
||||
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
|
||||
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
|
||||
|
@ -1789,4 +1789,48 @@ DROP TABLE t2;
|
||||
|
||||
# -- End of test case for Bug#21380.
|
||||
|
||||
# --
|
||||
# -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
|
||||
# --
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
|
||||
CREATE TABLE t1(c1 TIMESTAMP, c2 TIMESTAMP);
|
||||
|
||||
SET sql_mode = NO_ZERO_DATE;
|
||||
|
||||
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT 0);
|
||||
ERROR 42000: Invalid default value for 'c2'
|
||||
|
||||
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP);
|
||||
ERROR 42000: Invalid default value for 'c2'
|
||||
|
||||
# -- Check that NULL column still can be created.
|
||||
CREATE TABLE t2(c1 TIMESTAMP NULL);
|
||||
|
||||
# -- Check ALTER TABLE.
|
||||
ALTER TABLE t1 ADD INDEX(c1);
|
||||
ERROR 42000: Invalid default value for 'c2'
|
||||
|
||||
# -- Check DATETIME.
|
||||
SET sql_mode = '';
|
||||
|
||||
CREATE TABLE t3(c1 DATETIME NOT NULL);
|
||||
INSERT INTO t3 VALUES (0);
|
||||
|
||||
SET sql_mode = TRADITIONAL;
|
||||
|
||||
ALTER TABLE t3 ADD INDEX(c1);
|
||||
ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'c1' at row 1
|
||||
|
||||
# -- Cleanup.
|
||||
SET sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
||||
# -- End of Bug#18834.
|
||||
|
||||
End of 5.1 tests
|
||||
|
@ -519,7 +519,7 @@ explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'`
|
||||
Note 1003 select charset('a') AS `charset('a')`,collation('a') AS `collation('a')`,coercibility('a') AS `coercibility('a')`,('a' = 'A') AS `'a'='A'`
|
||||
SET CHARACTER SET koi8r;
|
||||
SHOW VARIABLES LIKE 'collation_client';
|
||||
Variable_name Value
|
||||
|
@ -445,7 +445,7 @@ explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM",
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
|
||||
Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff('01.01.97 11:59:59.000001 PM','31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date('15-01-2001 12:59:59','%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond('1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
|
||||
create table t1 (d date);
|
||||
insert into t1 values ('2004-07-14'),('2005-07-14');
|
||||
select date_format(d,"%d") from t1 order by 1;
|
||||
|
@ -16,25 +16,34 @@ FROM t1|
|
||||
|
||||
CREATE VIEW v2 AS SELECT _utf8'тест' as c1|
|
||||
|
||||
CREATE VIEW v3 AS SELECT _utf8'тест'|
|
||||
|
||||
|
||||
|
||||
SHOW CREATE VIEW v1|
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `c1`,`t1`.`<60><><EFBFBD>` AS `c2` from `t1` koi8r koi8r_general_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select '<27><><EFBFBD><EFBFBD>' AS `c1`,`t1`.`<60><><EFBFBD>` AS `c2` from `t1` koi8r koi8r_general_ci
|
||||
|
||||
SHOW CREATE VIEW v2|
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'тест' AS `c1` koi8r koi8r_general_ci
|
||||
|
||||
SHOW CREATE VIEW v3|
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'тест' AS `<60><><EFBFBD><EFBFBD>` koi8r koi8r_general_ci
|
||||
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v1 SELECT '<27><><EFBFBD><EFBFBD>' AS c1, <EFBFBD><EFBFBD><EFBFBD> AS c2
|
||||
FROM t1 NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
||||
NULL mysqltest1 v1 select '<27><><EFBFBD><EFBFBD>' AS `c1`,`mysqltest1`.`t1`.`<EFBFBD><EFBFBD><EFBFBD>` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v2 SELECT '<27><><EFBFBD><EFBFBD>' as c1 NONE NO root@localhost DEFINER koi8r koi8r_general_ci
|
||||
NULL mysqltest1 v2 select '<27><><EFBFBD><EFBFBD>' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v3 select '<27><><EFBFBD><EFBFBD>' AS `<60><><EFBFBD><EFBFBD>` NONE NO root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1|
|
||||
@ -45,6 +54,10 @@ SELECT COLLATION(c1) FROM v2|
|
||||
COLLATION(c1)
|
||||
utf8_general_ci
|
||||
|
||||
SELECT * FROM v3|
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
|
||||
|
||||
@ -54,27 +67,35 @@ SET @@character_set_results= cp1251|
|
||||
SET @@collation_connection= cp1251_general_ci|
|
||||
SELECT * FROM mysqltest1.v1|
|
||||
SELECT * FROM mysqltest1.v2|
|
||||
SELECT * FROM mysqltest1.v3|
|
||||
use mysqltest1|
|
||||
set names koi8r|
|
||||
|
||||
|
||||
SHOW CREATE VIEW v1|
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `c1`,`t1`.`<60><><EFBFBD>` AS `c2` from `t1` koi8r koi8r_general_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select '<27><><EFBFBD><EFBFBD>' AS `c1`,`t1`.`<60><><EFBFBD>` AS `c2` from `t1` koi8r koi8r_general_ci
|
||||
|
||||
SHOW CREATE VIEW v2|
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'тест' AS `c1` koi8r koi8r_general_ci
|
||||
|
||||
SHOW CREATE VIEW v3|
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'тест' AS `<60><><EFBFBD><EFBFBD>` koi8r koi8r_general_ci
|
||||
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v1 SELECT '<27><><EFBFBD><EFBFBD>' AS c1, <EFBFBD><EFBFBD><EFBFBD> AS c2
|
||||
FROM t1 NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
||||
NULL mysqltest1 v1 select '<27><><EFBFBD><EFBFBD>' AS `c1`,`mysqltest1`.`t1`.`<EFBFBD><EFBFBD><EFBFBD>` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v2 SELECT '<27><><EFBFBD><EFBFBD>' as c1 NONE NO root@localhost DEFINER koi8r koi8r_general_ci
|
||||
NULL mysqltest1 v2 select '<27><><EFBFBD><EFBFBD>' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v3 select '<27><><EFBFBD><EFBFBD>' AS `<60><><EFBFBD><EFBFBD>` NONE NO root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1|
|
||||
@ -85,6 +106,10 @@ SELECT COLLATION(c1) FROM v2|
|
||||
COLLATION(c1)
|
||||
utf8_general_ci
|
||||
|
||||
SELECT * FROM v3|
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql
|
||||
|
||||
|
||||
@ -99,27 +124,36 @@ SET @@character_set_results= cp1251|
|
||||
SET @@collation_connection= cp1251_general_ci|
|
||||
SELECT * FROM mysqltest1.v1|
|
||||
SELECT * FROM mysqltest1.v2|
|
||||
SELECT * FROM mysqltest1.v3|
|
||||
use mysqltest1|
|
||||
set names koi8r|
|
||||
|
||||
|
||||
SHOW CREATE VIEW v1|
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `c1`,`t1`.`<60><><EFBFBD>` AS `c2` from `t1` koi8r koi8r_general_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select '<27><><EFBFBD><EFBFBD>' AS `c1`,`t1`.`<60><><EFBFBD>` AS `c2` from `t1` koi8r koi8r_general_ci
|
||||
|
||||
SHOW CREATE VIEW v2|
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'тест' AS `c1` koi8r koi8r_general_ci
|
||||
|
||||
SHOW CREATE VIEW v3|
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'тест' AS `<60><><EFBFBD><EFBFBD>` koi8r koi8r_general_ci
|
||||
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v1 select '<27><><EFBFBD><EFBFBD>' AS `c1`,`t1`.`<60><><EFBFBD>` AS `c2` from `t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
||||
NULL mysqltest1 v1 select '<27><><EFBFBD><EFBFBD>' AS `c1`,`mysqltest1`.`t1`.`<60><><EFBFBD>` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v2 select '<27><><EFBFBD><EFBFBD>' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v3 select '<27><><EFBFBD><EFBFBD>' AS `<60><><EFBFBD><EFBFBD>` NONE NO root@localhost DEFINER koi8r koi8r_general_ci
|
||||
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1|
|
||||
COLLATION(c1) COLLATION(c2)
|
||||
@ -129,6 +163,10 @@ SELECT COLLATION(c1) FROM v2|
|
||||
COLLATION(c1)
|
||||
utf8_general_ci
|
||||
|
||||
SELECT * FROM v3|
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
---> connection: default
|
||||
use test|
|
||||
DROP DATABASE mysqltest1|
|
||||
|
@ -16,25 +16,34 @@ FROM t1|
|
||||
|
||||
CREATE VIEW v2 AS SELECT _koi8r'<27><><EFBFBD><EFBFBD>' as c1|
|
||||
|
||||
CREATE VIEW v3 AS SELECT _koi8r'<27><><EFBFBD><EFBFBD>'|
|
||||
|
||||
|
||||
|
||||
SHOW CREATE VIEW v1|
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _utf8'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci
|
||||
|
||||
SHOW CREATE VIEW v2|
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `c1` utf8 utf8_general_ci
|
||||
|
||||
SHOW CREATE VIEW v3|
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `тест` utf8 utf8_general_ci
|
||||
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2
|
||||
FROM t1 NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
||||
NULL mysqltest1 v1 select 'тест' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v2 SELECT 'тест' as c1 NONE NO root@localhost DEFINER utf8 utf8_general_ci
|
||||
NULL mysqltest1 v2 select 'тест' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v3 select 'тест' AS `тест` NONE NO root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1|
|
||||
@ -45,6 +54,10 @@ SELECT COLLATION(c1) FROM v2|
|
||||
COLLATION(c1)
|
||||
koi8r_general_ci
|
||||
|
||||
SELECT * FROM v3|
|
||||
тест
|
||||
тест
|
||||
|
||||
|
||||
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
|
||||
|
||||
@ -54,27 +67,35 @@ SET @@character_set_results= cp1251|
|
||||
SET @@collation_connection= cp1251_general_ci|
|
||||
SELECT * FROM mysqltest1.v1|
|
||||
SELECT * FROM mysqltest1.v2|
|
||||
SELECT * FROM mysqltest1.v3|
|
||||
use mysqltest1|
|
||||
set names utf8|
|
||||
|
||||
|
||||
SHOW CREATE VIEW v1|
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _utf8'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci
|
||||
|
||||
SHOW CREATE VIEW v2|
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `c1` utf8 utf8_general_ci
|
||||
|
||||
SHOW CREATE VIEW v3|
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `тест` utf8 utf8_general_ci
|
||||
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2
|
||||
FROM t1 NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
||||
NULL mysqltest1 v1 select 'тест' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v2 SELECT 'тест' as c1 NONE NO root@localhost DEFINER utf8 utf8_general_ci
|
||||
NULL mysqltest1 v2 select 'тест' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v3 select 'тест' AS `тест` NONE NO root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1|
|
||||
@ -85,6 +106,10 @@ SELECT COLLATION(c1) FROM v2|
|
||||
COLLATION(c1)
|
||||
koi8r_general_ci
|
||||
|
||||
SELECT * FROM v3|
|
||||
тест
|
||||
тест
|
||||
|
||||
---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql
|
||||
|
||||
|
||||
@ -99,27 +124,36 @@ SET @@character_set_results= cp1251|
|
||||
SET @@collation_connection= cp1251_general_ci|
|
||||
SELECT * FROM mysqltest1.v1|
|
||||
SELECT * FROM mysqltest1.v2|
|
||||
SELECT * FROM mysqltest1.v3|
|
||||
use mysqltest1|
|
||||
set names utf8|
|
||||
|
||||
|
||||
SHOW CREATE VIEW v1|
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _utf8'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci
|
||||
|
||||
SHOW CREATE VIEW v2|
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `c1` utf8 utf8_general_ci
|
||||
|
||||
SHOW CREATE VIEW v3|
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _koi8r'<27><><EFBFBD><EFBFBD>' AS `тест` utf8 utf8_general_ci
|
||||
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v1 select 'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
||||
NULL mysqltest1 v1 select 'тест' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v2 select 'тест' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL mysqltest1 v3 select 'тест' AS `тест` NONE NO root@localhost DEFINER utf8 utf8_general_ci
|
||||
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1|
|
||||
COLLATION(c1) COLLATION(c2)
|
||||
@ -129,6 +163,10 @@ SELECT COLLATION(c1) FROM v2|
|
||||
COLLATION(c1)
|
||||
koi8r_general_ci
|
||||
|
||||
SELECT * FROM v3|
|
||||
тест
|
||||
тест
|
||||
|
||||
---> connection: default
|
||||
use test|
|
||||
DROP DATABASE mysqltest1|
|
||||
|
@ -17,7 +17,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 fulltext a a 0 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'collections'))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('collections'))
|
||||
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||
a b
|
||||
Full-text indexes are called collections
|
||||
@ -87,7 +87,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 fulltext a a 0 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'support -collections' in boolean mode))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('support -collections' in boolean mode))
|
||||
select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
|
||||
a b
|
||||
MySQL has now support for full-text search
|
||||
|
@ -91,7 +91,7 @@ explain extended select password('idkfa '), old_password('idkfa');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')`
|
||||
Note 1003 select password('idkfa ') AS `password('idkfa ')`,old_password('idkfa') AS `old_password('idkfa')`
|
||||
select encrypt('1234','_.');
|
||||
encrypt('1234','_.')
|
||||
#
|
||||
|
@ -182,4 +182,4 @@ explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_dec
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
|
||||
Note 1003 select des_decrypt(des_encrypt('hello',4),'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt('hello','hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))`
|
||||
|
@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like _latin1'%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary))
|
||||
Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like '%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary))
|
||||
select nullif(u, 1) from t1;
|
||||
nullif(u, 1)
|
||||
NULL
|
||||
|
@ -146,7 +146,7 @@ explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (_latin1'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin)))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ('a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin)))
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (a char(10) character set utf8 not null);
|
||||
|
@ -5,12 +5,12 @@ explain extended select * from t1 where a like 'abc%';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like _latin1'abc%')
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like 'abc%')
|
||||
explain extended select * from t1 where a like concat('abc','%');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like concat(_latin1'abc',_latin1'%'))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like concat('abc','%'))
|
||||
select * from t1 where a like "abc%";
|
||||
a
|
||||
abc
|
||||
|
@ -52,7 +52,7 @@ explain extended select * from t1 where xxx regexp('is a test of some long text
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
|
||||
Warnings:
|
||||
Note 1003 select 'this is a test of some long text to see what happens' AS `xxx` from `test`.`t1` where ('this is a test of some long text to see what happens' regexp _latin1'is a test of some long text to')
|
||||
Note 1003 select 'this is a test of some long text to see what happens' AS `xxx` from `test`.`t1` where ('this is a test of some long text to see what happens' regexp 'is a test of some long text to')
|
||||
select * from t1 where xxx regexp('is a test of some long text to ');
|
||||
xxx
|
||||
this is a test of some long text to see what happens
|
||||
|
@ -5,7 +5,7 @@ explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
|
||||
Note 1003 select interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0`
|
||||
SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
|
||||
INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56)
|
||||
1
|
||||
|
@ -817,57 +817,57 @@ explain extended select md5('hello');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select md5(_latin1'hello') AS `md5('hello')`
|
||||
Note 1003 select md5('hello') AS `md5('hello')`
|
||||
explain extended select sha('abc');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select sha(_latin1'abc') AS `sha('abc')`
|
||||
Note 1003 select sha('abc') AS `sha('abc')`
|
||||
explain extended select sha1('abc');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select sha(_latin1'abc') AS `sha1('abc')`
|
||||
Note 1003 select sha('abc') AS `sha1('abc')`
|
||||
explain extended select soundex('');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select soundex(_latin1'') AS `soundex('')`
|
||||
Note 1003 select soundex('') AS `soundex('')`
|
||||
explain extended select 'mood' sounds like 'mud';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select (soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`
|
||||
Note 1003 select (soundex('mood') = soundex('mud')) AS `'mood' sounds like 'mud'`
|
||||
explain extended select aes_decrypt(aes_encrypt('abc','1'),'1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`
|
||||
Note 1003 select aes_decrypt(aes_encrypt('abc','1'),'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`
|
||||
explain extended select concat('*',space(5),'*');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`
|
||||
Note 1003 select concat('*',repeat(' ',5),'*') AS `concat('*',space(5),'*')`
|
||||
explain extended select reverse('abc');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select reverse(_latin1'abc') AS `reverse('abc')`
|
||||
Note 1003 select reverse('abc') AS `reverse('abc')`
|
||||
explain extended select rpad('a',4,'1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`
|
||||
Note 1003 select rpad('a',4,'1') AS `rpad('a',4,'1')`
|
||||
explain extended select lpad('a',4,'1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`
|
||||
Note 1003 select lpad('a',4,'1') AS `lpad('a',4,'1')`
|
||||
explain extended select concat_ws(',','',NULL,'a');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`
|
||||
Note 1003 select concat_ws(',','',NULL,'a') AS `concat_ws(',','',NULL,'a')`
|
||||
explain extended select make_set(255,_latin2'a', _latin2'b', _latin2'c');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -882,7 +882,7 @@ explain extended select locate("a","b",2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`
|
||||
Note 1003 select locate('a','b',2) AS `locate("a","b",2)`
|
||||
explain extended select format(130,10);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -907,7 +907,7 @@ explain extended select binary 'HE';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select cast(_latin1'HE' as char charset binary) AS `binary 'HE'`
|
||||
Note 1003 select cast('HE' as char charset binary) AS `binary 'HE'`
|
||||
explain extended select export_set(255,_latin2'y', _latin2'n', _latin2' ');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -917,7 +917,7 @@ explain extended select FIELD('b' COLLATE latin1_bin,'A','B');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`
|
||||
Note 1003 select field(('b' collate latin1_bin),'A','B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`
|
||||
explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -937,37 +937,37 @@ explain extended select length('\n\t\r\b\0\_\%\\');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`
|
||||
Note 1003 select length('\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`
|
||||
explain extended select bit_length('\n\t\r\b\0\_\%\\');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`
|
||||
Note 1003 select bit_length('\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`
|
||||
explain extended select bit_length('\n\t\r\b\0\_\%\\');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`
|
||||
Note 1003 select bit_length('\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`
|
||||
explain extended select concat('monty',' was here ','again');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`
|
||||
Note 1003 select concat('monty',' was here ','again') AS `concat('monty',' was here ','again')`
|
||||
explain extended select length('hello');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select length(_latin1'hello') AS `length('hello')`
|
||||
Note 1003 select length('hello') AS `length('hello')`
|
||||
explain extended select char(ascii('h'));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select char(ascii(_latin1'h')) AS `char(ascii('h'))`
|
||||
Note 1003 select char(ascii('h')) AS `char(ascii('h'))`
|
||||
explain extended select ord('h');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select ord(_latin1'h') AS `ord('h')`
|
||||
Note 1003 select ord('h') AS `ord('h')`
|
||||
explain extended select quote(1/0);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -977,17 +977,17 @@ explain extended select crc32("123");
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select crc32(_latin1'123') AS `crc32("123")`
|
||||
Note 1003 select crc32('123') AS `crc32("123")`
|
||||
explain extended select replace('aaaa','a','b');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`
|
||||
Note 1003 select replace('aaaa','a','b') AS `replace('aaaa','a','b')`
|
||||
explain extended select insert('txs',2,1,'hi');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`
|
||||
Note 1003 select insert('txs',2,1,'hi') AS `insert('txs',2,1,'hi')`
|
||||
explain extended select left(_latin2'a',1);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -1012,12 +1012,12 @@ explain extended select SUBSTR('abcdefg',3,2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`
|
||||
Note 1003 select substr('abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`
|
||||
explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select substring_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`
|
||||
Note 1003 select substring_index('1abcd;2abcd;3abcd;4abcd',';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`
|
||||
explain extended select trim(_latin2' a ');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
@ -1037,7 +1037,7 @@ explain extended select decode(encode(repeat("a",100000),"monty"),"monty");
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select decode(encode(repeat(_latin1'a',100000),_latin1'monty'),_latin1'monty') AS `decode(encode(repeat("a",100000),"monty"),"monty")`
|
||||
Note 1003 select decode(encode(repeat('a',100000),'monty'),'monty') AS `decode(encode(repeat("a",100000),"monty"),"monty")`
|
||||
SELECT lpad(12345, 5, "#");
|
||||
lpad(12345, 5, "#")
|
||||
12345
|
||||
@ -1282,39 +1282,39 @@ EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > _latin1'ab')
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > 'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading 'y' from `test`.`t1`.`s`) > 'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing 'y' from `test`.`t1`.`s`) > 'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab')
|
||||
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab')
|
||||
DROP TABLE t1;
|
||||
create table t1(f1 varchar(4));
|
||||
explain extended select encode(f1,'zxcv') as 'enc' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select encode('',_latin1'zxcv') AS `enc` from `test`.`t1`
|
||||
Note 1003 select encode('','zxcv') AS `enc` from `test`.`t1`
|
||||
explain extended select decode(f1,'zxcv') as 'enc' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select decode('',_latin1'zxcv') AS `enc` from `test`.`t1`
|
||||
Note 1003 select decode('','zxcv') AS `enc` from `test`.`t1`
|
||||
drop table t1;
|
||||
create table t1 (a bigint not null)engine=myisam;
|
||||
insert into t1 set a = 1024*1024*1024*4;
|
||||
@ -1390,7 +1390,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 100.00 Using index
|
||||
1 SIMPLE t1 ref code code 13 const 3 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
|
||||
Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = 'a12') and (length(`test`.`t1`.`code`) = 5))
|
||||
DROP TABLE t1,t2;
|
||||
select encode(NULL, NULL);
|
||||
encode(NULL, NULL)
|
||||
|
@ -839,7 +839,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
|
||||
Note 1003 select period_add('9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
|
||||
SET @TMP='2007-08-01 12:22:49';
|
||||
CREATE TABLE t1 (d DATETIME);
|
||||
INSERT INTO t1 VALUES ('2007-08-01 12:22:59');
|
||||
@ -1069,7 +1069,7 @@ timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select timestampdiff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
|
||||
Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,'2001-02-01 12:59:59.120000','2001-05-01 12:58:58.119999') AS `a2`
|
||||
select time_format('100:00:00', '%H %k %h %I %l');
|
||||
time_format('100:00:00', '%H %k %h %I %l')
|
||||
100 100 04 04 4
|
||||
|
@ -439,12 +439,12 @@ explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
|
||||
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
|
||||
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
|
||||
Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
|
||||
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
|
||||
SRID(GeomFromText('LineString(1 1,2 2)',101))
|
||||
101
|
||||
@ -452,7 +452,7 @@ explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
|
||||
Note 1003 select srid(geometryfromtext('LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
|
||||
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
|
@ -1562,7 +1562,7 @@ explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = _latin1'i121') and (`test`.`t1`.`b` = _latin1'a') and (`test`.`t1`.`a2` >= _latin1'b'))
|
||||
Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`b` = 'a') and (`test`.`t1`.`a2` >= 'b'))
|
||||
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
|
||||
@ -1579,7 +1579,7 @@ explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = _latin1'i121') and (`test`.`t2`.`b` = _latin1'a') and (`test`.`t2`.`a2` >= _latin1'b'))
|
||||
Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`b` = 'a') and (`test`.`t2`.`a2` >= 'b'))
|
||||
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
|
||||
@ -1808,7 +1808,7 @@ explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`b` = _latin1'c') and (`test`.`t1`.`a1` > _latin1'a') and (`test`.`t1`.`a2` > _latin1'a'))
|
||||
Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`b` = 'c') and (`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a'))
|
||||
explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
|
||||
@ -1816,7 +1816,7 @@ explain extended select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select (ord(`test`.`t1`.`a1`) + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`)) AS `ord(a1) + count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > _latin1'a') and (`test`.`t1`.`a2` > _latin1'a'))
|
||||
Note 1003 select (ord(`test`.`t1`.`a1`) + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`)) AS `ord(a1) + count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a'))
|
||||
select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
|
||||
count(distinct a1,a2,b)
|
||||
4
|
||||
@ -1924,19 +1924,19 @@ where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a1
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`c` > _latin1'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`
|
||||
explain extended select a1,a2,b,min(c),max(c) from t1
|
||||
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`d` > _latin1'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
|
||||
explain extended select a1,a2,b,c from t1
|
||||
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`d` > _latin1'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c`
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c`
|
||||
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
|
||||
@ -1944,7 +1944,7 @@ explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a'
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`c` > _latin1'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
|
||||
explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
|
||||
@ -1968,12 +1968,12 @@ explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where (`test`.`t1`.`a1` > _latin1'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
|
||||
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
|
||||
explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > _latin1'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
|
||||
Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
|
||||
explain select distinct(a1) from t1 where ord(a2) = 98;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
|
||||
|
@ -387,15 +387,11 @@ show keys from v4;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
select * from information_schema.views where TABLE_NAME like "v%";
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL test v0 select schema_name from information_schema.schemata NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v1 select table_name from information_schema.tables
|
||||
where table_name="v1" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v2 select column_name from information_schema.columns
|
||||
where table_name="v2" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v3 select CHARACTER_SET_NAME from information_schema.character_sets
|
||||
where CHARACTER_SET_NAME like "latin1%" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v4 select COLLATION_NAME from information_schema.collations
|
||||
where COLLATION_NAME like "latin1%" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v0 select `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v1 select `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = 'v1') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v2 select `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = 'v2') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v3 select `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v4 select `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
drop view v0, v1, v2, v3, v4;
|
||||
create table t1 (a int);
|
||||
grant select,update,insert on t1 to mysqltest_1@localhost;
|
||||
@ -488,9 +484,9 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION;
|
||||
create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
|
||||
select * from information_schema.views;
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL test v1 select a from t1 with check option CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v2 select a from t1 WITH LOCAL CHECK OPTION LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v3 select a from t1 WITH CASCADED CHECK OPTION CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
grant select (a) on test.t1 to joe@localhost with grant option;
|
||||
select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
@ -1175,7 +1171,7 @@ select * from information_schema.views
|
||||
where table_name='v1' or table_name='v2';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL test v1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v2 select 1 NONE NO mysqltest_1@localhost DEFINER latin1 latin1_swedish_ci
|
||||
NULL test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER latin1 latin1_swedish_ci
|
||||
drop view v1, v2;
|
||||
drop table t1;
|
||||
drop user mysqltest_1@localhost;
|
||||
@ -1559,8 +1555,7 @@ AS SELECT *
|
||||
FROM INFORMATION_SCHEMA.TABLES;
|
||||
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS where TABLE_NAME = 'v1';
|
||||
VIEW_DEFINITION
|
||||
SELECT *
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
select `TABLES`.`TABLE_CATALOG` AS `TABLE_CATALOG`,`TABLES`.`TABLE_SCHEMA` AS `TABLE_SCHEMA`,`TABLES`.`TABLE_NAME` AS `TABLE_NAME`,`TABLES`.`TABLE_TYPE` AS `TABLE_TYPE`,`TABLES`.`ENGINE` AS `ENGINE`,`TABLES`.`VERSION` AS `VERSION`,`TABLES`.`ROW_FORMAT` AS `ROW_FORMAT`,`TABLES`.`TABLE_ROWS` AS `TABLE_ROWS`,`TABLES`.`AVG_ROW_LENGTH` AS `AVG_ROW_LENGTH`,`TABLES`.`DATA_LENGTH` AS `DATA_LENGTH`,`TABLES`.`MAX_DATA_LENGTH` AS `MAX_DATA_LENGTH`,`TABLES`.`INDEX_LENGTH` AS `INDEX_LENGTH`,`TABLES`.`DATA_FREE` AS `DATA_FREE`,`TABLES`.`AUTO_INCREMENT` AS `AUTO_INCREMENT`,`TABLES`.`CREATE_TIME` AS `CREATE_TIME`,`TABLES`.`UPDATE_TIME` AS `UPDATE_TIME`,`TABLES`.`CHECK_TIME` AS `CHECK_TIME`,`TABLES`.`TABLE_COLLATION` AS `TABLE_COLLATION`,`TABLES`.`CHECKSUM` AS `CHECKSUM`,`TABLES`.`CREATE_OPTIONS` AS `CREATE_OPTIONS`,`TABLES`.`TABLE_COMMENT` AS `TABLE_COMMENT` from `INFORMATION_SCHEMA`.`TABLES`
|
||||
DROP VIEW v1;
|
||||
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA
|
||||
WHERE SCHEMA_NAME ='information_schema';
|
||||
|
@ -210,7 +210,7 @@ v2
|
||||
select view_definition from information_schema.views a
|
||||
where a.table_name = 'v2';
|
||||
view_definition
|
||||
select f1 from testdb_1.v1
|
||||
select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
|
||||
select view_definition from information_schema.views a
|
||||
where a.table_name = 'testdb_1.v1';
|
||||
view_definition
|
||||
|
@ -1634,4 +1634,17 @@ vid tid idx name type
|
||||
3 1 2 c1 NULL
|
||||
3 1 1 pk NULL
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1(id INT PRIMARY KEY)
|
||||
ENGINE=innodb;
|
||||
CREATE TABLE t2(
|
||||
t1_id INT PRIMARY KEY,
|
||||
CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
|
||||
ENGINE=innodb;
|
||||
|
||||
ALTER TABLE t1 CHANGE id id2 INT;
|
||||
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -1,3 +1,4 @@
|
||||
set @@global.concurrent_insert= 0;
|
||||
drop table if exists t1, t2, t3;
|
||||
create table t1 (kill_id int);
|
||||
insert into t1 values(connection_id());
|
||||
|
@ -2011,7 +2011,7 @@ SET character_set_client = @saved_cs_client;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
|
||||
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like 'a%') */
|
||||
/*!50002 WITH CASCADED CHECK OPTION */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
@ -2182,7 +2182,7 @@ SET character_set_client = @saved_cs_client;
|
||||
/*!50001 SET collation_connection = latin1_swedish_ci */;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
|
||||
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like 'a%') */
|
||||
/*!50002 WITH CASCADED CHECK OPTION */;
|
||||
/*!50001 SET character_set_client = @saved_cs_client */;
|
||||
/*!50001 SET character_set_results = @saved_cs_results */;
|
||||
@ -4230,6 +4230,40 @@ LOCK TABLES `test` WRITE;
|
||||
UNLOCK TABLES;
|
||||
drop database `test-database`;
|
||||
use test;
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# -- Bug#30217: Views: changes in metadata behaviour between 5.0 and 5.1.
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
DROP DATABASE IF EXISTS mysqldump_test_db;
|
||||
CREATE DATABASE mysqldump_test_db;
|
||||
use mysqldump_test_db;
|
||||
|
||||
CREATE VIEW v1(x, y) AS SELECT 'a', 'a';
|
||||
|
||||
SELECT view_definition
|
||||
FROM INFORMATION_SCHEMA.VIEWS
|
||||
WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1';
|
||||
view_definition
|
||||
select 'a' AS `x`,'a' AS `y`
|
||||
|
||||
---> Dumping mysqldump_test_db to bug30217.sql
|
||||
|
||||
DROP DATABASE mysqldump_test_db;
|
||||
use test;
|
||||
|
||||
---> Restoring mysqldump_test_db...
|
||||
|
||||
SELECT view_definition
|
||||
FROM INFORMATION_SCHEMA.VIEWS
|
||||
WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1';
|
||||
view_definition
|
||||
select 'a' AS `x`,'a' AS `y`
|
||||
|
||||
DROP DATABASE mysqldump_test_db;
|
||||
|
||||
# -- End of test case for Bug#32538.
|
||||
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
@ -1505,7 +1505,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
|
||||
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
|
||||
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
|
||||
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
|
||||
|
@ -387,5 +387,5 @@ explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index NULL a 5 NULL 5 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or `test`.`t1`.`a`) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like _latin1'1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` having `test`.`t1`.`a`
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or `test`.`t1`.`a`) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` having `test`.`t1`.`a`
|
||||
drop table t1;
|
||||
|
@ -3,3 +3,10 @@ execute stmt1;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
number root localhost test Query time executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon'
|
||||
deallocate prepare stmt1;
|
||||
FLUSH STATUS;
|
||||
SHOW GLOBAL STATUS LIKE 'com_select';
|
||||
Variable_name Value
|
||||
Com_select 102
|
||||
SHOW GLOBAL STATUS LIKE 'com_select';
|
||||
Variable_name Value
|
||||
Com_select 102
|
||||
|
@ -6,7 +6,7 @@ explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnu
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
|
||||
Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,'TRUE') AS `ifnull(null,"TRUE")`,ifnull('TRUE','ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null`
|
||||
select 1 | NULL,1 & NULL,1+NULL,1-NULL;
|
||||
1 | NULL 1 & NULL 1+NULL 1-NULL
|
||||
NULL NULL NULL NULL
|
||||
@ -49,7 +49,7 @@ explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),ine
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")`
|
||||
Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton('122.256') AS `inet_aton("122.256")`,inet_aton('122.226.') AS `inet_aton("122.226.")`,inet_aton('') AS `inet_aton("")`
|
||||
create table t1 (x int);
|
||||
insert into t1 values (null);
|
||||
select * from t1 where x != 0;
|
||||
|
@ -1733,6 +1733,158 @@ a b
|
||||
9999999999999999 14632475938453979136
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
drop view if exists v1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (1,1), (2,2), (3,3);
|
||||
insert into t1 values (3,1), (1,2), (2,3);
|
||||
prepare stmt from "create view v1 as select * from t1";
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
create table t1 (a int, b int);
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` latin1 latin1_swedish_ci
|
||||
drop view v1;
|
||||
prepare stmt from "create view v1 (c,d) as select a,b from t1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d
|
||||
drop view v1;
|
||||
prepare stmt from "create view v1 (c) as select b+1 from t1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c
|
||||
drop view v1;
|
||||
prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from t1), a = all (select a from t1) from t1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) AS `a+2` from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` AS `a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d e f
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select (`t1`.`a` + 2) AS `a+2` from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` AS `a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
c d e f
|
||||
drop view v1;
|
||||
prepare stmt from "create or replace view v1 as select 1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
1
|
||||
1
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
1
|
||||
1
|
||||
drop view v1;
|
||||
prepare stmt from "create view v1 as select 1, 1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1`,1 AS `My_exp_1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
1 My_exp_1
|
||||
1 1
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1`,1 AS `My_exp_1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
1 My_exp_1
|
||||
1 1
|
||||
drop view v1;
|
||||
prepare stmt from "create view v1 (x) as select a from t1 where a > 1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where (`t1`.`a` > 1) latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
x
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where (`t1`.`a` > 1) latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
x
|
||||
drop view v1;
|
||||
prepare stmt from "create view v1 as select * from `t1` `b`";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `b`.`a` AS `a`,`b`.`b` AS `b` from `t1` `b` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
a b
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `b`.`a` AS `a`,`b`.`b` AS `b` from `t1` `b` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
a b
|
||||
drop view v1;
|
||||
prepare stmt from "create view v1 (a,b,c) as select * from t1";
|
||||
execute stmt;
|
||||
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||
execute stmt;
|
||||
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
create temporary table t1 (a int, b int);
|
||||
prepare stmt from "create view v1 as select * from t1";
|
||||
execute stmt;
|
||||
ERROR HY000: View's SELECT refers to a temporary table 't1'
|
||||
execute stmt;
|
||||
ERROR HY000: View's SELECT refers to a temporary table 't1'
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
prepare stmt from "create view v1 as select * from t1";
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
prepare stmt from "create view v1 as select * from `t1` `b`";
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
End of 5.0 tests.
|
||||
create procedure proc_1() reset query cache;
|
||||
call proc_1();
|
||||
|
@ -1507,7 +1507,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
|
||||
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
|
||||
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
|
||||
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
|
||||
|
@ -1505,7 +1505,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
|
||||
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
|
||||
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
|
||||
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
|
||||
|
@ -1075,7 +1075,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
|
||||
def VIEWS TABLE_CATALOG TABLE_CATALOG 253 1536 0 Y 0 0 33
|
||||
def VIEWS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33
|
||||
def VIEWS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33
|
||||
def VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 8 N 17 0 33
|
||||
def VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 15 N 17 0 33
|
||||
def VIEWS CHECK_OPTION CHECK_OPTION 253 24 4 N 1 0 33
|
||||
def VIEWS IS_UPDATABLE IS_UPDATABLE 253 9 2 N 1 0 33
|
||||
def VIEWS DEFINER DEFINER 253 231 14 N 1 0 33
|
||||
@ -1083,7 +1083,7 @@ def VIEWS SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33
|
||||
def VIEWS CHARACTER_SET_CLIENT CHARACTER_SET_CLIENT 253 96 6 N 1 0 33
|
||||
def VIEWS COLLATION_CONNECTION COLLATION_CONNECTION 253 96 6 N 1 0 33
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
|
||||
NULL test v1 SELECT 1 NONE NO root@localhost DEFINER binary binary
|
||||
NULL test v1 select 1 AS `1` NONE NO root@localhost DEFINER binary binary
|
||||
----------------------------------------------------------------
|
||||
SHOW CREATE PROCEDURE p1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
@ -1404,7 +1404,7 @@ CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT '
|
||||
set names utf8;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _koi8r'тест' AS `test` koi8r koi8r_general_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'тест' AS `test` koi8r koi8r_general_ci
|
||||
SHOW CREATE PROCEDURE p1;
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
|
@ -324,29 +324,29 @@ Pos Instruction
|
||||
0 set str@1 NULL
|
||||
1 set_case_expr (12) 0 i@0
|
||||
2 jump_if_not 5(12) (case_expr@0 = 1)
|
||||
3 set str@1 _latin1'1'
|
||||
3 set str@1 '1'
|
||||
4 jump 12
|
||||
5 jump_if_not 8(12) (case_expr@0 = 2)
|
||||
6 set str@1 _latin1'2'
|
||||
6 set str@1 '2'
|
||||
7 jump 12
|
||||
8 jump_if_not 11(12) (case_expr@0 = 3)
|
||||
9 set str@1 _latin1'3'
|
||||
9 set str@1 '3'
|
||||
10 jump 12
|
||||
11 set str@1 _latin1'unknown'
|
||||
11 set str@1 'unknown'
|
||||
12 stmt 0 "SELECT str"
|
||||
SHOW PROCEDURE CODE proc_19194_searched;
|
||||
Pos Instruction
|
||||
0 set str@1 NULL
|
||||
1 jump_if_not 4(11) (i@0 = 1)
|
||||
2 set str@1 _latin1'1'
|
||||
2 set str@1 '1'
|
||||
3 jump 11
|
||||
4 jump_if_not 7(11) (i@0 = 2)
|
||||
5 set str@1 _latin1'2'
|
||||
5 set str@1 '2'
|
||||
6 jump 11
|
||||
7 jump_if_not 10(11) (i@0 = 3)
|
||||
8 set str@1 _latin1'3'
|
||||
8 set str@1 '3'
|
||||
9 jump 11
|
||||
10 set str@1 _latin1'unknown'
|
||||
10 set str@1 'unknown'
|
||||
11 stmt 0 "SELECT str"
|
||||
SHOW PROCEDURE CODE proc_19194_nested_1;
|
||||
Pos Instruction
|
||||
@ -354,59 +354,59 @@ Pos Instruction
|
||||
1 set str_j@3 NULL
|
||||
2 set_case_expr (27) 0 i@0
|
||||
3 jump_if_not 6(27) (case_expr@0 = 10)
|
||||
4 set str_i@2 _latin1'10'
|
||||
4 set str_i@2 '10'
|
||||
5 jump 27
|
||||
6 jump_if_not 20(27) (case_expr@0 = 20)
|
||||
7 set str_i@2 _latin1'20'
|
||||
7 set str_i@2 '20'
|
||||
8 jump_if_not 11(18) (j@1 = 1)
|
||||
9 set str_j@3 _latin1'1'
|
||||
9 set str_j@3 '1'
|
||||
10 jump 18
|
||||
11 jump_if_not 14(18) (j@1 = 2)
|
||||
12 set str_j@3 _latin1'2'
|
||||
12 set str_j@3 '2'
|
||||
13 jump 18
|
||||
14 jump_if_not 17(18) (j@1 = 3)
|
||||
15 set str_j@3 _latin1'3'
|
||||
15 set str_j@3 '3'
|
||||
16 jump 18
|
||||
17 set str_j@3 _latin1'unknown'
|
||||
17 set str_j@3 'unknown'
|
||||
18 stmt 0 "select "i was 20""
|
||||
19 jump 27
|
||||
20 jump_if_not 23(27) (case_expr@0 = 30)
|
||||
21 set str_i@2 _latin1'30'
|
||||
21 set str_i@2 '30'
|
||||
22 jump 27
|
||||
23 jump_if_not 26(27) (case_expr@0 = 40)
|
||||
24 set str_i@2 _latin1'40'
|
||||
24 set str_i@2 '40'
|
||||
25 jump 27
|
||||
26 set str_i@2 _latin1'unknown'
|
||||
26 set str_i@2 'unknown'
|
||||
27 stmt 0 "SELECT str_i, str_j"
|
||||
SHOW PROCEDURE CODE proc_19194_nested_2;
|
||||
Pos Instruction
|
||||
0 set str_i@2 NULL
|
||||
1 set str_j@3 NULL
|
||||
2 jump_if_not 5(27) (i@0 = 10)
|
||||
3 set str_i@2 _latin1'10'
|
||||
3 set str_i@2 '10'
|
||||
4 jump 27
|
||||
5 jump_if_not 20(27) (i@0 = 20)
|
||||
6 set str_i@2 _latin1'20'
|
||||
6 set str_i@2 '20'
|
||||
7 set_case_expr (18) 0 j@1
|
||||
8 jump_if_not 11(18) (case_expr@0 = 1)
|
||||
9 set str_j@3 _latin1'1'
|
||||
9 set str_j@3 '1'
|
||||
10 jump 18
|
||||
11 jump_if_not 14(18) (case_expr@0 = 2)
|
||||
12 set str_j@3 _latin1'2'
|
||||
12 set str_j@3 '2'
|
||||
13 jump 18
|
||||
14 jump_if_not 17(18) (case_expr@0 = 3)
|
||||
15 set str_j@3 _latin1'3'
|
||||
15 set str_j@3 '3'
|
||||
16 jump 18
|
||||
17 set str_j@3 _latin1'unknown'
|
||||
17 set str_j@3 'unknown'
|
||||
18 stmt 0 "select "i was 20""
|
||||
19 jump 27
|
||||
20 jump_if_not 23(27) (i@0 = 30)
|
||||
21 set str_i@2 _latin1'30'
|
||||
21 set str_i@2 '30'
|
||||
22 jump 27
|
||||
23 jump_if_not 26(27) (i@0 = 40)
|
||||
24 set str_i@2 _latin1'40'
|
||||
24 set str_i@2 '40'
|
||||
25 jump 27
|
||||
26 set str_i@2 _latin1'unknown'
|
||||
26 set str_i@2 'unknown'
|
||||
27 stmt 0 "SELECT str_i, str_j"
|
||||
SHOW PROCEDURE CODE proc_19194_nested_3;
|
||||
Pos Instruction
|
||||
@ -414,59 +414,59 @@ Pos Instruction
|
||||
1 set str_j@3 NULL
|
||||
2 set_case_expr (28) 0 i@0
|
||||
3 jump_if_not 6(28) (case_expr@0 = 10)
|
||||
4 set str_i@2 _latin1'10'
|
||||
4 set str_i@2 '10'
|
||||
5 jump 28
|
||||
6 jump_if_not 21(28) (case_expr@0 = 20)
|
||||
7 set str_i@2 _latin1'20'
|
||||
7 set str_i@2 '20'
|
||||
8 set_case_expr (19) 1 j@1
|
||||
9 jump_if_not 12(19) (case_expr@1 = 1)
|
||||
10 set str_j@3 _latin1'1'
|
||||
10 set str_j@3 '1'
|
||||
11 jump 19
|
||||
12 jump_if_not 15(19) (case_expr@1 = 2)
|
||||
13 set str_j@3 _latin1'2'
|
||||
13 set str_j@3 '2'
|
||||
14 jump 19
|
||||
15 jump_if_not 18(19) (case_expr@1 = 3)
|
||||
16 set str_j@3 _latin1'3'
|
||||
16 set str_j@3 '3'
|
||||
17 jump 19
|
||||
18 set str_j@3 _latin1'unknown'
|
||||
18 set str_j@3 'unknown'
|
||||
19 stmt 0 "select "i was 20""
|
||||
20 jump 28
|
||||
21 jump_if_not 24(28) (case_expr@0 = 30)
|
||||
22 set str_i@2 _latin1'30'
|
||||
22 set str_i@2 '30'
|
||||
23 jump 28
|
||||
24 jump_if_not 27(28) (case_expr@0 = 40)
|
||||
25 set str_i@2 _latin1'40'
|
||||
25 set str_i@2 '40'
|
||||
26 jump 28
|
||||
27 set str_i@2 _latin1'unknown'
|
||||
27 set str_i@2 'unknown'
|
||||
28 stmt 0 "SELECT str_i, str_j"
|
||||
SHOW PROCEDURE CODE proc_19194_nested_4;
|
||||
Pos Instruction
|
||||
0 set str_i@2 NULL
|
||||
1 set str_j@3 NULL
|
||||
2 jump_if_not 5(26) (i@0 = 10)
|
||||
3 set str_i@2 _latin1'10'
|
||||
3 set str_i@2 '10'
|
||||
4 jump 26
|
||||
5 jump_if_not 19(26) (i@0 = 20)
|
||||
6 set str_i@2 _latin1'20'
|
||||
6 set str_i@2 '20'
|
||||
7 jump_if_not 10(17) (j@1 = 1)
|
||||
8 set str_j@3 _latin1'1'
|
||||
8 set str_j@3 '1'
|
||||
9 jump 17
|
||||
10 jump_if_not 13(17) (j@1 = 2)
|
||||
11 set str_j@3 _latin1'2'
|
||||
11 set str_j@3 '2'
|
||||
12 jump 17
|
||||
13 jump_if_not 16(17) (j@1 = 3)
|
||||
14 set str_j@3 _latin1'3'
|
||||
14 set str_j@3 '3'
|
||||
15 jump 17
|
||||
16 set str_j@3 _latin1'unknown'
|
||||
16 set str_j@3 'unknown'
|
||||
17 stmt 0 "select "i was 20""
|
||||
18 jump 26
|
||||
19 jump_if_not 22(26) (i@0 = 30)
|
||||
20 set str_i@2 _latin1'30'
|
||||
20 set str_i@2 '30'
|
||||
21 jump 26
|
||||
22 jump_if_not 25(26) (i@0 = 40)
|
||||
23 set str_i@2 _latin1'40'
|
||||
23 set str_i@2 '40'
|
||||
24 jump 26
|
||||
25 set str_i@2 _latin1'unknown'
|
||||
25 set str_i@2 'unknown'
|
||||
26 stmt 0 "SELECT str_i, str_j"
|
||||
CALL proc_19194_nested_1(10, 1);
|
||||
str_i str_j
|
||||
@ -793,7 +793,7 @@ end while;
|
||||
end//
|
||||
show procedure code proc_33618_h;
|
||||
Pos Instruction
|
||||
0 set count1@1 _latin1'0'
|
||||
0 set count1@1 '0'
|
||||
1 set vb@2 NULL
|
||||
2 set last_row@3 NULL
|
||||
3 jump_if_not 24(24) (num@0 >= 1)
|
||||
@ -818,7 +818,7 @@ Pos Instruction
|
||||
22 jump 3
|
||||
show procedure code proc_33618_c;
|
||||
Pos Instruction
|
||||
0 set count1@1 _latin1'0'
|
||||
0 set count1@1 '0'
|
||||
1 set vb@2 NULL
|
||||
2 set last_row@3 NULL
|
||||
3 jump_if_not 23(23) (num@0 >= 1)
|
||||
|
@ -1508,7 +1508,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
|
||||
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
|
||||
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
|
||||
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
|
||||
|
@ -1511,7 +1511,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1''))
|
||||
Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> ''))
|
||||
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
|
||||
companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1)
|
||||
00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087
|
||||
|
@ -393,13 +393,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = _latin1'2002-08-03')
|
||||
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
|
||||
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = _latin1'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||
date
|
||||
2002-08-03
|
||||
@ -540,13 +540,13 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = _latin1'1')
|
||||
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select '3' AS `numreponse` from `test`.`t1` where (('1' = _latin1'1'))
|
||||
Note 1003 select '3' AS `numreponse` from `test`.`t1` where (('1' = '1'))
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int(1));
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@ -1024,7 +1024,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
Warnings:
|
||||
Note 1003 select (select encrypt(_latin1'test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
Note 1003 select (select encrypt('test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
||||
@ -1481,7 +1481,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < _latin1'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
|
||||
drop table t1,t2;
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (a int);
|
||||
@ -2820,19 +2820,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = _latin1'0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = _latin1'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and (<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) and (<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`))))
|
||||
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
|
||||
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = _latin1'0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a char(5), b char(5));
|
||||
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
|
||||
|
@ -112,7 +112,7 @@ v1 CREATE TEMPORARY TABLE `v1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'This is view' AS `A` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'This is view' AS `A` latin1 latin1_swedish_ci
|
||||
drop view v1;
|
||||
select * from v1;
|
||||
A
|
||||
|
@ -2016,4 +2016,42 @@ i j
|
||||
10 10
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
drop table if exists t1, t2;
|
||||
drop trigger if exists trg1;
|
||||
drop trigger if exists trg2;
|
||||
create table t1 (a int);
|
||||
create table t2 (b int);
|
||||
create trigger trg1 after update on t1 for each row set @a= @a+1;
|
||||
create trigger trg2 after update on t2 for each row set @b= @b+1;
|
||||
insert into t1 values (1), (2), (3);
|
||||
insert into t2 values (1), (2), (3);
|
||||
set @a= 0;
|
||||
set @b= 0;
|
||||
update t1, t2 set t1.a= t1.a, t2.b= t2.b;
|
||||
select @a, @b;
|
||||
@a @b
|
||||
3 3
|
||||
update t1, t2 set t1.a= t2.b, t2.b= t1.a;
|
||||
select @a, @b;
|
||||
@a @b
|
||||
6 6
|
||||
update t1 set a= a;
|
||||
select @a, @b;
|
||||
@a @b
|
||||
9 6
|
||||
update t2 set b= b;
|
||||
select @a, @b;
|
||||
@a @b
|
||||
9 9
|
||||
update t1 set a= 1;
|
||||
select @a, @b;
|
||||
@a @b
|
||||
12 9
|
||||
update t2 set b= 1;
|
||||
select @a, @b;
|
||||
@a @b
|
||||
12 12
|
||||
drop trigger trg1;
|
||||
drop trigger trg2;
|
||||
drop table t1, t2;
|
||||
End of 5.1 tests.
|
||||
|
@ -519,7 +519,7 @@ coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select charset(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`
|
||||
Note 1003 select charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`
|
||||
update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1;
|
||||
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
|
||||
if(imagem is null, "ERROR", "OK") length(imagem)
|
||||
|
12
mysql-test/r/variables_debug.result
Normal file
12
mysql-test/r/variables_debug.result
Normal file
@ -0,0 +1,12 @@
|
||||
set debug= 'T';
|
||||
select @@debug;
|
||||
@@debug
|
||||
T
|
||||
set debug= '+P';
|
||||
select @@debug;
|
||||
@@debug
|
||||
P:T
|
||||
set debug= '-P';
|
||||
select @@debug;
|
||||
@@debug
|
||||
T
|
@ -3061,7 +3061,7 @@ TheEnd
|
||||
TheEnd
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd` latin1 latin1_swedish_ci
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'The\ZEnd' AS `TheEnd` latin1 latin1_swedish_ci
|
||||
DROP VIEW v1;
|
||||
CREATE TABLE t1 (mydate DATETIME);
|
||||
INSERT INTO t1 VALUES
|
||||
@ -3613,7 +3613,26 @@ ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default val
|
||||
set @@sql_mode=@old_mode;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
||||
# -----------------------------------------------------------------
|
||||
# -- Bug#34337: Server crash when Altering a view using a table name.
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
CREATE TABLE t1(c1 INT);
|
||||
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1);
|
||||
ERROR HY000: 'test.t1' is not VIEW
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# -- End of test case for Bug#34337.
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.0 tests.
|
||||
# -----------------------------------------------------------------
|
||||
DROP DATABASE IF EXISTS `d-1`;
|
||||
CREATE DATABASE `d-1`;
|
||||
USE `d-1`;
|
||||
@ -3676,4 +3695,59 @@ DROP TABLE t1;
|
||||
|
||||
# End of test case for Bug#26676.
|
||||
|
||||
End of 5.1 tests.
|
||||
# -----------------------------------------------------------------
|
||||
# -- Bug#32538: View definition picks up character set, but not collation
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
DROP VIEW IF EXISTS v1;
|
||||
|
||||
SET collation_connection = latin1_general_ci;
|
||||
CREATE VIEW v1 AS SELECT _latin1 'text1' AS c1, 'text2' AS c2;
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1;
|
||||
COLLATION(c1) COLLATION(c2)
|
||||
latin1_swedish_ci latin1_general_ci
|
||||
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'text1' AS `c1`,'text2' AS `c2` latin1 latin1_general_ci
|
||||
|
||||
SELECT * FROM v1 WHERE c1 = 'text1';
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin1_general_ci,COERCIBLE) for operation '='
|
||||
|
||||
SELECT * FROM v1 WHERE c2 = 'text2';
|
||||
c1 c2
|
||||
text1 text2
|
||||
|
||||
use test;
|
||||
SET names latin1;
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1;
|
||||
COLLATION(c1) COLLATION(c2)
|
||||
latin1_swedish_ci latin1_general_ci
|
||||
|
||||
SELECT * FROM v1 WHERE c1 = 'text1';
|
||||
c1 c2
|
||||
text1 text2
|
||||
|
||||
SELECT * FROM v1 WHERE c2 = 'text2';
|
||||
ERROR HY000: Illegal mix of collations (latin1_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation '='
|
||||
|
||||
DROP VIEW v1;
|
||||
|
||||
# -- End of test case for Bug#32538.
|
||||
|
||||
drop view if exists a;
|
||||
drop procedure if exists p;
|
||||
create procedure p()
|
||||
begin
|
||||
declare continue handler for sqlexception begin end;
|
||||
create view a as select 1;
|
||||
end|
|
||||
call p();
|
||||
call p();
|
||||
drop view a;
|
||||
drop procedure p;
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.1 tests.
|
||||
# -----------------------------------------------------------------
|
||||
|
@ -469,6 +469,7 @@ use test;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
|
||||
drop database mysqltest;
|
||||
drop view if exists v1;
|
||||
drop table if exists t1;
|
||||
create table t1 as select * from mysql.user where user='';
|
||||
delete from mysql.user where user='';
|
||||
flush privileges;
|
||||
|
@ -379,7 +379,7 @@ master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t2
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
@ -391,7 +391,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
|
@ -73,7 +73,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 fulltext a a 0 1 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'collections'))
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('collections'))
|
||||
select * from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||
a b
|
||||
Full-text indexes are called collections
|
||||
|
@ -251,7 +251,7 @@ master-bin.000001 # Query # # use `test`; drop table t1,t2
|
||||
master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; insert into ti values(1)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engine=myisam
|
||||
master-bin.000001 # Query # # use `test`; insert t1 values (1)
|
||||
master-bin.000001 # Query # # use `test`; create table t0 (n int)
|
||||
@ -358,11 +358,11 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (8,8)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (9,9)
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10)
|
||||
master-bin.000001 # Query # # use `test`; BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100)
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # use `test`; COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1,t2
|
||||
reset master;
|
||||
create table t1 (a int) engine=innodb;
|
||||
|
@ -25,7 +25,7 @@ explain extended select is_free_lock("lock"), is_used_lock("lock");
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select is_free_lock(_latin1'lock') AS `is_free_lock("lock")`,is_used_lock(_latin1'lock') AS `is_used_lock("lock")`
|
||||
Note 1003 select is_free_lock('lock') AS `is_free_lock("lock")`,is_used_lock('lock') AS `is_used_lock("lock")`
|
||||
select is_free_lock("lock2");
|
||||
is_free_lock("lock2")
|
||||
1
|
||||
|
@ -11,7 +11,7 @@ explain extended select master_pos_wait('master-bin.999999',0,2);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
|
||||
Note 1003 select master_pos_wait('master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
|
||||
select master_pos_wait('master-bin.999999',0);
|
||||
stop slave sql_thread;
|
||||
master_pos_wait('master-bin.999999',0)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
rpl_ndb_circular : Bug#33849 COMMIT event missing in cluster circular replication.
|
||||
rpl_ndb_circular_simplex : Bug#33849 COMMIT event missing in cluster circular replication.
|
||||
|
||||
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
|
||||
|
@ -33,3 +33,14 @@ SELECT IS_USED_LOCK('bug31418') = CONNECTION_ID();
|
||||
--change_user
|
||||
SELECT IS_FREE_LOCK('bug31418');
|
||||
SELECT IS_USED_LOCK('bug31418');
|
||||
|
||||
#
|
||||
# Bug#31222: com_% global status counters behave randomly with
|
||||
# mysql_change_user.
|
||||
#
|
||||
# Moved to not_embedded_server.test due to Bug#34517: SHOW GLOBAL STATUS does
|
||||
# not work properly in embedded server.
|
||||
#
|
||||
# TODO: move it back when Bug#34517 is fixed (don't forget to add
|
||||
# --force-restart into change_user-master.opt).
|
||||
#
|
||||
|
6
mysql-test/t/commit_1innodb.test
Normal file
6
mysql-test/t/commit_1innodb.test
Normal file
@ -0,0 +1,6 @@
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
let $engine_type = InnoDB;
|
||||
|
||||
-- source include/commit.inc
|
@ -1385,4 +1385,68 @@ DROP TABLE t2;
|
||||
--echo # -- End of test case for Bug#21380.
|
||||
--echo
|
||||
|
||||
--echo # --
|
||||
--echo # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
|
||||
--echo # --
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
|
||||
CREATE TABLE t1(c1 TIMESTAMP, c2 TIMESTAMP);
|
||||
|
||||
--echo
|
||||
|
||||
SET sql_mode = NO_ZERO_DATE;
|
||||
|
||||
--echo
|
||||
--error ER_INVALID_DEFAULT
|
||||
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT 0);
|
||||
|
||||
--echo
|
||||
--error ER_INVALID_DEFAULT
|
||||
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP);
|
||||
|
||||
--echo
|
||||
--echo # -- Check that NULL column still can be created.
|
||||
CREATE TABLE t2(c1 TIMESTAMP NULL);
|
||||
|
||||
--echo
|
||||
--echo # -- Check ALTER TABLE.
|
||||
--error ER_INVALID_DEFAULT
|
||||
ALTER TABLE t1 ADD INDEX(c1);
|
||||
|
||||
--echo
|
||||
--echo # -- Check DATETIME.
|
||||
SET sql_mode = '';
|
||||
|
||||
--echo
|
||||
|
||||
CREATE TABLE t3(c1 DATETIME NOT NULL);
|
||||
INSERT INTO t3 VALUES (0);
|
||||
|
||||
--echo
|
||||
SET sql_mode = TRADITIONAL;
|
||||
|
||||
--echo
|
||||
--error ER_TRUNCATED_WRONG_VALUE
|
||||
ALTER TABLE t3 ADD INDEX(c1);
|
||||
|
||||
--echo
|
||||
--echo # -- Cleanup.
|
||||
|
||||
SET sql_mode = '';
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
||||
--echo
|
||||
--echo # -- End of Bug#18834.
|
||||
--echo
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -85,6 +85,10 @@ CREATE VIEW v2 AS SELECT _utf8'тест' as c1|
|
||||
|
||||
--echo
|
||||
|
||||
CREATE VIEW v3 AS SELECT _utf8'тест'|
|
||||
|
||||
--echo
|
||||
|
||||
#
|
||||
# First-round checks.
|
||||
#
|
||||
@ -120,6 +124,7 @@ SET @@collation_connection= cp1251_general_ci|
|
||||
--disable_result_log
|
||||
SELECT * FROM mysqltest1.v1|
|
||||
SELECT * FROM mysqltest1.v2|
|
||||
SELECT * FROM mysqltest1.v3|
|
||||
--enable_result_log
|
||||
|
||||
use mysqltest1|
|
||||
@ -168,7 +173,7 @@ DROP DATABASE mysqltest1|
|
||||
--echo
|
||||
--echo ---> connection: con3
|
||||
|
||||
# - Switch environment variables and trigger loading stored procedures;
|
||||
# - Switch environment variables and trigger loading views;
|
||||
|
||||
SET @@character_set_client= cp1251|
|
||||
SET @@character_set_results= cp1251|
|
||||
@ -177,6 +182,7 @@ SET @@collation_connection= cp1251_general_ci|
|
||||
--disable_result_log
|
||||
SELECT * FROM mysqltest1.v1|
|
||||
SELECT * FROM mysqltest1.v2|
|
||||
SELECT * FROM mysqltest1.v3|
|
||||
--enable_result_log
|
||||
|
||||
use mysqltest1|
|
||||
|
@ -85,6 +85,10 @@ CREATE VIEW v2 AS SELECT _koi8r'
|
||||
|
||||
--echo
|
||||
|
||||
CREATE VIEW v3 AS SELECT _koi8r'<27><><EFBFBD><EFBFBD>'|
|
||||
|
||||
--echo
|
||||
|
||||
#
|
||||
# First-round checks.
|
||||
#
|
||||
@ -120,6 +124,7 @@ SET @@collation_connection= cp1251_general_ci|
|
||||
--disable_result_log
|
||||
SELECT * FROM mysqltest1.v1|
|
||||
SELECT * FROM mysqltest1.v2|
|
||||
SELECT * FROM mysqltest1.v3|
|
||||
--enable_result_log
|
||||
|
||||
use mysqltest1|
|
||||
@ -168,7 +173,7 @@ DROP DATABASE mysqltest1|
|
||||
--echo
|
||||
--echo ---> connection: con3
|
||||
|
||||
# - Switch environment variables and trigger loading stored procedures;
|
||||
# - Switch environment variables and trigger loading views;
|
||||
|
||||
SET @@character_set_client= cp1251|
|
||||
SET @@character_set_results= cp1251|
|
||||
@ -177,6 +182,7 @@ SET @@collation_connection= cp1251_general_ci|
|
||||
--disable_result_log
|
||||
SELECT * FROM mysqltest1.v1|
|
||||
SELECT * FROM mysqltest1.v2|
|
||||
SELECT * FROM mysqltest1.v3|
|
||||
--enable_result_log
|
||||
|
||||
use mysqltest1|
|
||||
|
@ -16,11 +16,9 @@ ctype_big5 : BUG#26711 2007-06-21 Lars Test has never worked on Do
|
||||
|
||||
federated_transactions : Bug#29523 Transactions do not work
|
||||
lowercase_table3 : Bug#32667 lowercase_table3.test reports to error log
|
||||
kill : Bug#29149: Test "kill" fails on Windows
|
||||
innodb_mysql : Bug#32724: innodb_mysql.test fails randomly
|
||||
wait_timeout : Bug#32801 wait_timeout.test fails randomly
|
||||
ctype_create : Bug#32965 main.ctype_create fails
|
||||
status : Bug#32966 main.status fails
|
||||
ps_ddl : Bug#12093 2007-12-14 pending WL#4165 / WL#4166
|
||||
csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
|
||||
query_cache_debug : Bug#34424: query_cache_debug.test leads to valgrind warnings
|
||||
|
@ -6,6 +6,10 @@
|
||||
#
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# Disable concurrent inserts to avoid test failures when reading the
|
||||
# connection id which was inserted into a table by another thread.
|
||||
set @@global.concurrent_insert= 0;
|
||||
|
||||
connect (con1, localhost, root,,);
|
||||
connect (con2, localhost, root,,);
|
||||
|
||||
|
@ -396,6 +396,9 @@ unlock tables;
|
||||
connection insert;
|
||||
--reap
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from t1;
|
||||
--source include/wait_condition.inc
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
disconnect flush;
|
||||
|
@ -1 +1 @@
|
||||
--log=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE
|
||||
--log=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE,TABLE
|
||||
|
@ -1799,6 +1799,61 @@ create table test (a int);
|
||||
drop database `test-database`;
|
||||
use test;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- Bug#30217: Views: changes in metadata behaviour between 5.0 and 5.1.
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqldump_test_db;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqldump_test_db;
|
||||
use mysqldump_test_db;
|
||||
|
||||
--echo
|
||||
|
||||
CREATE VIEW v1(x, y) AS SELECT 'a', 'a';
|
||||
|
||||
--echo
|
||||
|
||||
SELECT view_definition
|
||||
FROM INFORMATION_SCHEMA.VIEWS
|
||||
WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1';
|
||||
|
||||
--echo
|
||||
|
||||
--echo ---> Dumping mysqldump_test_db to bug30217.sql
|
||||
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqldump_test_db > $MYSQLTEST_VARDIR/tmp/bug30217.sql
|
||||
|
||||
--echo
|
||||
|
||||
DROP DATABASE mysqldump_test_db;
|
||||
use test;
|
||||
|
||||
--echo
|
||||
|
||||
--echo ---> Restoring mysqldump_test_db...
|
||||
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug30217.sql
|
||||
|
||||
--echo
|
||||
|
||||
SELECT view_definition
|
||||
FROM INFORMATION_SCHEMA.VIEWS
|
||||
WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1';
|
||||
|
||||
--echo
|
||||
|
||||
DROP DATABASE mysqldump_test_db;
|
||||
|
||||
--echo
|
||||
--echo # -- End of test case for Bug#32538.
|
||||
--echo
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.1 tests
|
||||
|
@ -20,4 +20,38 @@ prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!
|
||||
execute stmt1;
|
||||
deallocate prepare stmt1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#31222: com_% global status counters behave randomly with
|
||||
# mysql_change_user.
|
||||
#
|
||||
# Moved from change_user.test due to Bug#34517: SHOW GLOBAL STATUS does not
|
||||
# work properly in embedded server.
|
||||
#
|
||||
# TODO: move it back when Bug#34517 is fixed.
|
||||
#
|
||||
|
||||
FLUSH STATUS;
|
||||
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
|
||||
let $i = 100;
|
||||
|
||||
while ($i)
|
||||
{
|
||||
dec $i;
|
||||
|
||||
SELECT 1;
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
|
||||
SHOW GLOBAL STATUS LIKE 'com_select';
|
||||
|
||||
--change_user
|
||||
|
||||
SHOW GLOBAL STATUS LIKE 'com_select';
|
||||
|
||||
# End of 5.1 tests
|
||||
|
@ -1838,6 +1838,129 @@ select * from t1 where a = @a and b = @b;
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#32890 Crash after repeated create and drop of tables and views
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop view if exists v1;
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (1,1), (2,2), (3,3);
|
||||
insert into t1 values (3,1), (1,2), (2,3);
|
||||
|
||||
prepare stmt from "create view v1 as select * from t1";
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
create table t1 (a int, b int);
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
drop view v1;
|
||||
|
||||
prepare stmt from "create view v1 (c,d) as select a,b from t1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
prepare stmt from "create view v1 (c) as select b+1 from t1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from t1), a = all (select a from t1) from t1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
prepare stmt from "create or replace view v1 as select 1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
prepare stmt from "create view v1 as select 1, 1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
prepare stmt from "create view v1 (x) as select a from t1 where a > 1";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
prepare stmt from "create view v1 as select * from `t1` `b`";
|
||||
execute stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
prepare stmt from "create view v1 (a,b,c) as select * from t1";
|
||||
--error ER_VIEW_WRONG_LIST
|
||||
execute stmt;
|
||||
--error ER_VIEW_WRONG_LIST
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
|
||||
drop table t1;
|
||||
create temporary table t1 (a int, b int);
|
||||
|
||||
prepare stmt from "create view v1 as select * from t1";
|
||||
--error ER_VIEW_SELECT_TMPTABLE
|
||||
execute stmt;
|
||||
--error ER_VIEW_SELECT_TMPTABLE
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--error ER_NO_SUCH_TABLE
|
||||
prepare stmt from "create view v1 as select * from t1";
|
||||
--error ER_NO_SUCH_TABLE
|
||||
prepare stmt from "create view v1 as select * from `t1` `b`";
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
|
@ -2304,4 +2304,37 @@ unlock tables;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#23771 AFTER UPDATE trigger not invoked when there are no changes of the data
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
drop trigger if exists trg1;
|
||||
drop trigger if exists trg2;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
create table t2 (b int);
|
||||
create trigger trg1 after update on t1 for each row set @a= @a+1;
|
||||
create trigger trg2 after update on t2 for each row set @b= @b+1;
|
||||
insert into t1 values (1), (2), (3);
|
||||
insert into t2 values (1), (2), (3);
|
||||
set @a= 0;
|
||||
set @b= 0;
|
||||
update t1, t2 set t1.a= t1.a, t2.b= t2.b;
|
||||
select @a, @b;
|
||||
update t1, t2 set t1.a= t2.b, t2.b= t1.a;
|
||||
select @a, @b;
|
||||
update t1 set a= a;
|
||||
select @a, @b;
|
||||
update t2 set b= b;
|
||||
select @a, @b;
|
||||
update t1 set a= 1;
|
||||
select @a, @b;
|
||||
update t2 set b= 1;
|
||||
select @a, @b;
|
||||
drop trigger trg1;
|
||||
drop trigger trg2;
|
||||
drop table t1, t2;
|
||||
|
||||
--echo End of 5.1 tests.
|
||||
|
12
mysql-test/t/variables_debug.test
Normal file
12
mysql-test/t/variables_debug.test
Normal file
@ -0,0 +1,12 @@
|
||||
--source include/have_debug.inc
|
||||
|
||||
#
|
||||
# Bug#34678 @@debug variable's incremental mode
|
||||
#
|
||||
|
||||
set debug= 'T';
|
||||
select @@debug;
|
||||
set debug= '+P';
|
||||
select @@debug;
|
||||
set debug= '-P';
|
||||
select @@debug;
|
@ -3468,7 +3468,41 @@ set @@sql_mode=@old_mode;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
###########################################################################
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- Bug#34337: Server crash when Altering a view using a table name.
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
|
||||
CREATE TABLE t1(c1 INT);
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
--error ER_WRONG_OBJECT
|
||||
ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1);
|
||||
|
||||
--echo
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
--echo # -- End of test case for Bug#34337.
|
||||
--echo
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.0 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Bug#21370 View renaming lacks tablename_to_filename encoding
|
||||
@ -3540,4 +3574,88 @@ DROP TABLE t1;
|
||||
--echo # End of test case for Bug#26676.
|
||||
--echo
|
||||
|
||||
--echo End of 5.1 tests.
|
||||
###########################################################################
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- Bug#32538: View definition picks up character set, but not collation
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo
|
||||
|
||||
--disable_warnings
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
|
||||
--echo
|
||||
|
||||
SET collation_connection = latin1_general_ci;
|
||||
CREATE VIEW v1 AS SELECT _latin1 'text1' AS c1, 'text2' AS c2;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1;
|
||||
|
||||
--echo
|
||||
|
||||
SHOW CREATE VIEW v1;
|
||||
|
||||
--echo
|
||||
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT * FROM v1 WHERE c1 = 'text1';
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM v1 WHERE c2 = 'text2';
|
||||
|
||||
--echo
|
||||
|
||||
use test;
|
||||
SET names latin1;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT COLLATION(c1), COLLATION(c2) FROM v1;
|
||||
|
||||
--echo
|
||||
|
||||
SELECT * FROM v1 WHERE c1 = 'text1';
|
||||
|
||||
--echo
|
||||
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT * FROM v1 WHERE c2 = 'text2';
|
||||
|
||||
--echo
|
||||
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo
|
||||
--echo # -- End of test case for Bug#32538.
|
||||
--echo
|
||||
|
||||
#
|
||||
# Bug#34587 Creating a view inside a stored procedure leads to a server crash
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop view if exists a;
|
||||
drop procedure if exists p;
|
||||
--enable_warnings
|
||||
|
||||
delimiter |;
|
||||
create procedure p()
|
||||
begin
|
||||
declare continue handler for sqlexception begin end;
|
||||
create view a as select 1;
|
||||
end|
|
||||
delimiter ;|
|
||||
call p();
|
||||
call p();
|
||||
drop view a;
|
||||
drop procedure p;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.1 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
@ -614,6 +614,7 @@ drop database mysqltest;
|
||||
#
|
||||
--disable_warnings
|
||||
drop view if exists v1;
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# Backup anonymous users and remove them. (They get in the way of
|
||||
|
Reference in New Issue
Block a user