should fail to create
The problem was that this type of errors was checked during view
creation, which doesn't happen when CREATE VIEW is a statement of
a created stored routine.
The solution is to perform the checks at parse time. The idea of the
fix is that the parser checks if a construction just parsed is allowed
in current circumstances by testing certain flags, and this flags are
reset for VIEWs.
The side effect of this change is that if the user already have
such bogus routines, it will now get a error when trying to do
SHOW CREATE PROCEDURE proc;
(and some other) and when trying to execute such routine he will get
ERROR 1457 (HY000): Failed to load routine test.p5. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
However there should be very few such users (if any), and they may
(and should) drop these bogus routines.
mysql-test/r/sp-error.result:
Add result for bug#20953: create proc with a create view that uses
local vars/params should fail to create.
mysql-test/r/view.result:
Update results.
mysql-test/t/sp-error.test:
Add test case for bug#20953: create proc with a create view that uses
local vars/params should fail to create.
mysql-test/t/view.test:
Add second test for variable in a view.
Remove SP variable in a view test, as it tests wrong behaviour.
Add test for derived table in a view.
sql/sql_lex.cc:
Remove LEX::variables_used.
sql/sql_lex.h:
Remove LEX::variables_used and add st_parsing_options structure and
LEX::parsing_options member.
sql/sql_view.cc:
Move some error checking to sql/sql_yacc.yy.
sql/sql_yacc.yy:
Check for disallowed syntax in a CREATE VIEW at parse time to rise a
error when it is used inside CREATE PROCEDURE and CREATE FUNCTION, as
well as by itself.
from within triggers
Add support for passing NEW.x as INOUT and OUT parameters to stored
procedures. Passing NEW.x as INOUT parameter requires SELECT and
UPDATE privileges on that column, and passing it as OUT parameter
requires only UPDATE privilege.
mysql-test/r/sp-error.result:
Update the result for new message.
mysql-test/r/trigger-grant.result:
Add result for bug#14635.
mysql-test/r/trigger.result:
Add result for bug#14635.
mysql-test/t/trigger-grant.test:
Add test case for bug#14635.
mysql-test/t/trigger.test:
Add test case for bug#14635.
sql/item.cc:
Add implementations of set_value() and set_required_privilege() methods
of Settable_routine_parameter interface.
Use Item_trigger_field::want_privilege instead of
Item_trigger_field::access_type.
Reset privileges on Item_trigger_field::cleanup().
sql/item.h:
Add interface class Settable_routine_parameter and interface query
method to Item class. Item_splocal and Item_trigger_field implement
this interface.
For Item_trigger_field:
- add read_only attribute and is_read_only() method.
- remove access_type and add original_privilege and want_privilege
instead.
- add set_value() method.
- add reset_privilege() method.
sql/item_func.cc:
Add implementations of set_value() method of Settable_routine_parameter
interface.
sql/item_func.h:
Item_func_get_user_var implements Settable_routine_parameter interface.
sql/share/errmsg.txt:
Update english ER_SP_NOT_VAR_ARG message.
sql/sp_head.cc:
Use Settable_routine_parameter interface for parameter update.
sql/sql_yacc.yy:
Set read_only and want_privilege members in Item_trigger_field
appropriately. For NEW.x trigger variable used in left-hand-side
of SET statement the latter is set to UPDATE_ACL, otherwise it is
set to SELECT_ACL (but see Item_trigger_field::set_required_privilege(),
where it may be updated to different value).
into mysql.com:/extern/mysql/5.0/bug17015/mysql-5.0-runtime
mysql-test/r/sp-error.result:
Auto merged
mysql-test/t/sp-error.test:
Auto merged
sql/field.h:
Auto merged
sql/sp.cc:
Auto merged
(Needed for "list of pushes" web page and autopush)
include/mysql.h:
Fix to embedded server to be able to run tests on it
libmysql/libmysql.c:
Fix to embedded server to be able to run tests on it
libmysqld/emb_qcache.cc:
Fix to embedded server to be able to run tests on it
libmysqld/embedded_priv.h:
Fix to embedded server to be able to run tests on it
libmysqld/lib_sql.cc:
Fix to embedded server to be able to run tests on it
libmysqld/libmysqld.c:
Fix to embedded server to be able to run tests on it
mysql-test/mysql-test-run.sh:
Fix to embedded server to be able to run tests on it
mysql-test/r/binlog.result:
Updated test for embedded server
mysql-test/r/ctype_cp932.result:
Updated test for embedded server
mysql-test/r/innodb.result:
Updated test for embedded server
mysql-test/r/mysqltest.result:
Updated test for embedded server
mysql-test/r/query_cache.result:
Updated test for embedded server
mysql-test/r/query_cache_notembedded.result:
Updated test for embedded server
mysql-test/r/sp-error.result:
Updated test for embedded server
mysql-test/r/sp.result:
Updated test for embedded server
mysql-test/r/subselect.result:
Updated test for embedded server
mysql-test/r/view.result:
Updated test for embedded server
mysql-test/r/view_grant.result:
Updated test for embedded server
mysql-test/t/backup.test:
Updated test for embedded server
mysql-test/t/binlog.test:
Updated test for embedded server
mysql-test/t/blackhole.test:
Updated test for embedded server
mysql-test/t/compress.test:
Updated test for embedded server
mysql-test/t/ctype_cp932.test:
Updated test for embedded server
mysql-test/t/delayed.test:
Updated test for embedded server
mysql-test/t/handler.test:
Updated test for embedded server
mysql-test/t/innodb.test:
Updated test for embedded server
mysql-test/t/mysql.test:
Updated test for embedded server
mysql-test/t/mysql_client_test.test:
Updated test for embedded server
mysql-test/t/mysqltest.test:
Updated test for embedded server
mysql-test/t/query_cache.test:
Updated test for embedded server
mysql-test/t/query_cache_notembedded.test:
Updated test for embedded server
mysql-test/t/read_only.test:
Updated test for embedded server
mysql-test/t/skip_grants.test:
Updated test for embedded server
mysql-test/t/sp-destruct.test:
Updated test for embedded server
mysql-test/t/sp-error.test:
Updated test for embedded server
mysql-test/t/sp-threads.test:
Updated test for embedded server
mysql-test/t/sp.test:
Updated test for embedded server
mysql-test/t/subselect.test:
Updated test for embedded server
mysql-test/t/temp_table.test:
Updated test for embedded server
mysql-test/t/view.test:
Updated test for embedded server
mysql-test/t/view_grant.test:
Updated test for embedded server
mysql-test/t/wait_timeout.test:
Updated test for embedded server
mysys/mf_dirname.c:
Review fix: Don't access data outside of array
mysys/my_bitmap.c:
Remove compiler warnings
scripts/mysql_fix_privilege_tables.sql:
Add flush privileges to .sql script so that one doesn't have to reboot mysqld when one runs the mysql_fix_privilege_script
sql-common/client.c:
Updated test for embedded server
sql/item.cc:
Remove DBUG_PRINT statement that can cause crashes when running with --debug
sql/mysqld.cc:
Fix to embedded server to be able to run tests on it
sql/protocol.cc:
Fix to embedded server to be able to run tests on it
(Trivial reconstruction of code)
sql/protocol.h:
Fix to embedded server to be able to run tests on it
sql/sql_base.cc:
Better comment
sql/sql_class.cc:
Fix to embedded server to be able to run tests on it
sql/sql_class.h:
Fix to embedded server to be able to run tests on it
sql/sql_cursor.cc:
Fix to embedded server to be able to run tests on it
sql/sql_parse.cc:
Fix to embedded server to be able to run tests on it
Don't crash for disabled commands when using embedded server
sql/sql_prepare.cc:
Fix to embedded server to be able to run tests on it
mysql-test/r/ctype_cp932_notembedded.result:
New BitKeeper file ``mysql-test/r/ctype_cp932_notembedded.result''
mysql-test/r/innodb_notembedded.result:
New BitKeeper file ``mysql-test/r/innodb_notembedded.result''
mysql-test/r/sp.result.orig:
New BitKeeper file ``mysql-test/r/sp.result.orig''
mysql-test/r/sp_notembedded.result:
New BitKeeper file ``mysql-test/r/sp_notembedded.result''
mysql-test/r/subselect_notembedded.result:
New BitKeeper file ``mysql-test/r/subselect_notembedded.result''
mysql-test/t/ctype_cp932_notembedded.test:
New BitKeeper file ``mysql-test/t/ctype_cp932_notembedded.test''
mysql-test/t/innodb_notembedded.test:
New BitKeeper file ``mysql-test/t/innodb_notembedded.test''
mysql-test/t/sp.test.orig:
New BitKeeper file ``mysql-test/t/sp.test.orig''
mysql-test/t/sp_notembedded.test:
New BitKeeper file ``mysql-test/t/sp_notembedded.test''
mysql-test/t/subselect_notembedded.test:
New BitKeeper file ``mysql-test/t/subselect_notembedded.test''
The name length was checked "the old way", not taking charsets into account,
when creating a stored routine.
Fixing this enforces the real limit (64 characters) again, and no truncation
is possible.
mysql-test/r/sp-error.result:
Updated results for BUG#17015.
mysql-test/t/sp-error.test:
Added and modified test case for BUG#17015 (and 9529).
sql/sp.cc:
When creating a routine, check the length of the name the correct way,
taking the charsets into account.
Check if AGGREGATE was given with a stored (non-UDF) function, and return
error in that case.
Also made udf_example/udf_test work again, by adding a missing *_init()
function. (_init() functions required unless --allow_suspicious_udfs is
given to the server, since March 2005 - it seems udf_example wasn't updated
at the time.)
mysql-test/r/sp-error.result:
Updated results for BUG#16896.
mysql-test/t/sp-error.test:
Added test case for BUG#16896.
sql/share/errmsg.txt:
New error message: ER_SP_NO_AGGREGATE
sql/sql_yacc.yy:
Check if AGGREGATE was used when creating a stored function (i.e. not an UDF).
sql/udf_example.cc:
Added myfunc_int_init() function to make it work when the server is running without
--allow_suspicious_udfs.
no order by clause
which was fixed by earlier changesets.
The error message is now the more generic "Unknown table ... in field list".
mysql-test/r/sp-error.result:
Updated results for new test case (BUG#15091).
mysql-test/t/sp-error.test:
New test case for BUG#15091.
which was fixed by earlier changesets; LOAD INDEX is not allowed in functions.
Also testing CACHE INDEX, while OPTIMIZE and CHECK were covered by existing tests already.
mysql-test/r/sp-error.result:
Updated result for new test case (BUG#14270).
mysql-test/t/sp-error.test:
New test case for BUG#14270.
into mysql.com:/extern/mysql/work/bug15658/mysql-5.0
mysql-test/r/sp-error.result:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/share/errmsg.txt:
Auto merged
reword the misleading message.
mysql-test/r/sp-error.result:
Test results fixed (Bug#15206)
mysql-test/r/sp.result:
Test results fixed (Bug#15206)
mysql-test/r/type_decimal.result:
Disable an unportable test case (Bug#7670)
mysql-test/r/variables.result:
Test results fixed (Bug#15206)
mysql-test/r/view_grant.result:
Test results fixed (Bug#15206)
mysql-test/t/type_decimal.test:
Remove an unportable (QNX) test case (Bug#7670). The test output
depends on system-specific sprintf() implementation.
The original complain was about erroneous conversion to long long,
which was applied prior to conversion to double: but the expected
behaviour can't be achieved until we have an own string -> double
conversion function.
Empty strings (and names with trailing spaces) should not be allowed.
mysql-test/r/sp-error.result:
New testcase for BUG#15658
mysql-test/t/sp-error.test:
New testcase for BUG#15658
sql/share/errmsg.txt:
New error message for bad stored routine names.
sql/sp_head.cc:
Added function for checking SP names. (Mustn't be empty or contain trailing spaces.)
sql/sp_head.h:
Added function for checking SP names.
sql/sql_yacc.yy:
Check db and name for stored routines.
current SP tables locking make impossible view security" with main tree.
mysql-test/r/sp-error.result:
Fixed test result after merging fix for bug #11555 "Stored procedures: current
SP tables locking make impossible view security" with main tree.
into mysql.com:/home/dlenev/src/mysql-5.0-bg11555-2
mysql-test/r/view.result:
Auto merged
mysql-test/t/sp-error.test:
Auto merged
sql/sp_head.cc:
Auto merged
mysql-test/r/sp-error.result:
SCCS merged
into mysql.com:/home/dlenev/src/mysql-5.0-bg11555-2
mysql-test/r/sp-error.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/view.test:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_trigger.h:
Auto merged
sql/sp.cc:
Manual merge.
sql/sp.h:
Manual merge.
sql/sql_base.cc:
Manual merge.
impossible view security".
We should not expose names of tables which are explicitly or implicitly (via
routine or trigger) used by view even if we find that they are missing.
So during building of list of prelocked tables for statement we track which
routines (and therefore tables for these routines) are used from views. We
mark elements of LEX::routines set which correspond to routines used in views
by setting Sroutine_hash_entry::belong_to_view member to point to TABLE_LIST
object for topmost view which uses routine. We propagate this mark to all
routines which are used by this routine and which we add to this set. We also
mark tables used by such routine which we add to the list of tables for
prelocking as belonging to this view.
mysql-test/r/sp-error.result:
Added test for bug #11555 "Stored procedures: current SP tables locking make
impossible view security".
mysql-test/r/view.result:
We should not expose tables which are expicitly/implicitly used in view in
check table statement.
mysql-test/t/sp-error.test:
Added test for bug #11555 "Stored procedures: current SP tables locking make
impossible view security".
mysql-test/t/view.test:
Removed comment obsoleted by bugfix.
sql/sp.cc:
We should not expose names of tables which are explicitly or implicitly
(via routine or trigger) used by view even if we find that they are missing.
So during building of list of prelocked tables for statement we track which
routines (and therefore tables for these routines) are used from views. We
mark elements of LEX::routines set which correspond to routines used in views
by setting Sroutine_hash_entry::belong_to_view member to point to TABLE_LIST
object for topmost view which uses routine. We propagate this mark to all
routines which are used by this routine and which we add to this set. We also
mark tables used by such routine which we add to the list of tables for
prelocking as belonging to this view.
sql/sp.h:
sp_cache_routines_and_add_tables_for_view()/for_triggers():
To be able to determine correctly uppermost view which uses this view/table
with trigger we have to pass pointer to TABLE_LIST object instead of pointer
to view's LEX or to Table_triggers_list object.
sql/sp_head.cc:
sp_head::add_used_tables_to_table_list():
Added new argument which allows to mark tables which are added to table
list for prelocking as belonging to view (this allows properly hide names
of tables which are used in routines used by views).
sql/sp_head.h:
sp_head::add_used_tables_to_table_list():
Added new argument which allows to mark tables which are added to table
list for prelocking as belonging to view (this allows properly hide names
of tables which are used in routines used by views).
sql/sql_base.cc:
open_tables():
sp_cache_routines_and_add_tables_for_view()/for_triggers() now accept
pointer to table list element as last argument, this allows them to determine
correctly uppermost view which uses this view/table with trigger.
sql/sql_trigger.h:
Table_triggers_list:
sp_cache_routines_and_add_tables_for_triggers() now accept pointer to table
list element as last argument, this allows to determine correctly uppermost
view which uses this table with trigger.
mysql-test/r/sp-error.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/share/errmsg.txt:
SCCS merged
into mysql.com:/usr/home/pem/bug14233/mysql-5.0
mysql-test/r/sp-error.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/sp.cc:
Auto merged
sql/sp.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_trigger.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/share/errmsg.txt:
SCCS merged
it's about mysql_admin_commands not being reexecution-safe
(and CHECK still isn't)
mysql-test/r/sp-error.result:
optimize is now allowed in SP
mysql-test/r/sp.result:
test repair/optimize/analyze in SP
mysql-test/t/backup.test:
clean up after itself
mysql-test/t/sp-error.test:
optimize is now allowed in SP
mysql-test/t/sp.test:
test repair/optimize/analyze in SP
sql/sp_head.cc:
all mysql_admin commands return result set
sql/sql_parse.cc:
all mysql_admin commands modify table list and we should restore it for SP
sql/sql_table.cc:
optimization - don't execute views when no view is expected/allowed
sql/sql_yacc.yy:
optimize is now allowed in SP
Post-review version. Some minor review fixes, but also changed the way
some errors are handled: Don't return specific parse errors; instead
always use the more general "table corrupt" error (amended accordingly).
mysql-test/r/sp-destruct.result:
Updated results.
mysql-test/r/sp-error.result:
Updated for fully qualified name in "no return" error message.
mysql-test/t/sp-destruct.test:
Adopted the more consistent error handling for a corrupted mysql.proc table.
(No more "parse error" et al).
sql/share/errmsg.txt:
Changed ER_SP_PROC_TABLE_CORRUPT to be more explicit.
sql/sp.cc:
Review fixes.
Changed the handling of parse errors, and added the routine name to the "table corrupt" error message.
sql/sql_base.cc:
Review changes: Change error tests and added comments.
sql/sql_parse.cc:
Mored ER_SP_NORETURN test of functions to sql_yacc.yy for more general error handling.
sql/sql_yacc.yy:
Mored ER_SP_NORETURN test of functions from sql_parse.cc for more general error handling.
into sanja.is.com.ua:/home/bell/mysql/bk/work-merge-5.0
mysql-test/r/sp-error.result:
Auto merged
mysql-test/r/trigger.result:
Auto merged
mysql-test/t/sp-error.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
mysql-test/t/trigger.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_parse.cc:
Auto merged
mysql-test/r/sp.result:
merge
sql/share/errmsg.txt:
merge
client/mysqltest.c:
An expected error messages hiding from the log if disable_result_log is in force.
mysql-test/r/sp-dynamic.result:
The test expanded for case of allowed/disalowed recursion.
mysql-test/r/sp-error.result:
Error messages changed.
Test of bug11394() made with allowed recursion.
mysql-test/r/sp.result:
Tests for recursion.
mysql-test/r/trigger.result:
Check that triggers are not affected by this patch.
mysql-test/r/variables.result:
Test of max_sp_recursion_depth variable.
mysql-test/t/sp-dynamic.test:
The test expanded for case of allowed/disalowed recursion.
mysql-test/t/sp-error.test:
Error messages changed.
Test of bug11394() made with allowed recursion.
mysql-test/t/sp.test:
Tests for recursion.
mysql-test/t/trigger.test:
Check that triggers are not affected by this patch.
mysql-test/t/variables.test:
Test of max_sp_recursion_depth variable.
sql/item_func.cc:
sp_find_function() and sp_find_procedure() joined to sp_find_routine()
function as it was mentioned in TODO.
sql/mysqld.cc:
max_sp_recursion_depth variable added.
sql/set_var.cc:
max_sp_recursion_depth variable added.
sql/share/errmsg.txt:
An error message changed.
An error message added.
sql/sp.cc:
sp_find_function() and sp_find_procedure() joined to sp_find_routine()
function as it was mentioned in TODO.
Temory LEX is allocated on a stack, not on a heap.
Recursion support added for stored procedures.
sql/sp.h:
sp_find_function() and sp_find_procedure() joined to sp_find_routine()
function as it was mentioned in TODO.
sql/sp_head.cc:
Initialization of new sp_head fields to get correct list of instances
contained one instance only.
Stack requirement for SP instruction is increased.
Stack free space is checked before mem root initialisation to avoid
memory leak.
Pointer to the free instance management added before and after
SP execution.
sql/sp_head.h:
New sp_head variables added to support inst of instances of SP
for recursion and pointer on ths first free to use instance.
sql/sql_base.cc:
open_table() consume a lot of stack space so we check free stack space before it.
sql/sql_class.h:
max_sp_recursion_depth variable added.
sql/sql_parse.cc:
sp_find_function() and sp_find_procedure() joined to sp_find_routine()
function as it was mentioned in TODO.
password": additional fix, also make sure that a syntax error is
returned for set names="foo" when there is no such variable or no
stored procedure.
mysql-test/r/sp-error.result:
Test results fixed: a new test for Bug#13510
mysql-test/t/sp-error.test:
A new test for Bug#13510 (set names out of an SP)
sql/sql_yacc.yy:
Bug#13510: fix the case when there is no stored procedure or
no 'names' variable declared. Return a syntax error in this case.
which is now dropped" and bug #12329 "Bogus error msg when executing PS with
stored procedure after SP was re-created".
mysql-test/r/sp-error.result:
Added test for bug #12329 "Bogus error msg when executing PS with stored
procedure after SP was re-created".
mysql-test/r/trigger.result:
Added test for bug #13399 Crash when executing PS/SP which should activate
trigger which is now dropped".
mysql-test/t/sp-error.test:
Added test for bug #12329 "Bogus error msg when executing PS with stored
procedure after SP was re-created".
mysql-test/t/trigger.test:
Added test for bug #13399 Crash when executing PS/SP which should activate
trigger which is now dropped".
sql/sp_head.cc:
sp_head::add_used_tables_to_table_list():
We have to copy database/table names and alias to PS/SP memory since current
instance of sp_head object can pass away before next execution of PS/SP for
which tables are added to prelocking list.
This will be fixed by introducing of proper invalidation mechanism once new
TDC is ready.
The crash mentioned in original bug report is already prevented by one
of previous patches (fix for bug #13343 "CREATE|etc TRIGGER|VIEW|USER
don't commit the transaction (inconsistency)"), this patch only improve
error returning.
mysql-test/r/sp-error.result:
Test that statements which implicitly commit transaction
mysql-test/t/sp-error.test:
Test that statements which implicitly commit transaction
sql/sp_head.cc:
We set the new flag about commit/rollback statements presence
sql/sp_head.h:
The new flag about commit/rollback presence added
A comment fixed
sql/sql_yacc.yy:
Removed commit/rollback-statement-present errors spread by this file, only one check left which check flags of a SP
we changing current db temporarily and restore it when sp is created. however thd->db
in this case becomes empty string rather than NULL and so all checks of thd->db == NULL
will be false. So if after this we'll issue create procedure sp2()... without specifying
db it will succeed and create sp with db=NULL, which causes mysqldto crash on
show procedure status statement.
This patch fixes the problem.
mysql-test/r/sp-error.result:
Result for bug #14569.
mysql-test/t/sp-error.test:
Test for bug #14569.
sql/sql_db.cc:
Fixes bug #14569. When no db is selected as current and we do create procedure db.sp()...
we changing current db temporarily and restore it when sp is created. however thd->db
in this case becomes empty string rather than NULL and so all checks of thd->db == NULL
will be false. This patch fixes this issue.
sql/sql_parse.cc:
Fixes bug #14569. Reverted from initial patch to check thd->db for null values only.
mysql-test/r/sp-error.result:
Results for the test case for BUG#13037.
mysql-test/t/sp-error.test:
Test case for BUG#13037.
sql/sql_base.cc:
Polishing: use constant.
sql/sql_class.cc:
Reset THD::where in THD::cleanup_after_query();
Polishing: use the constant (THD::DEFAULT_WHERE).
sql/sql_class.h:
Introduce a constant for the default value of THD::where.
without database"
mysql-test/r/sp-error.result:
Test results fixed (a test case for Bug#13587)
mysql-test/t/sp-error.test:
A test case for Bug#13587 "Server crash when SP is created without
database"
sql/sql_parse.cc:
- move initialization of lex->sphead->m_db before it's used.
- cleanup; comment why right now can't be cleaned any more
Disallow conflicting use of variables named "password" and "names". If such
a variable is declared, and "SET ... = ..." is used for them, an error is
returned; the user must resolve the conflict by either using `var` (indicating
that the local variable is set) or by renaming the variable.
This is necessary since setting "password" and "names" are treated as special
cases by the parser.
mysql-test/r/sp-error.result:
New test cases for BUG#13510
mysql-test/t/sp-error.test:
New test cases for BUG#13510
sql/share/errmsg.txt:
New error message for when certain variable names are use which would be
parsed the wrong way. (E.g. "password" and "names")
sql/sql_yacc.yy:
Check if "names" or "password" are used as local variable/parameter, in which
case "set names" or "set password" will be parsed the wrong way. Give an error
message instead.
- Added functionality to check errors returned from mysql_next_result
- Exit from mysqltest when and unexpected error occurs.
- The above fixes reveal problems with rpl000009, sp-error and query_cache-
- Fix sp-error by adding an expected error
- Fix rpl000009 by not sending "ok" from mysql_create_db when called with silent flag from load_master_data
- Fix query_cache in separate patch
client/mysqltest.c:
Check and handle error after mysql_next_result
Change several verbose_msg to die so that the error is properly reported
Clean up of error handling code in run_query_stmt, check all errors and use common
function handle_error.
mysql-test/r/mysqltest.result:
mysqltest now dies when a query fails with wrong errno
mysql-test/r/sp-error.result:
Update test result to match the expected error from calling the sp closing a cursor that is not open.
mysql-test/t/sp-error.test:
Add missing --error 1326 before call to sp that closes a already closed cursor.
Add test for bug9367
sql/sql_db.cc:
Don't send ok in mysql_create_db if silent flag is set.
Second version after review. Allow 'set autocommit' in procedures, but not
functions or triggers. Can return error in run-time (when a function calls
a procedure).
mysql-test/r/sp-error.result:
New test case for BUG#12712.
mysql-test/t/sp-error.test:
New test case for BUG#12712.
sql/set_var.cc:
Made sys_autocommit external, to allow testing in sql_yacc.yy.
sql/set_var.h:
Made sys_autocommit external, to allow testing in sql_yacc.yy.
sql/share/errmsg.txt:
New error message for disallowing the setting of autocommit in stored functions and triggers.
sql/sp_head.h:
New flag: has 'set autocommit', and testing for this in is_not_allowed_in_function().
sql/sql_yacc.yy:
Disallow setting AUTOCOMMIT in stored function and triggers.
Any form of HANDLER statement is forbidden from usage in stored procedures/functions.
mysql-test/r/sp-error.result:
Results for the test case for Bug#12995 added.
mysql-test/t/sp-error.test:
Test case for Bug#12995 added.
sql/sql_yacc.yy:
Forbid any form of "HANDLER" statement from use in stored procedures/functions.
OPTIMIZE TABLE statement is forbidden from usage in stored procedures/functions.
NOTE: OPTIMIZE TABLE statement can be useful in stored procedures. The idea is
that the user/administrator can create a stored procedure for admin
tasks (optimizing, backing up, etc). This procedure can be scheduled to run
automatically (by mean of internal cron (WL#1034)). So, once we can make this
statement work, it is worth doing it.
mysql-test/r/sp-error.result:
Results for the test case for Bug#12953 added.
mysql-test/t/sp-error.test:
Test case for Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function" added.
sql/sql_yacc.yy:
Forbid "OPTIMIZE TABLE" statement from use in stored procedures/functions.
The idea of the patch is to separate statement processing logic,
such as parsing, validation of the parsed tree, execution and cleanup,
from global query processing logic, such as logging, resetting
priorities of a thread, resetting stored procedure cache, resetting
thread count of errors and warnings.
This makes PREPARE and EXECUTE behave similarly to the rest of SQL
statements and allows their use in stored procedures.
This patch contains a change in behaviour:
until recently for each SQL prepared statement command, 2 queries
were written to the general log, e.g.
[Query] prepare stmt from @stmt_text;
[Prepare] select * from t1 <-- contents of @stmt_text
The chagne was necessary to prevent [Prepare] commands from being written
to the general log when executing a stored procedure with Dynamic SQL.
We should consider whether the old behavior is preferrable and probably
restore it.
This patch refixes Bug#7115, Bug#10975 (partially), Bug#10605 (various bugs
in Dynamic SQL reported before it was disabled).
mysql-test/r/not_embedded_server.result:
Since we don't want to log Dynamic SQL in stored procedures,
now the general log gets only one log entry per SQL statement.
mysql-test/r/sp-error.result:
- remove obsolete tests
- a better error message for the case when a stored procedure that
returns a result set is called from a function
mysql-test/r/trigger.result:
- a better error message for the case when a stored procedure that
returns a result set is called from a trigger
mysql-test/t/sp-error.test:
- a better error message for the case when a stored procedure that
returns a result set is called from a function.
- move the comment to its place (end of file).
mysql-test/t/trigger.test:
- a better error message for the case when a stored procedure that
returns a result set is called from a trigger
sql/item_func.cc:
- we need to pass sql_command explicitly to get_var_with_binlog, because
when creating a query for SQL prepared statement thd->lex->sql_command
points at SQLCOM_EXECUTE, which is not listed in the list of update
queries.
sql/log_event.h:
- remove an extra copy of the previous sentence
sql/mysql_priv.h:
- fix declarations of sql_prepare.cc API
sql/share/errmsg.txt:
- a new error message, when one attempts to execute a prepared statement
which is currently being executed (this can happen only in Dynamic SQL
at the moment).
sql/sp_head.cc:
- extend sp_multi_results_command to return different flags for a
command (and rename it)
- add support for SQLCOM_PREPARE,SQLCOM_EXECUTE, SQLCOM_DEALLOCATE
to sp_get_flags_for_command
- replace multiple boolean sp_head members with uint m_flags
- a fix for a crash when user variables are used in a stored procedure
and binlog is on. A temporary fix for Bug#12637 "SP crashes the server
if it has update query with user var & binlog is enabled", which actually
stands for stored functions: now instead of a crash we break
replication if a user variable is used in a stored function which
is executed in prelocked mode.
sql/sp_head.h:
- replace multiple boolean flags of sp_head with uint m_flags;
- add flag CONTAINS_DYNAMIC_SQL
- use this flag to error if a stored procedure with Dynamic SQL is
called from a function or trigger.
sql/sql_class.cc:
- Statement_map::insert should not delete a statement if it exists,
now it's done externally to be able to handle the case when the
statement being deleted is in use.
- remove extra code (free_list is already reset in free_items)
sql/sql_lex.cc:
- add lex->stmt_prepare_mode; we can't rely on thd->command any more,
because we don't reset it any more (Dynamic SQL requirement is that
PS are as little intrusive as possible).
sql/sql_lex.h:
- declare bool LEX::stmt_prepare_mode
sql/sql_parse.cc:
- move prepared statement code to sql_prepare.cc
- change declarations (refactored code)
- better error message when one attempts to use Dynamic SQL or a
stored procedure that returns a result set in a function or trigger.
sql/sql_prepare.cc:
- major refactoring to ensure PREPARE/EXECUTE commands do not reset global THD
state and allow their use in stored procedures.
- add Prepared_statement::flags and use it to ensure no recursive execution
of a prepared statement is possible
- better comments
sql/sql_yacc.yy:
- enable PREPARE/EXECUTE/DEALLOCATE in stored procedures
- produce an error message on attempt to use PREPARE/EXECUTE/DEALLOCATE
in a stored function or trigger
mysql-test/r/sp-dynamic.result:
- sp-dynamic.test results
mysql-test/t/sp-dynamic.test:
- a new test for PREPARE/EXECUTE/DEALLOCATE in stored procedures.
(Packets out of order if calling HELP CONTENTS from Stored Procedure)
mysql-test/r/sp-error.result:
results of test of bug 12490
mysql-test/t/sp-error.test:
test for bug 12490
(Packets out of order if calling HELP CONTENTS from Stored Procedure)
sql/sql_yacc.yy:
disable HELP in SP
(fixes bug 12490)
If we are in stored function or trigger we should ensure that we won't change
table that is already used by calling statement (this can damage table or
easily cause infinite loops). Particularly this means that recursive triggers
should be disallowed.
mysql-test/r/sp-error.result:
Added tests checking that in functions we don't allow to update tables which
are used by statements which invoke these functions.
mysql-test/r/trigger.result:
Added test for bug #11896 "Partial locking in case of recursive trigger
definitions".
mysql-test/t/sp-error.test:
Added tests checking that in functions we don't allow to update tables which
are used by statements which invoke these functions.
mysql-test/t/trigger.test:
Added test for bug #11896 "Partial locking in case of recursive trigger
definitions".
sql/share/errmsg.txt:
Added error messages for complaining about situations when in function or
trigger we try to change table which is used in statement invoking this
function or trigger.
sql/sql_base.cc:
open_table():
If we are in stored function or trigger we should ensure that
we won't change table that is already used by calling statement
(this can damage table or easily cause infinite loops).
So if we are opening table for writing, we should check that it
is not already open by some calling stamement.
We should not allow FLUSH statement to be executed inside both triggers
and stored functions.
mysql-test/r/sp-error.result:
Updated test after replacing error, which is thrown when one uses FLUSH
statement inside of stored function, with more specific.
Also now we issue more general error when we barking about USE command
in stored routines.
mysql-test/r/trigger.result:
Added test for bug #12280 "Triggers: crash if flush tables"
mysql-test/t/sp-error.test:
Updated test after replacing error, which is thrown when one uses FLUSH
statement inside of stored function, with more specific.
Also now we issue more general error when we barking about USE command
in stored routines.
mysql-test/t/trigger.test:
Added test for bug #12280 "Triggers: crash if flush tables"
sql/share/errmsg.txt:
Removed ER_SP_NO_USE error. Now we use more general ER_SP_BADSTATEMENT in this
case. Instead added error message for barking about statements which should not
be allowed inside of stored functions or triggers.
It is safe to do this since it is highly unprobable that someone will upgrade
first to the new 5.0 release and then downgrade back to the old one.
sql/sql_parse.cc:
reload_acl_and_cache():
FLUSH TABLES and FLUSH PRIVILEGES should not be allowed if we are inside
of stored function or trigger.
sql/sql_yacc.yy:
We should not allow FLUSH statement inside both triggers and stored
functions. Replaced error which is thrown in this case with more
specific.
Also now we issue more general ER_SP_BADSTATEMENT error when one tries
to use USE command inside of stored routine.
into mysql.com:/home/dlenev/src/mysql-5.0-mysqlproc
mysql-test/r/sp-error.result:
Auto merged
mysql-test/t/sp-error.test:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sp.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/share/errmsg.txt:
Manual merge.
sql/sp.cc:
Manual merge.
of stored routines definitions even if we already have some tables open and
locked. To avoid deadlocks in this case we have to put certain restrictions
on locking of mysql.proc table.
This allows to use stored routines safely under LOCK TABLES without explicitly
mentioning mysql.proc in the list of locked tables. It also fixes bug #11554
"Server crashes on statement indirectly using non-cached function".
mysql-test/r/sp-error.result:
Added test which checks that now we can read stored routines definitions
under LOCK TABLES even if we have not locked mysql.proc explicitly. Also
added check for restrictions which this ability puts on mysql.proc locking.
Updated test for bug #9566 to correspond this new situation.
mysql-test/r/sp-threads.result:
Added test for bug #11554 "Server crashes on statement indirectly using
non-cached function".
mysql-test/t/sp-error.test:
Added test which checks that now we can read stored routines definitions
under LOCK TABLES even if we have not locked mysql.proc explicitly. Also
added check for restrictions which this ability puts on mysql.proc locking.
Updated test for bug #9566 to correspond this new situation.
mysql-test/t/sp-threads.test:
Added test for bug #11554 "Server crashes on statement indirectly using
non-cached function".
sql/lock.cc:
get_lock_data():
To be able to open and lock for reading system tables like 'mysql.proc',
when we already have some tables opened and locked, and avoid deadlocks
we have to disallow write-locking of these tables with any other tables.
sql/mysql_priv.h:
open_table() has new parameter which allows to open table even if some-one
has done a flush or holding namelock on it.
sql/share/errmsg.txt:
Added error message saying that one cannot write-lock some of system tables
with any other tables.
sql/sp.cc:
open_proc_table_for_read()/close_proc_table():
Added functions to be able open and close mysql.proc table when we already
have some tables open and locked.
open_proc_table_for_update():
Added function to simplify opening of mysql.proc for updates.
db_find_routine_aux()/db_find_routine()/db_update_routine()/...
Moved responsibility for opening mysql.proc table from db_find_routine_aux()
one level up, since this level knows better which type of table access for
reading of for update it needs.
sp_function_exists():
Removed unused function.
sql/sp.h:
sp_function_exists():
Removed unused function.
sql/sql_base.cc:
open_table():
Added new parameter which allows to open table even if some-one has done a
flush or holding namelock on it.
open_unireg_entry():
Mark 'mysql.proc' as a system table which has special restrictions on its
locking, but thanks to them can be open and locked even if we already have
some open and locked.
sql/sql_class.cc:
Moved THD members holding information about open and locked tables to separate
Open_tables_state class to be able to save/restore this state easier.
Added THD::push_open_tables_state()/pop_open_tables_state() methods for
saving/restoring this state.
sql/sql_class.h:
Moved THD members holding information about open and locked tables to separate
Open_tables_state class to be able to save/restore this state easier.
Added THD::push_open_tables_state()/pop_open_tables_state() methods for
saving/restoring this state.
sql/sql_lex.cc:
Removed LEX::proc_table member which was not really used.
sql/sql_lex.h:
Removed LEX::proc_table member which was not really used.
sql/sql_table.cc:
open_table() has new parameter which allows to open table even if some-one
has done a flush or holding namelock on it.
sql/table.h:
Added TABLE_SHARE::system_table indicating that this table is system table
like 'mysql.proc' and we want to be able to open and read-lock it even when
we already have some tables open and locked (and because of this we have
to put some restrictions on write locking it).
into mysql.com:/home/pem/work/mysql-5.0
mysql-test/r/sp-error.result:
Auto merged
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp-error.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
into mysql.com:/home/dlenev/src/mysql-5.0-bg8406
mysql-test/r/sp.result:
Auto merged
mysql-test/r/trigger.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
mysql-test/t/trigger.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_trigger.cc:
Auto merged
mysql-test/r/sp-error.result:
Manual merge.
mysql-test/t/sp-error.test:
Manual merge.
sql/sp_head.cc:
Manual merge.
sql/sql_yacc.yy:
Manual merge.
crash if referencing a table" and several other related bugs.
Fix for bug #11834 "Re-execution of prepared statement with dropped function
crashes server." which was spotted during work on previous bugs.
Also couple of nice cleanups:
- Replaced two separate hashes for stored routines used by statement with one.
- Now instead of doing one pass through all routines used in statement for
caching them and then doing another pass for adding their tables to table
list, we do only one pass during which do both things.
mysql-test/r/sp-error.result:
Added test for bug #11834 "Re-execution of prepared statement with dropped
function crashes server" also covering handling of prepared statements
which use stored functions but does not require prelocking.
mysql-test/r/sp.result:
Updated test for LOCK TABLES with views in table list.
(Old version of statement used in this test will work ok now, since prelocking
algorithm was tuned and will lock only one multi-set of tables for each routine
even if this routine is used in several different views).
mysql-test/r/trigger.result:
Added several tests for triggers using tables.
mysql-test/t/sp-error.test:
Added test for bug #11834 "Re-execution of prepared statement with dropped
function crashes server" also covering handling of prepared statements
which use stored functions but does not require prelocking.
mysql-test/t/sp.test:
Updated comment about recursive views to reflect current situation.
Updated test for LOCK TABLES with views in table list.
(Old version of statement used in this test will work ok now, since prelocking
algorithm was tuned and will lock only one multi-set of tables for each routine
even if this routine is used in several different views).
mysql-test/t/trigger.test:
Added several tests for triggers using tables.
sql/item_func.cc:
Item_func_sp::cleanup():
By next statement execution stored function can be dropped or altered so
we can't assume that sp_head object for it will be still valid.
sql/sp.cc:
- Added Sroutine_hash_entry structure that represents element in the set of
stored routines used by statement or routine. We can't as before use
LEX_STRING for this purprose because we want link all elements of this set
in list.
- Replaced sp_add_to_hash() with sp_add_used_routine() which takes into account
that now we use one hash for stored routines used by statement instead of two
and which mantains list linking all elelemnts in this hash.
- Renamed sp_merge_hash() to sp_update_sp_used_routines().
- Introduced sp_update_stmt_used_routines() for adding elements to the set of
routines used by statement from another similar set for statement or routine.
This function will also mantain list linking elements of destination set.
- Now instead of one sp_cache_routines() function we have family of
sp_cache_routines_and_add_tables() functions which are also responsible for
adding tables used by routines being cached to statement table list. Nice
optimization - thanks to list linking all elements in the hash of routines
used by statement we don't need to perform several iterations over this hash
(as it was before in cases when we have added new elements to it).
sql/sp.h:
Added declarations of functions used for manipulations with set (hash) of stored
routines used by statement.
sql/sp_head.cc:
sp_name::init_qname():
Now sp_name also holds key identifying routine in the set (hash) of
stored routines used by statement.
sp_head:
Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
routines used by this routine we use one hash - m_sroutines.
sp_instr_set_trigger_field:
Added support for subqueries in assignments to row accessors in triggers.
Removed definition of sp_add_sp_tables_to_table_list() and auxilary functions
since now we don't have separate stage on which we add tables used by routines
used by statement to table list for prelocking. We do it on the same stage as
we load those routines in SP cache. So all this functionality moved to
sp_cache_routines_and_add_tables() family of functions.
sql/sp_head.h:
sp_name:
Now this class also holds key identifying routine in the set (hash) of stored
routines used by statement.
sp_head:
Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
routines used by this routine we use one hash - m_sroutines.
sp_instr_set_trigger_field:
Added support for subqueries in assignments to row accessors in triggers.
Removed declaration of sp_add_sp_tables_to_table_list() since now we don't have
separate stage on which we add tables used by routines used by statement to
table list for prelocking. We do it on the same stage as we load those routines
in SP cache.
sql/sql_base.cc:
open_tables():
- LEX::spfuns/spprocs hashes were replaced with one LEX::sroutines hash.
- Now instead of doing one pass through all routines used in statement for
caching them and then doing another pass for adding their tables to table
list, we do only one pass during which do both things. It is easy to do
since all routines in the set of routines used by statement are linked in
the list. This also allows us to calculate table list for prelocking more
precisely.
- Now triggers properly inform prelocking algorithm about tables they use.
sql/sql_lex.cc:
lex_start():
Replaced LEX::spfuns/spprocs with with one LEX::sroutines hash.
Added LEX::sroutines_list list linking all elements in this hash.
st_lex::st_lex():
Moved definition of LEX constructor to sql_lex.cc file to be able
use sp_sroutine_key declaration from sp.h in it.
sql/sql_lex.h:
LEX:
Replaced two separate hashes for stored routines used by statement with one.
Added list linking all elements in this hash to be able to iterate through all
elements and add new elements to this hash at the same time.
Moved constructor definition to sql_lex.cc.
sql/sql_parse.cc:
mysql_execute_command():
Replaced LEX::spfuns/spprocs with one LEX::sroutines hash.
sql/sql_trigger.cc:
Added missing GNU GPL notice.
Table_triggers_list::check_n_load()
Added initialization of sroutines_key which stores key representing
triggers of this table in the set (hash) of routines used by this statement.
sql/sql_trigger.h:
Added missing GNU GPL notice.
Table_triggers_list:
Added sroutines_key member to store key representing triggers of this
table in the set (hash) of routines used by this statement.
Declared sp_cache_routines_and_add_tables_for_triggers() as friend since
it needs access to sroutines_key and trigger bodies.
sql/sql_yacc.yy:
- Now we use sp_add_used_routine() instead of sp_add_to_hash() for adding
elements to the set of stored routines used in statement.
- Enabled support of subqueries as right sides in assignments to triggers' row
accessors.
Two separate problems. A key buffer was too small in sp.cc for multi-byte
fields, and the creation and fixing of mysql.proc in the scripts hadn't been
updated with the correct character sets and collations (like the other
system tables had).
Note: No special test case, as the use of utf8 for mysql.proc will make
any existing crash (if the buffer overrrun wasn't fixed).
mysql-test/r/sp-error.result:
Updated test case for too long SP names (as the limit has increased with the use of utf8).
mysql-test/t/sp-error.test:
Updated test case for too long SP names (as the limit has increased with the use of utf8).
scripts/mysql_create_system_tables.sh:
Use utf8 for mysql.proc, just like for the other system tables.
scripts/mysql_fix_privilege_tables.sql:
Use utf8 for mysql.proc, just like for the other system tables.
(Some tabs also replaced by space)
sql/sp.cc:
Use a larger key buffer for stored procedures to avoid stack overrun with multi-byte keys.
into mysql.com:/home/dlenev/src/mysql-5.0-bg11394
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
mysql-test/r/sp-error.result:
Manual merge.
mysql-test/t/sp-error.test:
Manual merge.
sql/share/errmsg.txt:
Manual merge.
execution. Failure to do so caused the erroneous statements to send nothing
and hang the client.
mysql-test/r/sp-error.result:
Testcase for BUG#9814. Note that the result demonstrates that currently
mysql-test-run ignores errors in multi-statement if they arrive after first
resultset has been received.
mysql-test/t/sp-error.test:
Testcase for BUG#09814.
We want to have the defacto standard syntax for labels ("L:" instead of "label L;"),
and fix some known bugs, before we enable this again.
The code is left intact (#ifdef'ed SP_GOTO) and the test cases are kept in
sp-goto.test, for the future...
mysql-test/r/sp-error.result:
Moved all goto tests to sp-goto.test.
mysql-test/r/sp.result:
Moved all goto tests to sp-goto.test.
mysql-test/t/disabled.def:
Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
We keep the tests in sp-goto.test for the future, but disable for now.
mysql-test/t/sp-error.test:
Moved all goto tests to sp-goto.test.
mysql-test/t/sp.test:
Moved all goto tests to sp-goto.test.
sql/lex.h:
Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
sql/sql_yacc.yy:
Disabled GOTO/LABEL (until the label syntax and some bugs can be fixed).
"Stored procedures: crash with function calling itself".
Disallow recursive stored routines until we either make Item's and LEX
reentrant safe or will use spearate sp_head instances (and thus separate
LEX objects and Item trees) for each routine invocation.
mysql-test/r/sp-error.result:
Added tests for bug #11394 "Recursion in SP crash server" and
bug #11600 "Stored procedures: crash with function calling itself".
(We simply disallow recursion for stored routines).
mysql-test/r/sp.result:
Disabled test cases containing recursive stored routines until we will
support for them.
mysql-test/t/sp-error.test:
Added tests for bug #11394 "Recursion in SP crash server" and
bug #11600 "Stored procedures: crash with function calling itself".
(We simply disallow recursion for stored routines).
mysql-test/t/sp.test:
Disabled test cases containing recursive stored routines until we will
support for them.
sql/share/errmsg.txt:
Added error message saying that recursive stored routines are disallowed.
sql/sp_head.cc:
sp_head::execute():
Since many Item's and LEX members can't be used in reentrant fashion
we have to disable recursion for stored routines. So let us track
routine invocations using sp_head::m_is_invoked member and raise
error when one attempts to call routine recursively.
sql/sp_head.h:
sp_head:
Added m_is_invoked member for tracking of routine invocations and
preventing recursion.
This is to close Bug#10975, Bug#7115, Bug#10605
This feature will be implemented in a future release.
mysql-test/r/sp-error.result:
Test results fixed (test coverage for disabled Dynamic SQL in SP).
mysql-test/t/sp-error.test:
Test coverage to disable Dynamic SQL in stored routines.
sql/sql_yacc.yy:
Disable dynamic SQL in stored routines.
Return an error if default() is used on a local variable.
This is actaully a side-effect of BUG#5967: Stored procedure declared
variable used instead of column (to be fixed later), so this is really a
workaround until that is fixed.
mysql-test/r/sp-error.result:
New test case for BUG#10969.
mysql-test/t/sp-error.test:
New test case for BUG#10969.
sql/item.h:
Get name of local variable for error messages.
sql/sql_yacc.yy:
Return an error if default() is applied on a local SP variable.
during creation.
Although it returns an error, consistent with the behaviour for other objects.
(Unclear why we would allow the creation of SPs with truncated names.)
mysql-test/r/sp-error.result:
New test case for BUG#9529.
mysql-test/t/sp-error.test:
New test case for BUG#9529.
sql/sp.cc:
Check SP name length on creation (and drop).
sql/sp.h:
New status code for bad (too long) name.
sql/sql_parse.cc:
New status code for bad (too long) name.