Commit graph

200 commits

Author SHA1 Message Date
konstantin@mysql.com
887fba4736 A fix and a test case for "Bug #12168 'DECLARE CONTINUE HANDLER FOR
NOT FOUND ...' in conditional handled incorrectly".

Whenever we remove an instruction during optimization, we need to
adjust instruction numbers (ip - instruction pointer) stored in all
instructions. In addition to that, sp_instr_hpush_jump, which 
corresponds to DECLARE CONTINUE HANDLER needs adjustment for m_handler,
which holds the number of instruction with the continue handler.
In the bug report, a wrong ip stored in m_handler was pointing at 
FETCH, which resulted in an error message and abnormal SP termination.
The fix is to just remove m_handler member from sp_instr_hpush_jump,
as it's always points to the instruction next to the DECLARE
statement itself (m_ip+1).
2005-08-19 17:03:21 +04:00
petr@mysql.com
4fb6f4dddf Fix for Bug#11247 Stored procedures: Function calls in long loops leak memory
and Bug#12297 SP crashes the server if data inserted inside a lon loop
Third commit attempt. With fixes to the issues, showed up after full rebuild and
tests on other hosts.
2005-08-18 11:23:54 +02:00
dlenev@mysql.com
0c38d33507 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-is
2005-08-09 11:43:55 +04:00
dlenev@mysql.com
615baa9f23 Fix for bug #10055 "Using stored function with information_schema causes empty
result set".

