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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2c666b32
Commit
2c666b32
authored
Dec 01, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/work-bug3-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-merge1-5.0
parents
513d0550
2ff98e05
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
13 deletions
+58
-13
mysql-test/r/view.result
mysql-test/r/view.result
+15
-0
mysql-test/t/view.test
mysql-test/t/view.test
+21
-0
sql/sql_view.cc
sql/sql_view.cc
+22
-13
No files found.
mysql-test/r/view.result
View file @
2c666b32
...
@@ -2424,3 +2424,18 @@ f1 sum(f2)
...
@@ -2424,3 +2424,18 @@ f1 sum(f2)
NULL 12
NULL 12
drop view v1;
drop view v1;
drop table t1;
drop table t1;
CREATE VIEW v1 AS SELECT 42 AS Meaning;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INTEGER
BEGIN
DECLARE retn INTEGER;
SELECT Meaning FROM v1 INTO retn;
RETURN retn;
END
//
CREATE VIEW v2 AS SELECT f1();
select * from v2;
f1()
42
drop view v2,v1;
drop function f1;
mysql-test/t/view.test
View file @
2c666b32
...
@@ -2280,3 +2280,24 @@ create view v1 as select * from t1;
...
@@ -2280,3 +2280,24 @@ create view v1 as select * from t1;
select
f1
,
sum
(
f2
)
from
v1
group
by
f1
;
select
f1
,
sum
(
f2
)
from
v1
group
by
f1
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
# BUG#15096: using function with view for view creation
#
CREATE
VIEW
v1
AS
SELECT
42
AS
Meaning
;
--
disable_warnings
DROP
FUNCTION
IF
EXISTS
f1
;
--
enable_warnings
DELIMITER
//;
CREATE
FUNCTION
f1
()
RETURNS
INTEGER
BEGIN
DECLARE
retn
INTEGER
;
SELECT
Meaning
FROM
v1
INTO
retn
;
RETURN
retn
;
END
//
DELIMITER
;
//
CREATE
VIEW
v2
AS
SELECT
f1
();
select
*
from
v2
;
drop
view
v2
,
v1
;
drop
function
f1
;
sql/sql_view.cc
View file @
2c666b32
...
@@ -350,15 +350,6 @@ bool mysql_create_view(THD *thd,
...
@@ -350,15 +350,6 @@ bool mysql_create_view(THD *thd,
*/
*/
for
(
tbl
=
lex
->
query_tables
;
tbl
;
tbl
=
tbl
->
next_global
)
for
(
tbl
=
lex
->
query_tables
;
tbl
;
tbl
=
tbl
->
next_global
)
{
{
/* is this table temporary and is not view? */
if
(
tbl
->
table
->
s
->
tmp_table
!=
NO_TMP_TABLE
&&
!
tbl
->
view
&&
!
tbl
->
schema_table
)
{
my_error
(
ER_VIEW_SELECT_TMPTABLE
,
MYF
(
0
),
tbl
->
alias
);
res
=
TRUE
;
goto
err
;
}
/* is this table view and the same view which we creates now? */
/* is this table view and the same view which we creates now? */
if
(
tbl
->
view
&&
if
(
tbl
->
view
&&
strcmp
(
tbl
->
view_db
.
str
,
view
->
db
)
==
0
&&
strcmp
(
tbl
->
view_db
.
str
,
view
->
db
)
==
0
&&
...
@@ -369,6 +360,23 @@ bool mysql_create_view(THD *thd,
...
@@ -369,6 +360,23 @@ bool mysql_create_view(THD *thd,
goto
err
;
goto
err
;
}
}
/*
tbl->table can be NULL when tbl is a placeholder for a view
that is indirectly referenced via a stored function from the
view being created. We don't check these indirectly
referenced views in CREATE VIEW so they don't have table
object.
*/
if
(
tbl
->
table
)
{
/* is this table temporary and is not view? */
if
(
tbl
->
table
->
s
->
tmp_table
!=
NO_TMP_TABLE
&&
!
tbl
->
view
&&
!
tbl
->
schema_table
)
{
my_error
(
ER_VIEW_SELECT_TMPTABLE
,
MYF
(
0
),
tbl
->
alias
);
res
=
TRUE
;
goto
err
;
}
/*
/*
Copy the privileges of the underlying VIEWs which were filled by
Copy the privileges of the underlying VIEWs which were filled by
fill_effective_table_privileges
fill_effective_table_privileges
...
@@ -376,6 +384,7 @@ bool mysql_create_view(THD *thd,
...
@@ -376,6 +384,7 @@ bool mysql_create_view(THD *thd,
*/
*/
tbl
->
table
->
grant
.
privilege
=
tbl
->
grant
.
privilege
;
tbl
->
table
->
grant
.
privilege
=
tbl
->
grant
.
privilege
;
}
}
}
/* prepare select to resolve all fields */
/* prepare select to resolve all fields */
lex
->
view_prepare_mode
=
1
;
lex
->
view_prepare_mode
=
1
;
...
...
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