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
e96932f4
Commit
e96932f4
authored
Feb 23, 2010
by
Marc Alff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#31767 DROP FUNCTION name resolution
Backport to 5.5.99
parent
1dd2f90f
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
175 additions
and
47 deletions
+175
-47
mysql-test/r/errors.result
mysql-test/r/errors.result
+2
-2
mysql-test/r/grant.result
mysql-test/r/grant.result
+1
-1
mysql-test/r/signal.result
mysql-test/r/signal.result
+1
-1
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+2
-2
mysql-test/r/sp-vars.result
mysql-test/r/sp-vars.result
+2
-2
mysql-test/r/sp.result
mysql-test/r/sp.result
+2
-2
mysql-test/r/sp_notembedded.result
mysql-test/r/sp_notembedded.result
+2
-2
mysql-test/r/strict.result
mysql-test/r/strict.result
+1
-1
mysql-test/r/udf.result
mysql-test/r/udf.result
+46
-0
mysql-test/r/view.result
mysql-test/r/view.result
+1
-1
mysql-test/r/warnings.result
mysql-test/r/warnings.result
+3
-3
mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result
...test/suite/sys_vars/r/max_prepared_stmt_count_func.result
+1
-1
mysql-test/t/udf.test
mysql-test/t/udf.test
+69
-0
sql/sql_parse.cc
sql/sql_parse.cc
+42
-29
No files found.
mysql-test/r/errors.result
View file @
e96932f4
...
@@ -61,10 +61,10 @@ create table t1 (a int unique);
...
@@ -61,10 +61,10 @@ create table t1 (a int unique);
create table t2 (a int);
create table t2 (a int);
drop function if exists f1;
drop function if exists f1;
Warnings:
Warnings:
Note 1305 FUNCTION f1 does not exist
Note 1305 FUNCTION
test.
f1 does not exist
drop function if exists f2;
drop function if exists f2;
Warnings:
Warnings:
Note 1305 FUNCTION f2 does not exist
Note 1305 FUNCTION
test.
f2 does not exist
create function f1() returns int
create function f1() returns int
begin
begin
insert into t1 (a) values (1);
insert into t1 (a) values (1);
...
...
mysql-test/r/grant.result
View file @
e96932f4
...
@@ -1231,7 +1231,7 @@ Warnings:
...
@@ -1231,7 +1231,7 @@ Warnings:
Note 1051 Unknown table 'test'
Note 1051 Unknown table 'test'
drop function if exists test_function;
drop function if exists test_function;
Warnings:
Warnings:
Note 1305 FUNCTION test_function does not exist
Note 1305 FUNCTION test
.test
_function does not exist
drop view if exists v1;
drop view if exists v1;
Warnings:
Warnings:
Note 1051 Unknown table 'test.v1'
Note 1051 Unknown table 'test.v1'
...
...
mysql-test/r/signal.result
View file @
e96932f4
...
@@ -2181,7 +2181,7 @@ drop procedure peter_p1 $$
...
@@ -2181,7 +2181,7 @@ drop procedure peter_p1 $$
drop procedure peter_p2 $$
drop procedure peter_p2 $$
drop procedure if exists peter_p3 $$
drop procedure if exists peter_p3 $$
Warnings:
Warnings:
Note 1305 PROCEDURE peter_p3 does not exist
Note 1305 PROCEDURE
test.
peter_p3 does not exist
create procedure peter_p3()
create procedure peter_p3()
begin
begin
declare continue handler for sqlexception
declare continue handler for sqlexception
...
...
mysql-test/r/sp-error.result
View file @
e96932f4
...
@@ -46,7 +46,7 @@ call foo()|
...
@@ -46,7 +46,7 @@ call foo()|
ERROR 42000: PROCEDURE test.foo does not exist
ERROR 42000: PROCEDURE test.foo does not exist
drop procedure if exists foo|
drop procedure if exists foo|
Warnings:
Warnings:
Note 1305 PROCEDURE foo does not exist
Note 1305 PROCEDURE
test.
foo does not exist
show create procedure foo|
show create procedure foo|
ERROR 42000: PROCEDURE foo does not exist
ERROR 42000: PROCEDURE foo does not exist
show create function foo|
show create function foo|
...
@@ -1028,7 +1028,7 @@ drop table t1|
...
@@ -1028,7 +1028,7 @@ drop table t1|
drop function bug_13627_f|
drop function bug_13627_f|
drop function if exists bug12329;
drop function if exists bug12329;
Warnings:
Warnings:
Note 1305 FUNCTION bug12329 does not exist
Note 1305 FUNCTION
test.
bug12329 does not exist
create table t1 as select 1 a;
create table t1 as select 1 a;
create table t2 as select 1 a;
create table t2 as select 1 a;
create function bug12329() returns int return (select a from t1);
create function bug12329() returns int return (select a from t1);
...
...
mysql-test/r/sp-vars.result
View file @
e96932f4
...
@@ -394,10 +394,10 @@ CASE expression tests.
...
@@ -394,10 +394,10 @@ CASE expression tests.
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p1;
Warnings:
Warnings:
Note 1305 PROCEDURE p1 does not exist
Note 1305 PROCEDURE
test.
p1 does not exist
DROP PROCEDURE IF EXISTS p2;
DROP PROCEDURE IF EXISTS p2;
Warnings:
Warnings:
Note 1305 PROCEDURE p2 does not exist
Note 1305 PROCEDURE
test.
p2 does not exist
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
Warnings:
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't1'
...
...
mysql-test/r/sp.result
View file @
e96932f4
...
@@ -2695,10 +2695,10 @@ delete from t3|
...
@@ -2695,10 +2695,10 @@ delete from t3|
insert into t3 values(1)|
insert into t3 values(1)|
drop procedure if exists bug7992_1|
drop procedure if exists bug7992_1|
Warnings:
Warnings:
Note 1305 PROCEDURE bug7992_1 does not exist
Note 1305 PROCEDURE
test.
bug7992_1 does not exist
drop procedure if exists bug7992_2|
drop procedure if exists bug7992_2|
Warnings:
Warnings:
Note 1305 PROCEDURE bug7992_2 does not exist
Note 1305 PROCEDURE
test.
bug7992_2 does not exist
create procedure bug7992_1()
create procedure bug7992_1()
begin
begin
declare i int;
declare i int;
...
...
mysql-test/r/sp_notembedded.result
View file @
e96932f4
...
@@ -21,11 +21,11 @@ end|
...
@@ -21,11 +21,11 @@ end|
call bug4902_2()|
call bug4902_2()|
show warnings|
show warnings|
Level Code Message
Level Code Message
Note 1305 PROCEDURE bug4902_2 does not exist
Note 1305 PROCEDURE
test.
bug4902_2 does not exist
call bug4902_2()|
call bug4902_2()|
show warnings|
show warnings|
Level Code Message
Level Code Message
Note 1305 PROCEDURE bug4902_2 does not exist
Note 1305 PROCEDURE
test.
bug4902_2 does not exist
drop procedure bug4902_2|
drop procedure bug4902_2|
drop table if exists t1|
drop table if exists t1|
create table t1 (
create table t1 (
...
...
mysql-test/r/strict.result
View file @
e96932f4
...
@@ -1183,7 +1183,7 @@ drop table t1;
...
@@ -1183,7 +1183,7 @@ drop table t1;
create table t1 (col1 tinyint);
create table t1 (col1 tinyint);
drop procedure if exists t1;
drop procedure if exists t1;
Warnings:
Warnings:
Note 1305 PROCEDURE t1 does not exist
Note 1305 PROCEDURE t
est.t
1 does not exist
create procedure t1 () begin declare exit handler for sqlexception
create procedure t1 () begin declare exit handler for sqlexception
select'a'; insert into t1 values (200); end;|
select'a'; insert into t1 values (200); end;|
call t1();
call t1();
...
...
mysql-test/r/udf.result
View file @
e96932f4
...
@@ -392,6 +392,52 @@ a
...
@@ -392,6 +392,52 @@ a
4
4
DROP FUNCTION sequence;
DROP FUNCTION sequence;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
drop function if exists test.metaphon;
drop function if exists metaphon;
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
select metaphon("Hello");
metaphon("Hello")
HL
drop function if exists test.metaphon;
Warnings:
Note 1305 FUNCTION test.metaphon does not exist
select metaphon("Hello");
metaphon("Hello")
HL
drop function metaphon;
CREATE FUNCTION test.metaphon(a TEXT) RETURNS TEXT return "This is a SF";
create database db_31767;
use db_31767;
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
use test;
select metaphon("Hello");
metaphon("Hello")
HL
select test.metaphon("Hello");
test.metaphon("Hello")
This is a SF
drop function metaphon;
select metaphon("Hello");
metaphon("Hello")
This is a SF
drop function metaphon;
use db_31767;
drop database db_31767;
drop function if exists no_such_func;
Warnings:
Note 1305 FUNCTION (UDF) no_such_func does not exist
drop function no_such_func;
ERROR 42000: FUNCTION (UDF) no_such_func does not exist
drop function if exists test.no_such_func;
Warnings:
Note 1305 FUNCTION test.no_such_func does not exist
drop function test.no_such_func;
ERROR 42000: FUNCTION test.no_such_func does not exist
drop procedure if exists no_such_proc;
ERROR 3D000: No database selected
drop procedure no_such_proc;
ERROR 3D000: No database selected
use test;
#
#
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
#
#
...
...
mysql-test/r/view.result
View file @
e96932f4
...
@@ -2086,7 +2086,7 @@ CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL);
...
@@ -2086,7 +2086,7 @@ CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL);
CREATE OR REPLACE VIEW v1 AS SELECT * from t1;
CREATE OR REPLACE VIEW v1 AS SELECT * from t1;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p1;
Warnings:
Warnings:
Note 1305 PROCEDURE p1 does not exist
Note 1305 PROCEDURE
test.
p1 does not exist
CREATE PROCEDURE p1 ( )
CREATE PROCEDURE p1 ( )
BEGIN
BEGIN
DO (SELECT @next := IFNULL(max(bug_table_seq),0) + 1 FROM v1);
DO (SELECT @next := IFNULL(max(bug_table_seq),0) + 1 FROM v1);
...
...
mysql-test/r/warnings.result
View file @
e96932f4
...
@@ -228,13 +228,13 @@ INSERT INTO t2 VALUES ( 'a`', 'a`' );
...
@@ -228,13 +228,13 @@ INSERT INTO t2 VALUES ( 'a`', 'a`' );
INSERT INTO t3 VALUES ( 'a`', 'a`', '1000-01-1' );
INSERT INTO t3 VALUES ( 'a`', 'a`', '1000-01-1' );
DROP PROCEDURE IF EXISTS sp1;
DROP PROCEDURE IF EXISTS sp1;
Warnings:
Warnings:
Note 1305 PROCEDURE sp1 does not exist
Note 1305 PROCEDURE
test.
sp1 does not exist
DROP PROCEDURE IF EXISTS sp2;
DROP PROCEDURE IF EXISTS sp2;
Warnings:
Warnings:
Note 1305 PROCEDURE sp2 does not exist
Note 1305 PROCEDURE
test.
sp2 does not exist
DROP PROCEDURE IF EXISTS sp3;
DROP PROCEDURE IF EXISTS sp3;
Warnings:
Warnings:
Note 1305 PROCEDURE sp3 does not exist
Note 1305 PROCEDURE
test.
sp3 does not exist
CREATE PROCEDURE sp1()
CREATE PROCEDURE sp1()
BEGIN
BEGIN
DECLARE x NUMERIC ZEROFILL;
DECLARE x NUMERIC ZEROFILL;
...
...
mysql-test/suite/sys_vars/r/max_prepared_stmt_count_func.result
View file @
e96932f4
...
@@ -66,7 +66,7 @@ SET GLOBAL max_prepared_stmt_count=3;
...
@@ -66,7 +66,7 @@ SET GLOBAL max_prepared_stmt_count=3;
** Creating procedure **
** Creating procedure **
DROP PROCEDURE IF EXISTS sp_checkstmts;
DROP PROCEDURE IF EXISTS sp_checkstmts;
Warnings:
Warnings:
Note 1305 PROCEDURE sp_checkstmts does not exist
Note 1305 PROCEDURE
test.
sp_checkstmts does not exist
CREATE PROCEDURE sp_checkstmts ()
CREATE PROCEDURE sp_checkstmts ()
BEGIN
BEGIN
PREPARE newstmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
PREPARE newstmt from "SELECT * FROM information_schema.CHARACTER_SETS C";
...
...
mysql-test/t/udf.test
View file @
e96932f4
...
@@ -436,6 +436,75 @@ SELECT * FROM t2 WHERE a = sequence();
...
@@ -436,6 +436,75 @@ SELECT * FROM t2 WHERE a = sequence();
DROP
FUNCTION
sequence
;
DROP
FUNCTION
sequence
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug#31767 (DROP FUNCTION name resolution)
#
--
disable_warnings
drop
function
if
exists
test
.
metaphon
;
drop
function
if
exists
metaphon
;
--
enable_warnings
--
replace_result
$UDF_EXAMPLE_LIB
UDF_EXAMPLE_LIB
eval
CREATE
FUNCTION
metaphon
RETURNS
STRING
SONAME
"
$UDF_EXAMPLE_LIB
"
;
select
metaphon
(
"Hello"
);
# The UDF should not be dropped
drop
function
if
exists
test
.
metaphon
;
select
metaphon
(
"Hello"
);
drop
function
metaphon
;
CREATE
FUNCTION
test
.
metaphon
(
a
TEXT
)
RETURNS
TEXT
return
"This is a SF"
;
create
database
db_31767
;
use
db_31767
;
--
replace_result
$UDF_EXAMPLE_LIB
UDF_EXAMPLE_LIB
eval
CREATE
FUNCTION
metaphon
RETURNS
STRING
SONAME
"
$UDF_EXAMPLE_LIB
"
;
use
test
;
# Uses the UDF
select
metaphon
(
"Hello"
);
# Uses the SF
select
test
.
metaphon
(
"Hello"
);
# Should drop the UDF, resolving the name the same way select does.
drop
function
metaphon
;
# Should call the SF
select
metaphon
(
"Hello"
);
# Drop the SF
drop
function
metaphon
;
# Change the current database to none.
use
db_31767
;
drop
database
db_31767
;
drop
function
if
exists
no_such_func
;
--
error
ER_SP_DOES_NOT_EXIST
drop
function
no_such_func
;
drop
function
if
exists
test
.
no_such_func
;
--
error
ER_SP_DOES_NOT_EXIST
drop
function
test
.
no_such_func
;
--
error
ER_NO_DB_ERROR
drop
procedure
if
exists
no_such_proc
;
--
error
ER_NO_DB_ERROR
drop
procedure
no_such_proc
;
use
test
;
--
echo
#
--
echo
#
--
echo
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
--
echo
# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
--
echo
#
--
echo
#
...
...
sql/sql_parse.cc
View file @
e96932f4
...
@@ -4132,6 +4132,47 @@ case SQLCOM_PREPARE:
...
@@ -4132,6 +4132,47 @@ case SQLCOM_PREPARE:
case
SQLCOM_DROP_PROCEDURE
:
case
SQLCOM_DROP_PROCEDURE
:
case
SQLCOM_DROP_FUNCTION
:
case
SQLCOM_DROP_FUNCTION
:
{
{
#ifdef HAVE_DLOPEN
if
(
lex
->
sql_command
==
SQLCOM_DROP_FUNCTION
&&
!
lex
->
spname
->
m_explicit_name
)
{
/* DROP FUNCTION <non qualified name> */
udf_func
*
udf
=
find_udf
(
lex
->
spname
->
m_name
.
str
,
lex
->
spname
->
m_name
.
length
);
if
(
udf
)
{
if
(
check_access
(
thd
,
DELETE_ACL
,
"mysql"
,
NULL
,
NULL
,
1
,
0
))
goto
error
;
if
(
!
(
res
=
mysql_drop_function
(
thd
,
&
lex
->
spname
->
m_name
)))
{
my_ok
(
thd
);
break
;
}
my_error
(
ER_SP_DROP_FAILED
,
MYF
(
0
),
"FUNCTION (UDF)"
,
lex
->
spname
->
m_name
.
str
);
goto
error
;
}
if
(
lex
->
spname
->
m_db
.
str
==
NULL
)
{
if
(
lex
->
drop_if_exists
)
{
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_SP_DOES_NOT_EXIST
,
ER
(
ER_SP_DOES_NOT_EXIST
),
"FUNCTION (UDF)"
,
lex
->
spname
->
m_name
.
str
);
res
=
FALSE
;
my_ok
(
thd
);
break
;
}
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
"FUNCTION (UDF)"
,
lex
->
spname
->
m_name
.
str
);
goto
error
;
}
/* Fall thought to test for a stored function */
}
#endif
int
sp_result
;
int
sp_result
;
int
type
=
(
lex
->
sql_command
==
SQLCOM_DROP_PROCEDURE
?
int
type
=
(
lex
->
sql_command
==
SQLCOM_DROP_PROCEDURE
?
TYPE_ENUM_PROCEDURE
:
TYPE_ENUM_FUNCTION
);
TYPE_ENUM_PROCEDURE
:
TYPE_ENUM_FUNCTION
);
...
@@ -4178,34 +4219,6 @@ case SQLCOM_PREPARE:
...
@@ -4178,34 +4219,6 @@ case SQLCOM_PREPARE:
}
}
#endif
#endif
}
}
else
{
#ifdef HAVE_DLOPEN
if
(
lex
->
sql_command
==
SQLCOM_DROP_FUNCTION
)
{
udf_func
*
udf
=
find_udf
(
lex
->
spname
->
m_name
.
str
,
lex
->
spname
->
m_name
.
length
);
if
(
udf
)
{
if
(
check_access
(
thd
,
DELETE_ACL
,
"mysql"
,
NULL
,
NULL
,
1
,
0
))
goto
error
;
if
(
!
(
res
=
mysql_drop_function
(
thd
,
&
lex
->
spname
->
m_name
)))
{
my_ok
(
thd
);
break
;
}
}
}
#endif
if
(
lex
->
spname
->
m_db
.
str
)
sp_result
=
SP_KEY_NOT_FOUND
;
else
{
my_message
(
ER_NO_DB_ERROR
,
ER
(
ER_NO_DB_ERROR
),
MYF
(
0
));
goto
error
;
}
}
res
=
sp_result
;
res
=
sp_result
;
switch
(
sp_result
)
{
switch
(
sp_result
)
{
case
SP_OK
:
case
SP_OK
:
...
@@ -4217,7 +4230,7 @@ case SQLCOM_PREPARE:
...
@@ -4217,7 +4230,7 @@ case SQLCOM_PREPARE:
res
=
write_bin_log
(
thd
,
TRUE
,
thd
->
query
(),
thd
->
query_length
());
res
=
write_bin_log
(
thd
,
TRUE
,
thd
->
query
(),
thd
->
query_length
());
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_SP_DOES_NOT_EXIST
,
ER
(
ER_SP_DOES_NOT_EXIST
),
ER_SP_DOES_NOT_EXIST
,
ER
(
ER_SP_DOES_NOT_EXIST
),
SP_COM_STRING
(
lex
),
lex
->
spname
->
m_
name
.
str
);
SP_COM_STRING
(
lex
),
lex
->
spname
->
m_q
name
.
str
);
if
(
!
res
)
if
(
!
res
)
my_ok
(
thd
);
my_ok
(
thd
);
break
;
break
;
...
...
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