Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
be9ccb35
Commit
be9ccb35
authored
Aug 18, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0
into rurik.mysql.com:/home/igor/mysql-5.0
parents
749f599e
6ea6df4e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
5 deletions
+26
-5
mysql-test/r/view.result
mysql-test/r/view.result
+7
-1
mysql-test/t/view.test
mysql-test/t/view.test
+13
-0
sql/share/errmsg.txt
sql/share/errmsg.txt
+1
-1
sql/sql_view.cc
sql/sql_view.cc
+5
-3
No files found.
mysql-test/r/view.result
View file @
be9ccb35
...
@@ -6,7 +6,7 @@ create view v1 (c,d) as select a,b from t1;
...
@@ -6,7 +6,7 @@ create view v1 (c,d) as select a,b from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
ERROR 42S02: Table 'test.t1' doesn't exist
create temporary table t1 (a int, b int);
create temporary table t1 (a int, b int);
create view v1 (c) as select b+1 from t1;
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;
drop table t1;
create table t1 (a int, b int);
create table t1 (a int, b int);
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
...
@@ -2097,3 +2097,9 @@ select * from v1;
...
@@ -2097,3 +2097,9 @@ select * from v1;
f1
f1
1
1
drop view v1;
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;
mysql-test/t/view.test
View file @
be9ccb35
...
@@ -1942,3 +1942,16 @@ DROP TABLE t1,t2,t3,t4,t5;
...
@@ -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
;
create
view
v1
as
select
timestampdiff
(
day
,
'1997-01-01 00:00:00'
,
'1997-01-02 00:00:00'
)
as
f1
;
select
*
from
v1
;
select
*
from
v1
;
drop
view
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
;
sql/share/errmsg.txt
View file @
be9ccb35
...
@@ -5194,7 +5194,7 @@ ER_VIEW_SELECT_VARIABLE
...
@@ -5194,7 +5194,7 @@ ER_VIEW_SELECT_VARIABLE
rus "View SELECT "
rus "View SELECT "
ukr "View SELECT "
ukr "View SELECT "
ER_VIEW_SELECT_TMPTABLE
ER_VIEW_SELECT_TMPTABLE
eng "View's SELECT
contains
a temporary table '%-.64s'"
eng "View's SELECT
refers to
a temporary table '%-.64s'"
rus "View SELECT '%-.64s'"
rus "View SELECT '%-.64s'"
ukr "View SELECT դ '%-.64s'"
ukr "View SELECT դ '%-.64s'"
ER_VIEW_WRONG_LIST
ER_VIEW_WRONG_LIST
...
...
sql/sql_view.cc
View file @
be9ccb35
...
@@ -306,9 +306,11 @@ bool mysql_create_view(THD *thd,
...
@@ -306,9 +306,11 @@ bool mysql_create_view(THD *thd,
/*
/*
check that tables are not temporary and this VIEW do not used in query
check that tables are not temporary and this VIEW do not used in query
(it is possible with ALTERing VIEW)
(it is possible with ALTERing VIEW).
*/
open_and_lock_tables can change the value of tables,
for
(
tbl
=
tables
;
tbl
;
tbl
=
tbl
->
next_global
)
e.g. it may happen if before the function call tables was equal to 0.
*/
for
(
tbl
=
tables
=
lex
->
query_tables
;
tbl
;
tbl
=
tbl
->
next_global
)
{
{
/* is this table temporary and is not view? */
/* is this table temporary and is not view? */
if
(
tbl
->
table
->
s
->
tmp_table
!=
NO_TMP_TABLE
&&
!
tbl
->
view
&&
if
(
tbl
->
table
->
s
->
tmp_table
!=
NO_TMP_TABLE
&&
!
tbl
->
view
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment