Commit 35588c9d authored by unknown's avatar unknown

Fixed BUG#6027: Stored procedures can be renamed.

Removed the support for renaming SPs. It's non-standard, conflicted with a standard
syntax, and was a bit broken anyway.


mysql-test/r/sp-error.result:
  Removed test for renaming procedures with alter.
mysql-test/r/sp.result:
  Removed test for renaming procedures with alter.
mysql-test/t/sp-error.test:
  Removed test for renaming procedures with alter.
mysql-test/t/sp.test:
  Removed test for renaming procedures with alter.
sql/sp.cc:
  Removed support for renaming SPs. It's non-standard, conflicted with a standard
  syntax, and was a bit broken anyway.
sql/sp.h:
  Removed support for renaming SPs. It's non-standard, conflicted with a standard
  syntax, and was a bit broken anyway.
sql/sql_parse.cc:
  Removed support for renaming SPs. It's non-standard, conflicted with a standard
  syntax, and was a bit broken anyway.
sql/sql_yacc.yy:
  Removed support for renaming SPs. It's non-standard, conflicted with a standard
  syntax, and was a bit broken anyway.
parent b24dd933
......@@ -235,9 +235,6 @@ ERROR 24000: Cursor is not open
drop procedure p|
alter procedure bar3 sql security invoker|
ERROR 42000: PROCEDURE test.bar3 does not exist
alter procedure bar3 name
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|
ERROR 42000: Identifier name 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' is too long
drop table t1|
drop table if exists t1|
create table t1 (val int, x float)|
......
......@@ -893,15 +893,15 @@ select * from t1|
id data
chistics 1
delete from t1|
alter procedure chistics sql security invoker name chistics2|
show create procedure chistics2|
alter procedure chistics sql security invoker|
show create procedure chistics|
Procedure sql_mode Create Procedure
chistics2 CREATE PROCEDURE `test`.`chistics2`()
chistics CREATE PROCEDURE `test`.`chistics`()
MODIFIES SQL DATA
SQL SECURITY INVOKER
COMMENT 'Characteristics procedure test'
insert into t1 values ("chistics", 1)
drop procedure chistics2|
drop procedure chistics|
create function chistics() returns int
language sql
deterministic
......@@ -918,18 +918,18 @@ return 42
select chistics()|
chistics()
42
alter function chistics name chistics2
alter function chistics
no sql
comment 'Characteristics function test'|
show create function chistics2|
show create function chistics|
Function sql_mode Create Function
chistics2 CREATE FUNCTION `test`.`chistics2`() RETURNS int
chistics CREATE FUNCTION `test`.`chistics`() RETURNS int
NO SQL
DETERMINISTIC
SQL SECURITY INVOKER
COMMENT 'Characteristics function test'
return 42
drop function chistics2|
drop function chistics|
insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)|
set @@sql_mode = 'ANSI'|
create procedure modes(out c1 int, out c2 int)
......@@ -2136,8 +2136,8 @@ insert into test.t1 values (x, y)|
show procedure status like 'bar'|
Db Name Type Definer Modified Created Security_type Comment
test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111
alter procedure bar name bar2 comment "2222222222" sql security definer|
alter procedure bar2 name bar comment "3333333333"|
alter procedure bar comment "2222222222" sql security definer|
alter procedure bar comment "3333333333"|
alter procedure bar|
show create procedure bar|
Procedure sql_mode Create Procedure
......
......@@ -307,9 +307,6 @@ drop procedure p|
--error 1305
alter procedure bar3 sql security invoker|
--error 1059
alter procedure bar3 name
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|
drop table t1|
......
......@@ -990,9 +990,9 @@ show create procedure chistics|
call chistics()|
select * from t1|
delete from t1|
alter procedure chistics sql security invoker name chistics2|
show create procedure chistics2|
drop procedure chistics2|
alter procedure chistics sql security invoker|
show create procedure chistics|
drop procedure chistics|
create function chistics() returns int
language sql
......@@ -1004,11 +1004,11 @@ create function chistics() returns int
show create function chistics|
# Call it, just to make sure.
select chistics()|
alter function chistics name chistics2
alter function chistics
no sql
comment 'Characteristics function test'|
show create function chistics2|
drop function chistics2|
show create function chistics|
drop function chistics|
# Check mode settings
......@@ -2268,8 +2268,8 @@ create procedure bar(x char(16), y int)
insert into test.t1 values (x, y)|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like 'bar'|
alter procedure bar name bar2 comment "2222222222" sql security definer|
alter procedure bar2 name bar comment "3333333333"|
alter procedure bar comment "2222222222" sql security definer|
alter procedure bar comment "3333333333"|
alter procedure bar|
show create procedure bar|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
......
......@@ -442,9 +442,7 @@ db_drop_routine(THD *thd, int type, sp_name *name)
static int
db_update_routine(THD *thd, int type, sp_name *name,
char *newname, uint newnamelen,
st_sp_chistics *chistics)
db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
{
TABLE *table;
int ret;
......@@ -462,10 +460,6 @@ db_update_routine(THD *thd, int type, sp_name *name,
if (chistics->suid != SP_IS_DEFAULT_SUID)
table->field[MYSQL_PROC_FIELD_SECURITY_TYPE]->
store((longlong)chistics->suid);
if (newname)
table->field[MYSQL_PROC_FIELD_NAME]->store(newname,
newnamelen,
system_charset_info);
if (chistics->daccess != SP_DEFAULT_ACCESS)
table->field[MYSQL_PROC_FIELD_ACCESS]->
store((longlong)chistics->daccess);
......@@ -772,9 +766,7 @@ sp_drop_procedure(THD *thd, sp_name *name)
int
sp_update_procedure(THD *thd, sp_name *name,
char *newname, uint newnamelen,
st_sp_chistics *chistics)
sp_update_procedure(THD *thd, sp_name *name, st_sp_chistics *chistics)
{
int ret;
bool found;
......@@ -782,8 +774,7 @@ sp_update_procedure(THD *thd, sp_name *name,
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
found= sp_cache_remove(&thd->sp_proc_cache, name);
ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name,
newname, newnamelen, chistics);
ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, chistics);
if (!found && !ret)
sp_cache_invalidate();
DBUG_RETURN(ret);
......@@ -870,9 +861,7 @@ sp_drop_function(THD *thd, sp_name *name)
int
sp_update_function(THD *thd, sp_name *name,
char *newname, uint newnamelen,
st_sp_chistics *chistics)
sp_update_function(THD *thd, sp_name *name, st_sp_chistics *chistics)
{
int ret;
bool found;
......@@ -880,8 +869,7 @@ sp_update_function(THD *thd, sp_name *name,
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
found= sp_cache_remove(&thd->sp_func_cache, name);
ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name,
newname, newnamelen, chistics);
ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, chistics);
if (!found && !ret)
sp_cache_invalidate();
DBUG_RETURN(ret);
......
......@@ -44,9 +44,7 @@ sp_drop_procedure(THD *thd, sp_name *name);
int
sp_update_procedure(THD *thd, sp_name *name,
char *newname, uint newnamelen,
st_sp_chistics *chistics);
sp_update_procedure(THD *thd, sp_name *name, st_sp_chistics *chistics);
int
sp_show_create_procedure(THD *thd, sp_name *name);
......@@ -64,9 +62,7 @@ int
sp_drop_function(THD *thd, sp_name *name);
int
sp_update_function(THD *thd, sp_name *name,
char *newname, uint newnamelen,
st_sp_chistics *chistics);
sp_update_function(THD *thd, sp_name *name, st_sp_chistics *chistics);
int
sp_show_create_function(THD *thd, sp_name *name);
......
......@@ -3766,20 +3766,10 @@ purposes internal to the MySQL server", MYF(0));
case SQLCOM_ALTER_FUNCTION:
{
res= -1;
uint newname_len= 0;
if (lex->name)
newname_len= strlen(lex->name);
if (newname_len > NAME_LEN)
{
net_printf(thd, ER_TOO_LONG_IDENT, lex->name);
goto error;
}
if (lex->sql_command == SQLCOM_ALTER_PROCEDURE)
res= sp_update_procedure(thd, lex->spname,
lex->name, newname_len, &lex->sp_chistics);
res= sp_update_procedure(thd, lex->spname, &lex->sp_chistics);
else
res= sp_update_function(thd, lex->spname,
lex->name, newname_len, &lex->sp_chistics);
res= sp_update_function(thd, lex->spname, &lex->sp_chistics);
switch (res)
{
case SP_OK:
......
......@@ -789,7 +789,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
opt_extended_describe
prepare prepare_src execute deallocate
statement sp_suid opt_view_list view_list or_replace algorithm
sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic sp_a_chistic
sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic
END_OF_INPUT
%type <NONE> call sp_proc_stmts sp_proc_stmt
......@@ -1371,7 +1371,7 @@ create_function_tail:
sp_a_chistics:
/* Empty */ {}
| sp_a_chistics sp_a_chistic {}
| sp_a_chistics sp_chistic {}
;
sp_c_chistics:
......@@ -1397,12 +1397,6 @@ sp_chistic:
{ }
;
/* Alter characteristics */
sp_a_chistic:
sp_chistic { }
| NAME_SYM ident { Lex->name= $2.str; }
;
/* Create characteristics */
sp_c_chistic:
sp_chistic { }
......@@ -3195,7 +3189,6 @@ alter:
LEX *lex= Lex;
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
lex->name= 0;
}
sp_a_chistics
{
......@@ -3210,7 +3203,6 @@ alter:
LEX *lex= Lex;
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
lex->name= 0;
}
sp_a_chistics
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment