mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into mysql.com:/opt/local/work/mysql-5.0-17199 mysql-test/r/create.result: Auto merged mysql-test/t/create.test: Auto merged sql/item_strfunc.cc: Auto merged sql/log_event.cc: Auto merged sql/slave.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/r/sp.result: SCCS merged mysql-test/t/sp.test: SCCS merged
This commit is contained in:
@ -607,7 +607,7 @@ create database mysqltest;
|
||||
use mysqltest;
|
||||
drop database mysqltest;
|
||||
create table test.t1 like x;
|
||||
ERROR 42000: Incorrect database name 'NULL'
|
||||
ERROR 3D000: No database selected
|
||||
drop table if exists test.t1;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
|
@ -1158,3 +1158,108 @@ Warnings:
|
||||
Error 1146 Table 'test.t4' doesn't exist
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2, t3;
|
||||
create database mysqltest_long_database_name_to_thrash_heap;
|
||||
use test;
|
||||
create table t1 (i int);
|
||||
prepare stmt from "alter table test.t1 rename t1";
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
execute stmt;
|
||||
show tables like 't1';
|
||||
Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
|
||||
prepare stmt from "alter table test.t1 rename t1";
|
||||
use test;
|
||||
execute stmt;
|
||||
show tables like 't1';
|
||||
Tables_in_test (t1)
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
show tables like 't1';
|
||||
Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
|
||||
t1
|
||||
deallocate prepare stmt;
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
prepare stmt_create from "create table t1 (i int)";
|
||||
prepare stmt_insert from "insert into t1 (i) values (1)";
|
||||
prepare stmt_update from "update t1 set i=2";
|
||||
prepare stmt_delete from "delete from t1 where i=2";
|
||||
prepare stmt_select from "select * from t1";
|
||||
prepare stmt_alter from "alter table t1 add column (b int)";
|
||||
prepare stmt_alter1 from "alter table t1 drop column b";
|
||||
prepare stmt_analyze from "analyze table t1";
|
||||
prepare stmt_optimize from "optimize table t1";
|
||||
prepare stmt_show from "show tables like 't1'";
|
||||
prepare stmt_truncate from "truncate table t1";
|
||||
prepare stmt_drop from "drop table t1";
|
||||
drop table t1;
|
||||
use test;
|
||||
execute stmt_create;
|
||||
show tables like 't1';
|
||||
Tables_in_test (t1)
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
show tables like 't1';
|
||||
Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
|
||||
t1
|
||||
use test;
|
||||
execute stmt_insert;
|
||||
select * from mysqltest_long_database_name_to_thrash_heap.t1;
|
||||
i
|
||||
1
|
||||
execute stmt_update;
|
||||
select * from mysqltest_long_database_name_to_thrash_heap.t1;
|
||||
i
|
||||
2
|
||||
execute stmt_delete;
|
||||
execute stmt_select;
|
||||
i
|
||||
execute stmt_alter;
|
||||
show columns from mysqltest_long_database_name_to_thrash_heap.t1;
|
||||
Field Type Null Key Default Extra
|
||||
i int(11) YES NULL
|
||||
b int(11) YES NULL
|
||||
execute stmt_alter1;
|
||||
show columns from mysqltest_long_database_name_to_thrash_heap.t1;
|
||||
Field Type Null Key Default Extra
|
||||
i int(11) YES NULL
|
||||
execute stmt_analyze;
|
||||
Table Op Msg_type Msg_text
|
||||
mysqltest_long_database_name_to_thrash_heap.t1 analyze status Table is already up to date
|
||||
execute stmt_optimize;
|
||||
Table Op Msg_type Msg_text
|
||||
mysqltest_long_database_name_to_thrash_heap.t1 optimize status Table is already up to date
|
||||
execute stmt_show;
|
||||
Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
|
||||
t1
|
||||
execute stmt_truncate;
|
||||
execute stmt_drop;
|
||||
show tables like 't1';
|
||||
Tables_in_test (t1)
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
show tables like 't1';
|
||||
Tables_in_mysqltest_long_database_name_to_thrash_heap (t1)
|
||||
drop database mysqltest_long_database_name_to_thrash_heap;
|
||||
prepare stmt_create from "create table t1 (i int)";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_insert from "insert into t1 (i) values (1)";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_update from "update t1 set i=2";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_delete from "delete from t1 where i=2";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_select from "select * from t1";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_alter from "alter table t1 add column (b int)";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_alter1 from "alter table t1 drop column b";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_analyze from "analyze table t1";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_optimize from "optimize table t1";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_show from "show tables like 't1'";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_truncate from "truncate table t1";
|
||||
ERROR 3D000: No database selected
|
||||
prepare stmt_drop from "drop table t1";
|
||||
ERROR 3D000: No database selected
|
||||
create temporary table t1 (i int);
|
||||
ERROR 3D000: No database selected
|
||||
use test;
|
||||
|
@ -4990,6 +4990,52 @@ CALL bug18037_p2()|
|
||||
DROP FUNCTION bug18037_f1|
|
||||
DROP PROCEDURE bug18037_p1|
|
||||
DROP PROCEDURE bug18037_p2|
|
||||
use test|
|
||||
create table t3 (i int)|
|
||||
insert into t3 values (1), (2)|
|
||||
create database mysqltest1|
|
||||
use mysqltest1|
|
||||
create function bug17199() returns varchar(2) deterministic return 'ok'|
|
||||
use test|
|
||||
select *, mysqltest1.bug17199() from t3|
|
||||
i mysqltest1.bug17199()
|
||||
1 ok
|
||||
2 ok
|
||||
use mysqltest1|
|
||||
create function bug18444(i int) returns int no sql deterministic return i + 1|
|
||||
use test|
|
||||
select mysqltest1.bug18444(i) from t3|
|
||||
mysqltest1.bug18444(i)
|
||||
2
|
||||
3
|
||||
drop database mysqltest1|
|
||||
create database mysqltest1 charset=utf8|
|
||||
create database mysqltest2 charset=utf8|
|
||||
create procedure mysqltest1.p1()
|
||||
begin
|
||||
-- alters the default collation of database test
|
||||
alter database character set koi8r;
|
||||
end|
|
||||
use mysqltest1|
|
||||
call p1()|
|
||||
show create database mysqltest1|
|
||||
Database Create Database
|
||||
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET koi8r */
|
||||
show create database mysqltest2|
|
||||
Database Create Database
|
||||
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET utf8 */
|
||||
alter database mysqltest1 character set utf8|
|
||||
use mysqltest2|
|
||||
call mysqltest1.p1()|
|
||||
show create database mysqltest1|
|
||||
Database Create Database
|
||||
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET koi8r */
|
||||
show create database mysqltest2|
|
||||
Database Create Database
|
||||
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET utf8 */
|
||||
drop database mysqltest1|
|
||||
drop database mysqltest2|
|
||||
use test|
|
||||
drop table if exists t3|
|
||||
drop procedure if exists bug15217|
|
||||
create table t3 as select 1|
|
||||
|
@ -517,7 +517,7 @@ DROP TABLE t12913;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
drop database mysqltest;
|
||||
--error 1102
|
||||
--error ER_NO_DB_ERROR
|
||||
create table test.t1 like x;
|
||||
--disable_warnings
|
||||
drop table if exists test.t1;
|
||||
|
@ -1146,4 +1146,122 @@ execute stmt;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
#
|
||||
# Bug#17199 "Table not found" error occurs if the query contains a call
|
||||
# to a function from another database.
|
||||
# Test prepared statements- related behaviour.
|
||||
#
|
||||
#
|
||||
# ALTER TABLE RENAME and Prepared Statements: wrong DB name buffer was used
|
||||
# in ALTER ... RENAME which caused memory corruption in prepared statements.
|
||||
# No need to fix this problem in 4.1 as ALTER TABLE is not allowed in
|
||||
# Prepared Statements in 4.1.
|
||||
#
|
||||
create database mysqltest_long_database_name_to_thrash_heap;
|
||||
use test;
|
||||
create table t1 (i int);
|
||||
prepare stmt from "alter table test.t1 rename t1";
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
execute stmt;
|
||||
show tables like 't1';
|
||||
prepare stmt from "alter table test.t1 rename t1";
|
||||
use test;
|
||||
execute stmt;
|
||||
show tables like 't1';
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
show tables like 't1';
|
||||
deallocate prepare stmt;
|
||||
#
|
||||
# Check that a prepared statement initializes its current database at
|
||||
# PREPARE, and then works correctly even if the current database has been
|
||||
# changed.
|
||||
#
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
# Necessary for preparation of INSERT/UPDATE/DELETE to succeed
|
||||
prepare stmt_create from "create table t1 (i int)";
|
||||
prepare stmt_insert from "insert into t1 (i) values (1)";
|
||||
prepare stmt_update from "update t1 set i=2";
|
||||
prepare stmt_delete from "delete from t1 where i=2";
|
||||
prepare stmt_select from "select * from t1";
|
||||
prepare stmt_alter from "alter table t1 add column (b int)";
|
||||
prepare stmt_alter1 from "alter table t1 drop column b";
|
||||
prepare stmt_analyze from "analyze table t1";
|
||||
prepare stmt_optimize from "optimize table t1";
|
||||
prepare stmt_show from "show tables like 't1'";
|
||||
prepare stmt_truncate from "truncate table t1";
|
||||
prepare stmt_drop from "drop table t1";
|
||||
# Drop the table that was used to prepare INSERT/UPDATE/DELETE: we will
|
||||
# create a new one by executing stmt_create
|
||||
drop table t1;
|
||||
# Switch the current database
|
||||
use test;
|
||||
# Check that all prepared statements operate on the database that was
|
||||
# active at PREPARE
|
||||
execute stmt_create;
|
||||
# should return empty set
|
||||
show tables like 't1';
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
show tables like 't1';
|
||||
use test;
|
||||
execute stmt_insert;
|
||||
select * from mysqltest_long_database_name_to_thrash_heap.t1;
|
||||
execute stmt_update;
|
||||
select * from mysqltest_long_database_name_to_thrash_heap.t1;
|
||||
execute stmt_delete;
|
||||
execute stmt_select;
|
||||
execute stmt_alter;
|
||||
show columns from mysqltest_long_database_name_to_thrash_heap.t1;
|
||||
execute stmt_alter1;
|
||||
show columns from mysqltest_long_database_name_to_thrash_heap.t1;
|
||||
execute stmt_analyze;
|
||||
execute stmt_optimize;
|
||||
execute stmt_show;
|
||||
execute stmt_truncate;
|
||||
execute stmt_drop;
|
||||
show tables like 't1';
|
||||
use mysqltest_long_database_name_to_thrash_heap;
|
||||
show tables like 't1';
|
||||
#
|
||||
# Attempt a statement PREPARE when there is no current database:
|
||||
# is expected to return an error.
|
||||
#
|
||||
drop database mysqltest_long_database_name_to_thrash_heap;
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_create from "create table t1 (i int)";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_insert from "insert into t1 (i) values (1)";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_update from "update t1 set i=2";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_delete from "delete from t1 where i=2";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_select from "select * from t1";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_alter from "alter table t1 add column (b int)";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_alter1 from "alter table t1 drop column b";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_analyze from "analyze table t1";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_optimize from "optimize table t1";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_show from "show tables like 't1'";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_truncate from "truncate table t1";
|
||||
--error ER_NO_DB_ERROR
|
||||
prepare stmt_drop from "drop table t1";
|
||||
#
|
||||
# The above has automatically deallocated all our statements.
|
||||
#
|
||||
# Attempt to CREATE a temporary table when no DB used: it should fail
|
||||
# This proves that no table can be used without explicit specification of
|
||||
# its database if there is no current database.
|
||||
#
|
||||
--error ER_NO_DB_ERROR
|
||||
create temporary table t1 (i int);
|
||||
#
|
||||
# Restore the old environemnt
|
||||
#
|
||||
use test;
|
||||
# End of 5.0 tests
|
||||
|
@ -5888,6 +5888,52 @@ DROP FUNCTION bug18037_f1|
|
||||
DROP PROCEDURE bug18037_p1|
|
||||
DROP PROCEDURE bug18037_p2|
|
||||
|
||||
#
|
||||
# Bug#17199: "Table not found" error occurs if the query contains a call
|
||||
# to a function from another database.
|
||||
# See also ps.test for an additional test case for this bug.
|
||||
#
|
||||
use test|
|
||||
create table t3 (i int)|
|
||||
insert into t3 values (1), (2)|
|
||||
create database mysqltest1|
|
||||
use mysqltest1|
|
||||
create function bug17199() returns varchar(2) deterministic return 'ok'|
|
||||
use test|
|
||||
select *, mysqltest1.bug17199() from t3|
|
||||
#
|
||||
# Bug#18444: Fully qualified stored function names don't work correctly
|
||||
# in select statements
|
||||
#
|
||||
use mysqltest1|
|
||||
create function bug18444(i int) returns int no sql deterministic return i + 1|
|
||||
use test|
|
||||
select mysqltest1.bug18444(i) from t3|
|
||||
drop database mysqltest1|
|
||||
#
|
||||
# Check that current database has no influence to a stored procedure
|
||||
#
|
||||
create database mysqltest1 charset=utf8|
|
||||
create database mysqltest2 charset=utf8|
|
||||
create procedure mysqltest1.p1()
|
||||
begin
|
||||
-- alters the default collation of database test
|
||||
alter database character set koi8r;
|
||||
end|
|
||||
use mysqltest1|
|
||||
call p1()|
|
||||
show create database mysqltest1|
|
||||
show create database mysqltest2|
|
||||
alter database mysqltest1 character set utf8|
|
||||
use mysqltest2|
|
||||
call mysqltest1.p1()|
|
||||
show create database mysqltest1|
|
||||
show create database mysqltest2|
|
||||
drop database mysqltest1|
|
||||
drop database mysqltest2|
|
||||
#
|
||||
# Restore the old environemnt
|
||||
use test|
|
||||
#
|
||||
# Bug#15217 "Using a SP cursor on a table created with PREPARE fails with
|
||||
# weird error". Check that the code that is supposed to work at
|
||||
|
Reference in New Issue
Block a user