Below is the list of changes that have just been committed into a local
5.0 repository of marcsql. When marcsql does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-10-09 09:59:02-07:00, malff@weblab.(none) +3 -0
Bug#21462 (Stored procedures with no arguments require parenthesis)
The syntax of the CALL statement, to invoke a stored procedure, has been
changed to make the use of parenthesis optional in the argument list.
With this change, "CALL p;" is equivalent to "CALL p();".
While the SQL spec does not explicitely mandate this syntax, supporting it
is needed for practical reasons, for integration with JDBC / ODBC connectors.
Also, warnings in the sql/sql_yacc.yy file, which were not reported by Bison 2.1
but are now reported by Bison 2.2, have been fixed.
The warning found were:
bison -y -p MYSQL -d --debug --verbose sql_yacc.yy
sql_yacc.yy:653.9-18: warning: symbol UNLOCK_SYM redeclared
sql_yacc.yy:656.9-17: warning: symbol UNTIL_SYM redeclared
sql_yacc.yy:658.9-18: warning: symbol UPDATE_SYM redeclared
sql_yacc.yy:5169.11-5174.11: warning: unused value: $2
sql_yacc.yy:5208.11-5220.11: warning: unused value: $5
sql_yacc.yy:5221.11-5234.11: warning: unused value: $5
conflicts: 249 shift/reduce
"unused value: $2" correspond to the $$=$1 assignment in the 1st {} block
in table_ref -> join_table {} {},
which does not procude a result ($$) for the rule but an intermediate $2
value for the action instead.
"unused value: $5" are similar, with $$ assignments in {} actions blocks
which are not for the final reduce.
mysql-test/r/sp.result@stripped, 2006-10-09 09:59:00-07:00, malff@weblab.(none) +27 -0
New test case for Bug#21462
mysql-test/t/sp.test@stripped, 2006-10-09 09:59:00-07:00, malff@weblab.(none) +33 -0
New test case for Bug#21462
sql/sql_yacc.yy@stripped, 2006-10-09 09:59:00-07:00, malff@weblab.(none) +11 -9
"CALL p;" syntax for calling a stored procedure
Fixed bison 2.2 warnings.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: malff
# Host: weblab.(none)
# Root: /home/marcsql/TREE/mysql-5.0-21462
--- 1.491/sql/sql_yacc.yy 2006-10-09 09:59:06 -07:00
+++ 1.492/sql/sql_yacc.yy 2006-10-09 09:59:06 -07:00
@@ -650,11 +650,8 @@ bool my_yyoverflow(short **a, YYSTYPE **
%token UNIX_TIMESTAMP
%token UNKNOWN_SYM
%token UNLOCK_SYM
-%token UNLOCK_SYM
%token UNSIGNED
%token UNTIL_SYM
-%token UNTIL_SYM
-%token UPDATE_SYM
%token UPDATE_SYM
%token UPGRADE_SYM
%token USAGE
@@ -1447,15 +1444,20 @@ call:
lex->value_list.empty();
sp_add_used_routine(lex, YYTHD, $2, TYPE_ENUM_PROCEDURE);
}
- '(' sp_cparam_list ')' {}
+ opt_sp_cparam_list {}
;
/* CALL parameters */
-sp_cparam_list:
+opt_sp_cparam_list:
/* Empty */
- | sp_cparams
+ | '(' opt_sp_cparams ')'
;
+opt_sp_cparams:
+ /* Empty */
+ | sp_cparams
+ ;
+
sp_cparams:
sp_cparams ',' expr
{
@@ -5166,7 +5168,7 @@ when_list2:
/* Warning - may return NULL in case of incomplete SELECT */
table_ref:
table_factor { $$=$1; }
- | join_table { $$=$1; }
+ | join_table
{
LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(lex->thd)))
@@ -5208,7 +5210,7 @@ join_table:
| table_ref normal_join table_ref
ON
{
- YYERROR_UNLESS($1 && ($$=$3));
+ YYERROR_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $3))
YYABORT;
@@ -5223,7 +5225,7 @@ join_table:
| table_ref STRAIGHT_JOIN table_factor
ON
{
- YYERROR_UNLESS($1 && ($$=$3));
+ YYERROR_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $3))
YYABORT;
--- 1.213/mysql-test/r/sp.result 2006-10-09 09:59:06 -07:00
+++ 1.214/mysql-test/r/sp.result 2006-10-09 09:59:06 -07:00
@@ -5470,5 +5470,32 @@ CAD
CHF
DROP FUNCTION bug21493|
DROP TABLE t3,t4|
+drop procedure if exists proc_21462_a|
+drop procedure if exists proc_21462_b|
+create procedure proc_21462_a()
+begin
+select "Called A";
+end|
+create procedure proc_21462_b(x int)
+begin
+select "Called B";
+end|
+call proc_21462_a|
+Called A
+Called A
+call proc_21462_a()|
+Called A
+Called A
+call proc_21462_a(1)|
+ERROR 42000: Incorrect number of arguments for PROCEDURE test.proc_21462_a; expected 0,
got 1
+call proc_21462_b|
+ERROR 42000: Incorrect number of arguments for PROCEDURE test.proc_21462_b; expected 1,
got 0
+call proc_21462_b()|
+ERROR 42000: Incorrect number of arguments for PROCEDURE test.proc_21462_b; expected 1,
got 0
+call proc_21462_b(1)|
+Called B
+Called B
+drop procedure proc_21462_a|
+drop procedure proc_21462_b|
End of 5.0 tests
drop table t1,t2;
--- 1.202/mysql-test/t/sp.test 2006-10-09 09:59:06 -07:00
+++ 1.203/mysql-test/t/sp.test 2006-10-09 09:59:06 -07:00
@@ -6420,6 +6420,39 @@ SELECT bug21493(Member_ID) FROM t3|
DROP FUNCTION bug21493|
DROP TABLE t3,t4|
+#
+# Bug#21462 Stored procedures with no arguments require parenthesis
+#
+
+--disable_warnings
+drop procedure if exists proc_21462_a|
+drop procedure if exists proc_21462_b|
+--enable_warnings
+
+create procedure proc_21462_a()
+begin
+ select "Called A";
+end|
+
+create procedure proc_21462_b(x int)
+begin
+ select "Called B";
+end|
+
+call proc_21462_a|
+call proc_21462_a()|
+-- error ER_SP_WRONG_NO_OF_ARGS
+call proc_21462_a(1)|
+
+-- error ER_SP_WRONG_NO_OF_ARGS
+call proc_21462_b|
+-- error ER_SP_WRONG_NO_OF_ARGS
+call proc_21462_b()|
+call proc_21462_b(1)|
+
+drop procedure proc_21462_a|
+drop procedure proc_21462_b|
+
--echo End of 5.0 tests
| Thread |
|---|
| • bk commit into 5.0 tree (malff:1.2275) BUG#21462 | marc.alff | 9 Oct |