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
4f498dec
Commit
4f498dec
authored
Mar 29, 2007
by
iggy@recycle.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge recycle.(none):/src/bug23491/my50-bug23491
into recycle.(none):/src/bug23491/my51-bug23491
parents
762eae0b
bbc38df0
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
11 deletions
+71
-11
mysql-test/r/information_schema.result
mysql-test/r/information_schema.result
+1
-1
mysql-test/r/mysqldump.result
mysql-test/r/mysqldump.result
+23
-0
mysql-test/r/sp-code.result
mysql-test/r/sp-code.result
+1
-1
mysql-test/r/udf.result
mysql-test/r/udf.result
+1
-1
mysql-test/t/mysqldump.test
mysql-test/t/mysqldump.test
+32
-0
sql/item_func.cc
sql/item_func.cc
+6
-3
sql/sp.cc
sql/sp.cc
+1
-1
sql/sp_head.h
sql/sp_head.h
+4
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
No files found.
mysql-test/r/information_schema.result
View file @
4f498dec
...
@@ -706,7 +706,7 @@ Warnings:
...
@@ -706,7 +706,7 @@ Warnings:
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
show create table v3;
show create table v3;
View Create View
View Create View
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `
test`.`
sub1`(1) AS `c`
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `sub1`(1) AS `c`
Warnings:
Warnings:
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v2;
drop view v2;
...
...
mysql-test/r/mysqldump.result
View file @
4f498dec
...
@@ -3217,6 +3217,29 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
...
@@ -3217,6 +3217,29 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
</mysqldump>
</mysqldump>
DROP TABLE t1;
DROP TABLE t1;
#
#
# Bug #23491: MySQLDump prefix function call in a view by database name
#
create database bug23491_original;
create database bug23491_restore;
use bug23491_original;
create table t1 (c1 int);
create view v1 as select * from t1;
create procedure p1() select 1;
create function f1() returns int return 1;
create view v2 as select f1();
create function f2() returns int return f1();
create view v3 as select bug23491_original.f1();
use bug23491_restore;
show create view bug23491_restore.v2;
View Create View
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `f1`() AS `f1()`
show create view bug23491_restore.v3;
View Create View
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()`
drop database bug23491_original;
drop database bug23491_restore;
use test;
#
# End of 5.0 tests
# End of 5.0 tests
#
#
drop table if exists t1;
drop table if exists t1;
...
...
mysql-test/r/sp-code.result
View file @
4f498dec
...
@@ -187,7 +187,7 @@ Pos Instruction
...
@@ -187,7 +187,7 @@ Pos Instruction
32 set v_dig@4 (v_dig@4 + 1)
32 set v_dig@4 (v_dig@4 + 1)
33 stmt 4 "update sudoku_work set dig = v_dig wh..."
33 stmt 4 "update sudoku_work set dig = v_dig wh..."
34 set v_tcounter@6 (v_tcounter@6 + 1)
34 set v_tcounter@6 (v_tcounter@6 + 1)
35 jump_if_not 37(37) (not(`
test`.`
sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
35 jump_if_not 37(37) (not(`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
36 jump 15
36 jump 15
37 set v_i@3 (v_i@3 + 1)
37 set v_i@3 (v_i@3 + 1)
38 jump 15
38 jump 15
...
...
mysql-test/r/udf.result
View file @
4f498dec
...
@@ -159,7 +159,7 @@ EXPLAIN EXTENDED SELECT myfunc_int(fn(MIN(b))) as c FROM t1 GROUP BY a;
...
@@ -159,7 +159,7 @@ EXPLAIN EXTENDED SELECT myfunc_int(fn(MIN(b))) as c FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
Warnings:
Warnings:
Note 1003 select myfunc_int(`
test`.`
fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a`
Note 1003 select myfunc_int(`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a`
EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a;
EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
...
...
mysql-test/t/mysqldump.test
View file @
4f498dec
...
@@ -1431,6 +1431,38 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
...
@@ -1431,6 +1431,38 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug #23491: MySQLDump prefix function call in a view by database name
--
echo
#
# Setup
create
database
bug23491_original
;
create
database
bug23491_restore
;
use
bug23491_original
;
create
table
t1
(
c1
int
);
create
view
v1
as
select
*
from
t1
;
create
procedure
p1
()
select
1
;
create
function
f1
()
returns
int
return
1
;
create
view
v2
as
select
f1
();
create
function
f2
()
returns
int
return
f1
();
create
view
v3
as
select
bug23491_original
.
f1
();
# Backup.
--
exec
$MYSQL_DUMP
--
skip
-
comments
-
uroot
--
opt
--
routines
bug23491_original
>
$MYSQLTEST_VARDIR
/
tmp
/
bug23491_backup
.
sql
;
# Restore.
--
exec
$MYSQL
bug23491_restore
<
$MYSQLTEST_VARDIR
/
tmp
/
bug23491_backup
.
sql
;
# Verify
use
bug23491_restore
;
show
create
view
bug23491_restore
.
v2
;
show
create
view
bug23491_restore
.
v3
;
# Cleanup
drop
database
bug23491_original
;
drop
database
bug23491_restore
;
use
test
;
--
echo
#
--
echo
#
--
echo
# End of 5.0 tests
--
echo
# End of 5.0 tests
--
echo
#
--
echo
#
...
...
sql/item_func.cc
View file @
4f498dec
...
@@ -5029,7 +5029,7 @@ Item_func_sp::func_name() const
...
@@ -5029,7 +5029,7 @@ Item_func_sp::func_name() const
{
{
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
/* Calculate length to avoid reallocation of string for sure */
/* Calculate length to avoid reallocation of string for sure */
uint
len
=
((
m_name
->
m_
db
.
length
+
uint
len
=
((
m_name
->
m_
explicit_name
?
m_name
->
m_db
.
length
:
0
+
m_name
->
m_name
.
length
)
*
2
+
//characters*quoting
m_name
->
m_name
.
length
)
*
2
+
//characters*quoting
2
+
// ` and `
2
+
// ` and `
1
+
// .
1
+
// .
...
@@ -5039,8 +5039,11 @@ Item_func_sp::func_name() const
...
@@ -5039,8 +5039,11 @@ Item_func_sp::func_name() const
system_charset_info
);
system_charset_info
);
qname
.
length
(
0
);
qname
.
length
(
0
);
if
(
m_name
->
m_explicit_name
)
{
append_identifier
(
thd
,
&
qname
,
m_name
->
m_db
.
str
,
m_name
->
m_db
.
length
);
append_identifier
(
thd
,
&
qname
,
m_name
->
m_db
.
str
,
m_name
->
m_db
.
length
);
qname
.
append
(
'.'
);
qname
.
append
(
'.'
);
}
append_identifier
(
thd
,
&
qname
,
m_name
->
m_name
.
str
,
m_name
->
m_name
.
length
);
append_identifier
(
thd
,
&
qname
,
m_name
->
m_name
.
str
,
m_name
->
m_name
.
length
);
return
qname
.
ptr
();
return
qname
.
ptr
();
}
}
...
...
sql/sp.cc
View file @
4f498dec
...
@@ -1091,7 +1091,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error)
...
@@ -1091,7 +1091,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error)
lex_name
.
length
=
strlen
(
routine
->
table_name
);
lex_name
.
length
=
strlen
(
routine
->
table_name
);
lex_db
.
str
=
thd
->
strmake
(
routine
->
db
,
lex_db
.
length
);
lex_db
.
str
=
thd
->
strmake
(
routine
->
db
,
lex_db
.
length
);
lex_name
.
str
=
thd
->
strmake
(
routine
->
table_name
,
lex_name
.
length
);
lex_name
.
str
=
thd
->
strmake
(
routine
->
table_name
,
lex_name
.
length
);
name
=
new
sp_name
(
lex_db
,
lex_name
);
name
=
new
sp_name
(
lex_db
,
lex_name
,
true
);
name
->
init_qname
(
thd
);
name
->
init_qname
(
thd
);
sp_object_found
=
sp_find_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
name
,
sp_object_found
=
sp_find_routine
(
thd
,
TYPE_ENUM_PROCEDURE
,
name
,
&
thd
->
sp_proc_cache
,
FALSE
)
!=
NULL
||
&
thd
->
sp_proc_cache
,
FALSE
)
!=
NULL
||
...
...
sql/sp_head.h
View file @
4f498dec
...
@@ -59,9 +59,10 @@ public:
...
@@ -59,9 +59,10 @@ public:
calling set_routine_type().
calling set_routine_type().
*/
*/
LEX_STRING
m_sroutines_key
;
LEX_STRING
m_sroutines_key
;
bool
m_explicit_name
;
/**< Prepend the db name? */
sp_name
(
LEX_STRING
db
,
LEX_STRING
name
)
sp_name
(
LEX_STRING
db
,
LEX_STRING
name
,
bool
use_explicit_name
)
:
m_db
(
db
),
m_name
(
name
)
:
m_db
(
db
),
m_name
(
name
)
,
m_explicit_name
(
use_explicit_name
)
{
{
m_qname
.
str
=
m_sroutines_key
.
str
=
0
;
m_qname
.
str
=
m_sroutines_key
.
str
=
0
;
m_qname
.
length
=
m_sroutines_key
.
length
=
0
;
m_qname
.
length
=
m_sroutines_key
.
length
=
0
;
...
@@ -79,6 +80,7 @@ public:
...
@@ -79,6 +80,7 @@ public:
m_name
.
length
=
m_qname
.
length
=
key_len
-
1
;
m_name
.
length
=
m_qname
.
length
=
key_len
-
1
;
m_db
.
str
=
0
;
m_db
.
str
=
0
;
m_db
.
length
=
0
;
m_db
.
length
=
0
;
m_explicit_name
=
false
;
}
}
// Init. the qualified name from the db and name.
// Init. the qualified name from the db and name.
...
...
sql/sql_yacc.yy
View file @
4f498dec
...
@@ -1925,7 +1925,7 @@ sp_name:
...
@@ -1925,7 +1925,7 @@ sp_name:
my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
MYSQL_YYABORT;
MYSQL_YYABORT;
}
}
$$= new sp_name($1, $3);
$$= new sp_name($1, $3
, true
);
$$->init_qname(YYTHD);
$$->init_qname(YYTHD);
}
}
| ident
| ident
...
@@ -1939,7 +1939,7 @@ sp_name:
...
@@ -1939,7 +1939,7 @@ sp_name:
}
}
if (thd->copy_db_to(&db.str, &db.length))
if (thd->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
MYSQL_YYABORT;
$$= new sp_name(db, $1);
$$= new sp_name(db, $1
, false
);
if ($$)
if ($$)
$$->init_qname(YYTHD);
$$->init_qname(YYTHD);
}
}
...
...
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