Commit 198b97a6 authored by kostja@bodhi.(none)'s avatar kostja@bodhi.(none)

Add a test case for Bug#22427 create table if not exists + stored

function results in inconsistent behavior.

The bug itself was fixed by the patch for bug 20662.
parent 9bac763c
...@@ -267,4 +267,26 @@ drop table bug_27907_logs; ...@@ -267,4 +267,26 @@ drop table bug_27907_logs;
insert into bug_27907_t1(a) values (1); insert into bug_27907_t1(a) values (1);
ERROR 42S02: Table 'test.bug_27907_logs' doesn't exist ERROR 42S02: Table 'test.bug_27907_logs' doesn't exist
drop table bug_27907_t1; drop table bug_27907_t1;
Bug#22427 create table if not exists + stored function results in
inconsistent behavior
Add a test case, the bug itself was fixed by the patch for
Bug#20662
drop table if exists t1;
drop function if exists f_bug22427;
create table t1 (i int);
insert into t1 values (1);
create function f_bug22427() returns int return (select max(i) from t1);
select f_bug22427();
f_bug22427()
1
create table if not exists t1 select f_bug22427() as i;
Warnings:
Note 1050 Table 't1' already exists
create table t1 select f_bug22427() as i;
ERROR 42S01: Table 't1' already exists
drop table t1;
drop function f_bug22427;
End of 5.0 tests End of 5.0 tests
...@@ -333,4 +333,27 @@ insert into bug_27907_t1(a) values (1); ...@@ -333,4 +333,27 @@ insert into bug_27907_t1(a) values (1);
drop table bug_27907_t1; drop table bug_27907_t1;
--echo
--echo Bug#22427 create table if not exists + stored function results in
--echo inconsistent behavior
--echo
--echo Add a test case, the bug itself was fixed by the patch for
--echo Bug#20662
--echo
--disable_warnings
drop table if exists t1;
drop function if exists f_bug22427;
--enable_warnings
create table t1 (i int);
insert into t1 values (1);
create function f_bug22427() returns int return (select max(i) from t1);
select f_bug22427();
# Until this bug was fixed, the following emitted error
# ERROR 1213: Deadlock found when trying to get lock
create table if not exists t1 select f_bug22427() as i;
--error ER_TABLE_EXISTS_ERROR
create table t1 select f_bug22427() as i;
drop table t1;
drop function f_bug22427;
--echo End of 5.0 tests --echo End of 5.0 tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment