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
4732821e
Commit
4732821e
authored
Sep 06, 2007
by
gshchepa/uchum@gleb.loc
Browse files
Options
Browse Files
Download
Plain Diff
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt
parents
582b6968
b1cc84ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
1 deletion
+72
-1
.bzrignore
.bzrignore
+3
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+22
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+33
-0
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_view.cc
sql/sql_view.cc
+13
-0
No files found.
.bzrignore
View file @
4732821e
...
...
@@ -476,6 +476,9 @@ contrib/*.vcproj
core
core.*
core.2430
cscope.in.out
cscope.out
cscope.po.out
db-*.*.*
dbug/*.ds?
dbug/*.vcproj
...
...
mysql-test/r/sp.result
View file @
4732821e
...
...
@@ -6546,4 +6546,26 @@ DROP VIEW v1;
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP TABLE t1;
create function f1()
returns int(11)
not deterministic
contains sql
sql security definer
comment ''
begin
declare x int(11);
set x=-1;
return x;
end|
create view v1 as select 1 as one, f1() as days;
show create view test.v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select 1 AS `one`,`f1`() AS `days`
select column_name from information_schema.columns
where table_name='v1' and table_schema='test';
column_name
one
days
drop view v1;
drop function f1;
End of 5.0 tests
mysql-test/t/sp.test
View file @
4732821e
...
...
@@ -7494,4 +7494,37 @@ DROP FUNCTION f1;
DROP
FUNCTION
f2
;
DROP
TABLE
t1
;
#
# Bug#29408 Cannot find view in columns table if the selection contains a function
#
delimiter
|
;
create
function
f1
()
returns
int
(
11
)
not
deterministic
contains
sql
sql
security
definer
comment
''
begin
declare
x
int
(
11
);
set
x
=-
1
;
return
x
;
end
|
delimiter
;
|
create
view
v1
as
select
1
as
one
,
f1
()
as
days
;
connect
(
bug29408
,
localhost
,
root
,,
*
NO
-
ONE
*
);
connection
bug29408
;
show
create
view
test
.
v1
;
select
column_name
from
information_schema
.
columns
where
table_name
=
'v1'
and
table_schema
=
'test'
;
connection
default
;
disconnect
bug29408
;
drop
view
v1
;
drop
function
f1
;
--
echo
End
of
5.0
tests
sql/sql_parse.cc
View file @
4732821e
...
...
@@ -1010,7 +1010,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SHOW_FIELDS
]);
bzero
((
char
*
)
&
table_list
,
sizeof
(
table_list
));
if
(
thd
->
copy_db_to
(
&
table_list
.
db
,
&
dummy
))
if
(
thd
->
copy_db_to
(
&
table_list
.
db
,
&
table_list
.
db_length
))
break
;
/*
We have name + wildcard in packet, separated by endzero
...
...
sql/sql_view.cc
View file @
4732821e
...
...
@@ -1044,10 +1044,20 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
table
->
view
=
lex
=
thd
->
lex
=
(
LEX
*
)
new
(
thd
->
mem_root
)
st_lex_local
;
{
char
old_db_buf
[
NAME_LEN
+
1
];
LEX_STRING
old_db
=
{
old_db_buf
,
sizeof
(
old_db_buf
)
};
bool
dbchanged
;
Lex_input_stream
lip
(
thd
,
table
->
select_stmt
.
str
,
table
->
select_stmt
.
length
);
/*
Use view db name as thread default database, in order to ensure
that the view is parsed and prepared correctly.
*/
if
((
result
=
sp_use_new_db
(
thd
,
table
->
view_db
,
&
old_db
,
1
,
&
dbchanged
)))
goto
end
;
lex_start
(
thd
);
view_select
=
&
lex
->
select_lex
;
view_select
->
select_number
=
++
thd
->
select_number
;
...
...
@@ -1091,6 +1101,9 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
lex
->
sql_command
=
old_lex
->
sql_command
;
thd
->
variables
.
sql_mode
=
saved_mode
;
if
(
dbchanged
&&
mysql_change_db
(
thd
,
&
old_db
,
TRUE
))
goto
err
;
}
if
(
!
parse_status
)
{
...
...
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