mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
view.test:
Added a test case for bug #10970. view.result: Added a test case for bug #10970. Modified the error messages for error ER_VIEW_SELECT_TMPTABLE. sql_view.cc: Fixed bug #10970. In the function mysql_create_view if a view does not refer any tables directly the variable table must be updated after the call of open_and_lock_tables. errmsg.txt: Modified the error messages for error ER_VIEW_SELECT_TMPTABLE (when fixing bug #10970). sql/share/errmsg.txt: Modified the error messages for error ER_VIEW_SELECT_TMPTABLE (when fixing bug #10970). sql/sql_view.cc: Fixed bug #10970. In the function mysql_create_view if a view does not refer any tables directly the variable table must be updated after the call of open_and_lock_tables. mysql-test/r/view.result: Fixed bug #10970. Modified the error messages for error ER_VIEW_SELECT_TMPTABLE. mysql-test/t/view.test: Added a test case for bug #10970.
This commit is contained in:
@ -6,7 +6,7 @@ create view v1 (c,d) as select a,b from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
create temporary table t1 (a int, b int);
|
||||
create view v1 (c) as select b+1 from t1;
|
||||
ERROR HY000: View's SELECT contains a temporary table 't1'
|
||||
ERROR HY000: View's SELECT refers to a temporary table 't1'
|
||||
drop table t1;
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
|
||||
@ -2097,3 +2097,9 @@ select * from v1;
|
||||
f1
|
||||
1
|
||||
drop view v1;
|
||||
CREATE TEMPORARY TABLE t1 (a int);
|
||||
CREATE FUNCTION f1 () RETURNS int RETURN (SELECT COUNT(*) FROM t1);
|
||||
CREATE VIEW v1 AS SELECT f1();
|
||||
ERROR HY000: View's SELECT refers to a temporary table 't1'
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
|
@ -1942,3 +1942,16 @@ DROP TABLE t1,t2,t3,t4,t5;
|
||||
create view v1 as select timestampdiff(day,'1997-01-01 00:00:00','1997-01-02 00:00:00') as f1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# Test for bug #10970: view referring a temporary table indirectly
|
||||
#
|
||||
|
||||
CREATE TEMPORARY TABLE t1 (a int);
|
||||
CREATE FUNCTION f1 () RETURNS int RETURN (SELECT COUNT(*) FROM t1);
|
||||
-- error 1352
|
||||
CREATE VIEW v1 AS SELECT f1();
|
||||
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
Reference in New Issue
Block a user