Commit graph

101 commits

Author SHA1 Message Date
serg@serg.mylan
9c0a8bbd17 this has nothing to do with the bug#13012.
it's about mysql_admin_commands not being reexecution-safe
(and CHECK still isn't)
2005-12-03 15:02:09 +01:00
serg@serg.mylan
b3b72c6329 Bug#13012: REPAIR/BACKUP/RESTORE TABLE cause "packet out of order" in SP.
Mark them properly as result-returning statements
2005-12-02 22:59:45 +01:00
bell@sanja.is.com.ua
db8f03ebe8 Merge sanja.is.com.ua:/home/bell/mysql/bk/work-bug7-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-merge-5.0
2005-11-23 01:28:32 +02:00
bell@sanja.is.com.ua
7bd691f11e Recursion support made for SP (BUG#10100). 2005-11-23 01:11:19 +02:00
konstantin@mysql.com
86f1896fb0 Bug#13510 "Setting password local variable changes current
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.
2005-11-19 01:22:12 +03:00
dlenev@mysql.com
63fcccb193 Fix for bug #13399 Crash when executing PS/SP which should activate trigger
which is now dropped" and bug #12329 "Bogus error msg when executing PS with
stored procedure after SP was re-created".
2005-11-17 03:51:14 +03:00
bell@sanja.is.com.ua
a60a6b0f7f Issuing error about presence of commit/rollback statements in stored functions and triggers added to SP parsing procedure (BUG#13627)
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.
2005-11-16 14:09:06 +02:00
SergeyV@selena.
dbb29d11ee 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. 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.
2005-11-11 21:01:48 +03:00
anozdrin@mysql.com
831de41ca6 Fix for BUG#13037: undefined variable in IF cause erroneous error-message. 2005-10-25 13:02:48 +04:00
konstantin@mysql.com
bee76b78a2 A fix and a test case for Bug#13587 "Server crash when SP is created
without database"
2005-10-19 14:46:32 +04:00
pem@mysql.com
2456c0c668 Fixed BUG#13510: Setting password local variable changes current password
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.
2005-10-11 15:01:38 +02:00
msvensson@neptunus.(none)
0581a7f23c Bug #13231 mysqltest: fails to dectect when mysql_next_result fails
- 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
2005-09-21 15:28:28 +02:00
pem@mysql.com
f31095f3d5 Fixed BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
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).
2005-09-13 17:16:12 +02:00
anozdrin@mysql.com
c1e570a441 Fix for Bug#12995: Inside function "Table 't4' was not locked with LOCK TABLES"
Any form of HANDLER statement is forbidden from usage in stored procedures/functions.
2005-09-07 23:03:56 +04:00
anozdrin@mysql.com
b291090612 Fix for Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function"
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.
2005-09-06 21:43:06 +04:00
konstantin@mysql.com
38486e83c1 Implement WL#2661 "Prepared Statements: Dynamic SQL in Stored Procedures".
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).
2005-09-03 03:13:18 +04:00
andrey@lmy004.
ed0bac2116 fix for bug #12490 (all-in-one patch)
(Packets out of order if calling HELP CONTENTS from Stored Procedure)
2005-08-29 12:19:08 +02:00
dlenev@mysql.com
6c39364f85 Fix for bug #11896 "Partial locking in case of recursive trigger definitions".
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.
2005-08-18 19:07:23 +04:00
dlenev@mysql.com
51537c057d Fix for bug #12280 "Triggers: crash if flush tables".
We should not allow FLUSH statement to be executed inside both triggers
and stored functions.
2005-08-10 10:31:32 +04:00
dlenev@mysql.com
8a28d604f5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-mysqlproc
2005-07-13 15:08:13 +04:00
dlenev@mysql.com
f334ea1fc6 Implementation of Monty's idea: Now we can open mysql.proc table for lookup
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".
2005-07-13 13:48:13 +04:00
pem@mysql.com
6f54e27e5e Merge mysql.com:/usr/local/bk/mysql-5.0
into  mysql.com:/home/pem/work/mysql-5.0
2005-07-11 12:46:42 +02:00
dlenev@mysql.com
75b8d4fa08 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg8406
2005-07-09 22:04:18 +04:00
dlenev@mysql.com
923fe817e0 Enable support of access to tables from triggers. Thus fix bug #8406 "Triggers
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.
2005-07-09 21:51:59 +04:00
pem@mysql.com
5ce9198f20 Fixed BUG#11365: Stored Procedure: Crash on Procedure operation
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).
2005-07-08 16:33:15 +02:00
dlenev@mysql.com
8a924ac456 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg11394
2005-07-06 10:21:27 +04:00
sergefp@mysql.com
4a90f7d04f Fix for BUG#9814: Clear thd->net.no_send_error before each SP instruction
execution. Failure to do so caused the erroneous statements to send nothing
and hang the client.
2005-07-04 23:00:23 +00:00
pem@mysql.com
481bb717d7 Disabled the GOTO feature. (It's non-standard and undocumented.)
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...
2005-07-01 15:25:51 +02:00
dlenev@brandersnatch.localdomain
56ff9f1653 "Fix" for bug #11394 "Recursion in SP crash server" and bug #11600
"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.
2005-07-01 13:01:46 +04:00
konstantin@mysql.com
9b2e653af0 Disable dynamic SQL in stored routines.
This is to close Bug#10975, Bug#7115, Bug#10605 
This feature will be implemented in a future release.
2005-06-09 01:46:30 +04:00
pem@mysql.comhem.se
5afef58364 Fixed BUG#10969: Stored procedures: crash if default() function
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.
2005-06-01 15:42:40 +02:00
pem@mysql.comhem.se
76073d7bf5 Fixed BUG#9529: Stored Procedures: No Warning on truncation of procedure name
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.)
2005-05-31 18:36:32 +02:00
pem@mysql.comhem.se
4c49970e0f Fixed BUG#8409: Stored procedure crash if function contains FLUSH
by simply disabling FLUSH for stored functions. (I can't really work.)
2005-05-27 16:19:25 +02:00
pem@mysql.comhem.se
4c69f7fb4e Fixed BUG#10537: Server crashes while loading data file into table through
procedure.
  by simply disabling 'load' in stored procedures, like it's already disabled
  for prepared statements. (They must be made "re-execution" safe before
  working with either PS or SP.)
2005-05-20 17:47:08 +02:00
pem@mysql.comhem.se
f769a7a8b0 Post-review fixes of the patch for BUG#8408: Stored procedure crash if function contains SHOW
(Review on irc by monty)
2005-04-27 16:35:49 +02:00
pem@mysql.comhem.se
281c0a8130 Fixed BUG#8408: Stored procedure crash if function contains SHOW
We simply have to disallow any kind of result set being sent back
  from a function. Can't see any way to make that to work.
2005-04-26 17:31:59 +02:00
pem@mysql.comhem.se
54dfe4a66a Fixed BUG#7047: Stored procedure crash if alter procedure
by simply disallowing alter procedure/function in an SP (as for drop).
2005-04-20 17:59:28 +02:00
pem@mysql.comhem.se
6aad6835c6 Fixed BUG#9598: stored procedure call within stored procedure
overwrites IN variable
  and added error checking of variables for [IN]OUT parameters while
  rewriting the out parameter handling.
2005-04-14 14:52:35 +02:00
pem@mysql.comhem.se
2038ced40c Fixed BUG#9073: Able to declare two handlers for same condition in same scope 2005-04-08 19:58:04 +02:00
pem@mysql.comhem.se
e99da54fd5 Fixed BUG#7299: Stored procedures: exception handler catches not-found conditions 2005-04-08 16:05:16 +02:00
dlenev@brandersnatch.localdomain
8d05aa0f02 Moved test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal
state" to sp-error.test.

According to Per-Erik all SP related tests which should result in error
should go into sp-error.test and not in sp.test, because we want to be
able to run sp.test using normal client.
2005-04-07 11:57:47 +04:00
pem@mysql.comhem.se
8df8afc270 Fixed BUG#6600: Stored procedure crash after repeated calls with check table.
Sedond attempt: Simply disallow CHECK in SPs, since it can't work.
2005-03-30 17:43:52 +02:00
pem@mysql.comhem.se
54a2448bce Fixed BUG#8760: Stored Procedures: Invalid SQLSTATE is allowed in
a DECLARE ? HANDLER FOR stmt.
2005-02-28 18:07:06 +01:00
pem@mysql.comhem.se
2c26ebe359 WL#2130: Table locking for stored FUNCTIONs
Collect all tables and SPs refered by a statement, and open all tables
with an implicit LOCK TABLES. Do find things refered by triggers and views,
we open them first (and then repeat this until nothing new is found), before
doing the actual lock tables.
2005-02-08 20:52:50 +01:00
jimw@mysql.com
98d7964d2a Fix 'SHOW CREATE FUNCTION' to say 'FUNCTION' in its error message. (Bug #6338) 2005-01-03 19:53:54 +01:00
pem@mysql.comhem.se
a1e0e96e2d Fixed BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
...and for PURGE BEFORE too. (Don't fix_fields in the parser!)
2004-11-25 16:13:06 +01:00
pem@mysql.comhem.se
2c428ca09d Fixed BUG#6030: Stored procedure has no appropriate DROP privilege.
...and no ALTER privilege either.
  For now, only the definer and root can drop or alter an SP.
2004-10-22 20:29:06 +02:00
pem@mysql.comhem.se
ebf8dc0da6 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.
2004-10-22 19:05:17 +02:00
pem@mysql.comhem.se
8b1a6d377f Revised BUG#5000: SPs can be created with no default database.
Now simply give an error if no database. (The "global SP feature" will be
done using PATH instead.)
2004-10-07 15:32:36 +02:00
pem@mysql.comhem.se
624cf0e537 Fixed BUG#3294: Stored procedure crash if table dropped before use.
Dropping the table was not the real problem, the problem was with errors
  occuring within error handlers.
2004-09-10 11:11:52 +02:00