To enable full access to contents of I_S tables from stored functions
or statements that use them, we manipulate with thread's open tables
state and ensure that we won't cause deadlock when we open tables by
ignoring flushes and name-locks.
Building of contents of I_S.TABLES no longer requires locking of tables
since we use use handler::info() method with HA_STATUS_AUTO flag instead
of handler::update_auto_increment() for obtaining information about
auto-increment values. But this also means that handlers have to implement
support for HA_STATUS_AUTO flag (particularly InnoDB needs it).
2005-08-08 17:46:06 +04:00
sergefp@mysql.com
f595847ec0 Manual merge 2005-08-03 03:47:07 +00:00
sergefp@mysql.com
b6a6fe0849 Prelocking-free SPs, post-review fixes:
* Don't activate prelocking mode for evaluating procedure arguments when it is not necessary.
* Code structure simplification and cleanup.
* Cleanup in .test files
2005-08-03 03:37:32 +00:00
sergefp@mysql.com
de02193bdd Added Non-prelocked SP execution: Now a PROCEDURE doesn't enter/leave prelocked mode for
its body, but lets each statement to get/release its own locks. This allows a broader set
of statements to be executed inside PROCEDUREs (but breaks replication)
This patch should fix BUG#8072, BUG#8766, BUG#9563, BUG#11126
2005-07-30 08:19:57 +00:00
bell@sanja.is.com.ua
36f250a240 Added sql_mode saving to mysql_dump (BUG#5891, part 2) 2005-07-29 23:39:08 +03:00
georg@lmy002.wdf.sap.corp
59ddf61392 fix for bug#8692 2005-07-22 08:11:23 +02:00
konstantin@mysql.com
8b0adacbc6 After-merge fixes (4.1 -> 5.0). 2005-07-16 16:10:42 +04:00
pem@mysql.com
d503283863 Post-review fix: Made test bug9538 test robust. 2005-07-15 19:46:44 +02:00
pem@mysql.com
7d7f34cf1c Fixed BUG#9538: SProc: Creation fails if we try to SET system variable
using @@var_name in proc
  Made sure we don't lose the tokenizer state when swapping lex in during SET
  parsing.
2005-07-15 17:24:19 +02:00
dlenev@mysql.com
2564656307 Added test case for bug #9565 "Wrong locking in stored procedure if a
sub-sequent procedure is called" which was fixed by the same patch
as bug #9597 "read lock stays when querying view from stored procedure".
2005-07-15 13:34:48 +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
312ea035ba Merge mysql.com:/usr/local/bk/mysql-5.0
into  mysql.com:/home/pem/work/mysql-5.0
2005-07-07 09:13:49 +02:00
pem@mysql.com
fb7b1c0e36 Updated sp.result 2005-07-06 16:56:38 +02:00
pem@mysql.com
18d6dd56ef Fixed BUG#7088: Stored procedures: labels won't work if character set is utf8.
We used 'IDENT' for labels as a temporary fix for the  parser conflicts
  introduced if the proper rule 'ident' was used. Now a specially tailored
  'label_ident' rule is used for labels instead.
2005-07-06 16:37:57 +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
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
pem@mysql.comhem.se
fda325b943 Fixed BUG#11529: crash server after use stored procedure
Make sure to cleanup the items for a cursor query after each open, otherwise
it's done too late, after the run-time mem_root is freed.
2005-06-30 18:07:06 +02:00
bell@sanja.is.com.ua
a05e50e29e fixed items cleunup for SP (BUG#10136) 2005-06-22 00:17:08 +03:00
pem@mysql.com
b42bf3cc55 Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
2005-06-10 16:56:34 +02:00
pem@mysql.comhem.se
46619fa0e3 Post review and additional fix for BUG#10968: Stored procedures: crash if long loop.
Fixed valgrind complaints. This fixes the memory leak problems for
  procedured, and partially for functions. There's still a leak involving
  results from functions that turned out to be too involved, so it will be
  fixed separately.
2005-06-10 16:14:01 +02:00
igor@rurik.mysql.com
f2405d71eb sp.test, sp.result:
Added a test case for bug #6866.
sql_select.cc:
  Fixed bug #6866.
  Bug was due to the fact that on_expr was not backed up
  for the second execution of the stored procedure.
2005-06-06 06:05:11 -07:00
pem@mysql.comhem.se
85f19d5da5 Fixed BUG#10961: Stored procedures: crash if select * from dual
Have to catch errors from SELECT when opening a cursor.
2005-06-01 12:18:41 +02:00
pem@mysql.comhem.se
fcb3b0326e Fixed BUG#9559: Functions: Numeric Operations using -ve value gives incorrect
results.
  Actually a problem when converting decimal to int for user variables.
2005-05-27 14:48:33 +02:00
bell@book.sanja.is.com.ua
4c984c7cc6 merge 2005-05-09 02:06:18 +03:00
bell@book.sanja.is.com.ua
91dccaa36f Item::fix_field need correct pointer on item reference to chnge it if itis need, so support of correct item address added to SP commands (BUG#5963)
some optimisation of IF/NOT IF ptomised to Pem
2005-05-09 01:59:10 +03:00
joerg@trift-lap.fambruehe
84af50133b Corrections to test "sp", stored procedure "fib" (see entry 9937 in the bug DB). 2005-05-07 18:06:02 +02:00
dlenev@mysql.com
917cb3dfbc Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/dlenev/src/mysql-5.0-bg9841
2005-05-06 11:18:37 +04:00
holyfoot@hf-ibm.(none)
8f3647005c Tests and results fixed with last precision/decimal related modifications 2005-05-06 01:01:39 +05:00
dlenev@brandersnatch.localdomain
d60674d665 Fix for bug #9841 "Unexpected read lock when trying to update a view in
a stored procedure" (version 2).

To handle updates and inserts into view in SP properly we should set
lock types for tables of the view's main select when we are opening
view for prelocking purproses.
2005-05-05 19:49:15 +04:00
jimw@mysql.com
300a9920ed Add regression test for calling SOUNDEX() within stored procedure.
The bug appears to have already been fixed. (Bug #7293)
2005-04-28 14:46:54 -07:00
pem@mysql.comhem.se
057b8aa9a8 Fixed BUG#9004: Inconsistent behaviour of SP re. warnings 2005-04-22 12:53:48 +02:00
acurtis@xiphis.org
c5d94db336 Merge 2005-04-21 13:34:39 +01:00
acurtis@xiphis.org
f67507588f Bug#8861 - If Return is a YEAR data type, value is not shown in year format
Bug partially fixed by 9775/9102 work on SP function return.
2005-04-21 13:22:47 +01:00
acurtis@xiphis.org
8689083aca Bug#9775 - Stored procedures: crash if create function that returns enum or set
Fix bug and implement return type casting.
2005-04-20 18:08:42 +01:00
pem@mysql.comhem.se
189d6b502b Fixed BUG#6898: Stored procedure crash if GOTO statements exist
Bug in the optimizer caused an infinite loop for weird code.
2005-04-20 15:37:07 +02:00
acurtis@xiphis.org
77a9429c13 Bug#7648 - Stored procedure crash when invoking a function that returns a bit
bugfix 9102 corrected the crashing, this corrects the result.
2005-04-19 10:51:11 +01:00
acurtis@xiphis.org
f638e5cb8f Bug#9102 - Stored proccedures: function which returns blob causes crash
Initialization of fields for sp return type was not complete.
2005-04-19 09:09:25 +01:00
pem@mysql.comhem.se
da22f75b68 Fixed BUG#9902: Crash with simple stored function using user defined variables
... actually, it was a query cache problem. (It shouldn't cache such queries)
2005-04-15 11:06:25 +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
7a4f495f5b Fixed BUG#9674: Stored Procs: Using declared vars in algebric operation
causes system crash.
2005-04-13 17:43:53 +02:00
pem@mysql.comhem.se
387afb3d29 Fixed BUG#9856: Stored procedures: crash if handler for sqlexception, not found. 2005-04-13 16:57:49 +02:00
pem@mysql.comhem.se
6a46d0cd8a Added test case for BUG#6129: Stored procedure won't display @@sql_mode value. 2005-04-13 16:09:28 +02:00
pem@mysql.comhem.se
9c21006f81 Fixed BUG#7185: Stored procedure crash if identifier is AVG 2005-04-12 15:43:24 +02:00
pem@mysql.comhem.se
ce2e40ac19 Fixed BUG#6900: Stored procedure inner handler ignored
and BUG#9074: STORED PROC: The scope of every handler declared is not properly applied
2005-04-08 17:31:37 +02:00