Commit graph

52 commits

Author SHA1 Message Date
msvensson@neptunus.(none)
88c96026af Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/bug10466
2005-06-27 13:12:10 +02:00
dlenev@mysql.com
e28264d29f Manual merge of patch for bug#11060 "Server crashes on calling stored
procedure with INSERT SELECT UNION SELECT" aka "Server crashes on
re-execution of prepared INSERT ... SELECT with UNION" into 5.0 tree.
2005-06-20 16:58:02 +04:00
dlenev@brandersnatch.localdomain
d07843efd9 Fix for bug #11060 "Server crashes on re-execution of prepared
INSERT ... SELECT with UNION" (reviewed version).

Altough bug manifest itself only starting from 5.0 it is better to
apply fix to 4.1 to keep some assumptions true and make code more
future-proof.
2005-06-20 16:07:00 +04:00
msvensson@neptunus.(none)
6282d89b0a bug#10466: Datatype "timestamp" displays "YYYYMMDDHHMMSS" irrespective of display sizes.
- Print warning that says display width is not supported for datatype TIMESTAMP, if user tries to create a TIMESTAMP column with display width.
 - Use display width for TIMESTAMP only in type_timestamp test to make sure warning is displayed correctly.
2005-06-20 12:09:00 +02:00
konstantin@mysql.com
9f379d7f05 Patch two (the final one) for Bug#7306 "the server side preparedStatement
error for LIMIT placeholder".
The patch adds grammar support for LIMIT ?, ? and changes the
type of ST_SELECT_LEX::select_limit,offset_limit from ha_rows to Item*,
so that it can point to Item_param.
2005-06-07 14:11:36 +04:00
monty@mysql.com
7d70579917 Fixed failing tests for not 32 bit intel machines
Fixed bug in mysql_stmt_fetch() when retrieving rows to return
2005-05-16 13:34:23 +03:00
konstantin@mysql.com
ca9aeb5707 Post merge fixes (merge of Bug#9777) 2005-05-05 16:31:18 +04:00
konstantin@mysql.com
753959cd88 Manual merge 2005-05-05 13:47:09 +04:00
konstantin@mysql.com
15dbab1c12 A fix and test case for Bug#9777 " Empty set returned by Prepared Statement when it
should return a non empty one"
(see comments for the changed files for details).
2005-05-05 12:55:09 +04:00
konstantin@mysql.com
92e4e1a3f8 Manual merge of Bug#9096 2005-05-03 19:32:29 +04:00
konstantin@mysql.com
3589e78fda A fix and test case for Bug#9096 "select doesn't return all matched
records if prepared statements is used".
This fix changes equality evaluation method of basic constants from
by-name to by-value, thus effectively enabling use of parameter markers
in some optimizations (constants propagation, evaluation of possible
keys for query).
2005-05-03 12:47:27 +04:00
konstantin@mysql.com
ced4317774 Allow SQLCOM_CALL in prepared mode. 2005-04-13 12:36:15 -07:00
gluh@eagle.intranet.mysql.r18.ru
6c8624f6d5 Fix for bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement
restore original 'lex->query_tables' table list after
   processing of information schema table
   remove unnecessary operations
2005-04-05 16:09:56 +05:00
konstantin@mysql.com
fe2d63a060 Fixes for bug#8115 "Server Crash with prepared statement"
and bug#8849 "problem with insert statement with table alias's": 
make equality propagation work in stored procedures and prepared 
statements.
Equality propagation can change AND/OR structure of ON expressions,
so the fix is to provide each execution of PS/SP with it's own
copy of AND/OR tree. We have been doing that already for WHERE clauses,
now ON clauses are also copied.
2005-03-03 17:38:59 +03:00
ramil@mysql.com
de1153b5e6 manual merge 2005-03-03 14:29:37 +04:00
ramil@mysql.com
89a105abc5 a fix for --ps-protocol (bug #6089: FOUND_ROWS returns wrong values when no table/view is used) 2005-03-02 20:00:48 +04:00
monty@mishka.local
4f4bbfc279 Merge with 4.1 2004-12-22 13:54:39 +02:00
konstantin@mysql.com
356005efd7 A fix and test case for Bug#6873 "PS, having with subquery, crash
during execute"
2004-12-09 00:37:17 +03:00
monty@mysql.com
d1a666d59a Cleanups during review stage
Added auto-correct of field length for enum/set tables for ALTER TABLE
This is becasue of a bug in previous MySQL 4.1 versions where the length for enum/set was set incorrectly after ALTER TABLE
2004-12-02 14:43:51 +02:00
serg@serg.mylan
ee933cd198 merged 2004-11-22 21:33:15 +01:00
konstantin@mysql.com
6337ea8a40 A fix and test case for Bug#6297 "prepared statement, wrong handling
of <parameter> IS NULL":
we must not only set Item::null_value in Item_param, but implement
Item_param::is_null() to work well with IS NULL/IS NOT NULL clauses.
2004-11-21 12:04:27 +03:00
monty@mysql.com
87af3d9113 merge on pull 2004-11-09 04:06:44 +02:00
konstantin@mysql.com
fe5889dee5 A fix and test case for Bug#6102 "Server crash with prepared statement
and blank after function name".
Crop fruits of copy-paste programming: pre-caching of stored functions
wasn't performed for prepared statements just because implementation
of prepared statements is done as an add-on to the main execution flow, 
and the preload was originally implemented for main execution branch
only (mysql_execute_command).
2004-11-05 22:02:07 +03:00
bar@mysql.com
ae5c3ae0ba ps.result, ctype_ucs.result, ctype_ucs.test, ps.test:
Bug #6351 make test failure "Unknown character set"
  UCS2 related tests were moved into ctype_ucs.
2004-11-05 10:12:33 +04:00
monty@mysql.com
8b6839e644 Fixed wrong range test code for HEAP tables. This caused a crash when doing a range test with a key that didn't have lower or upper bound (Bug #6082)
More test cases
2004-10-23 03:30:27 +03:00
konstantin@mysql.com
659de73248 Manual merge 2004-10-22 22:55:49 +04:00
konstantin@mysql.com
e3abcb6b53 A fix and test case for Bug#6088 "FOUND_ROWS returns wrong values for
prepared statements when LIMIT is used" and post-review comments.
The fix changes the approach we calculate the need for ORDER BY 
in UNION: the previous was not PS friendly, as it damaged SELECT_LEX 
options in case of single select.
2004-10-22 22:51:16 +04:00
monty@mysql.com
3afecef4df Fix compiler warnings (detected by Intel's C++ compiler)
Fixed checking of privilege handling in CREATE ... SELECT (Bug #6094)
2004-10-22 18:44:51 +03:00
konstantin@mysql.com
a7c52d755b A fix and test case for Bug#6050 "EXECUTE stmt reports ambiguous field
names with ident. tables fr. diff. schemata": revise all uses of
Item_field and make them prepared-statements friendly when necessary.
2004-10-22 14:47:35 +04:00
konstantin@mysql.com
5abc3de22b A fix and test case for Bug#5985 ""prepare stmt from "select rand(?)"
crashes server." The fix makes Item_func_rand prepared-statements
aware plus it fixes the case when RAND is used in prepared
statements and replication is on (as well as several similar issues).
Until now we did not reset THD before every execution of a prepared
statement, so if some execution had set thd->time_zone_used
or thd->rand_used they would not be reset until next mysql_parse.
Some of post-review fixes done.
2004-10-14 02:53:59 +04:00
konstantin@mysql.com
cc57252bb7 ps.test, ps.result: a test case for Bug#6042 "constants
propogation works only once (prepared statements)".
2004-10-12 21:16:07 +04:00
konstantin@mysql.com
daa4c2495c A fix and test case for Bug#5987 "subselect in bool function
crashes server (prepared statements)": the bug was that all boolean
items always recovered its original arguments at statement cleanup 
stage.
This collided with Item_subselect::select_transformer, which tries to 
permanently change the item tree to use a transformed subselect instead of
original one.
So we had this call sequence for prepare:
mysql_stmt_prepare -> JOIN::prepare -> 
Item_subselect::fix_fields -> the item tree gets transformed ->
Item_bool_rowready_func2::cleanup, item tree is recovered to original
state, while it shouldn't have been;
mysql_stmt_execute -> attempts to execute a broken tree -> crash.
Now instead of bluntly recovering all arguments of bool functions in 
Item_bool_rowready_func2::cleanup, we recover only those
which were changed, and do it in one place.
There still would exist a possibility for a collision with subselect
tranformation, if permanent and temporary changes were performed at the 
same stage.
But fortunately subselect transformation is always done first, so it 
doesn't conflict with the optimization done by propogate_cond_constants.
Now we have: 
mysql_stmt_prepare -> JOIN::prepare -> subselect transformation 
permanently changes the tree -> cleanup doesn't recover anything, 
because nothing was registered for recovery.
mysql_stmt_execute -> JOIN::prepare (the tree is already transformed, 
so it doesn't change), JOIN::optimize -> 
propogate_cond_constants -> temporary changes the item tree 
with constants -> JOIN::execute -> cleanup -> 
the changes done by propogate_cond_constants are recovered, as
they were registered for recovery.
2004-10-10 02:39:22 +04:00
konstantin@mysql.com
2aa7ec0d9d A fix for Bug#5748 "Prepared statement with BETWEEN and bigint values
crashes mysqld": implementation for a generic item tree modifications
registry. Every item tree modification which should be rolled back for
subsequent execution of a prepared statement or stored procedure should
be saved in the registry. All such modifications are rolled back at once
during cleanup stage of PS.
Actual fix for the bug just adds a call to register modifications to
convert_constant_item.
Post review fixes implemented.
2004-10-08 02:21:19 +04:00
konstantin@mysql.com
aa80184072 A fix and test case for bug#5688 "Upgraded 4.1.5 Server seg faults" 2004-09-23 18:01:55 +04:00
konstantin@mysql.com
4230eae857 A fix and test case for bug#5510 "inserting Null in AutoIncrement primary
key Column Fails".
2004-09-18 01:10:09 +04:00
konstantin@mysql.com
2fd2846f55 A quick fix for bug#5556: replace a column of SHOW TABLE STATUS result
with a fixed constant to pass on QNX:
max_data_file_length is calculated depending on max possible value of
record pointer. It's different on QNX, so the difference in results is OK.
2004-09-16 22:13:24 +04:00
konstantin@mysql.com
bdec2c603b A fix for bug#4368 '"like" fails in PreparedStatement, crashes
server': the bug occurs when arguments of LIKE function are in 
differentcharacter sets. If these character sets are compatible, 
we create an item-converter. In prepared mode, this item
needs to be created in memory of current prepared statement.
2004-09-03 23:28:49 +04:00
sergefp@mysql.com
3dfbc35f45 Fix for BUG#5242: Made SQL Syntax Prepared Statement names case-insensitive. 2004-08-29 19:44:28 +04:00
konstantin@mysql.com
ae18dc3ec8 Fix for Bug#5034 "prepared "select 1 into @arg15", second
execute crashes server": we were deleting lex->result
after each execute, but prepared statements assumed that
it's left intact.
The fix adds cleanup() method to select_result hierarchy,
so that result objects can be reused.
Plus we now need to delete result objects more wisely.
2004-08-24 20:17:11 +04:00
konstantin@mysql.com
568c6e8526 Fix for bug#4912 "mysqld crashs in case a statement is executed
a second time". The bug was caused by incompatibility of
negations elimination algorithm and PS: during first statement 
execute a subtree with negation was replaced with equivalent 
subtree without NOTs.
The problem was that although this transformation was permanent, 
items of the new subtree were created in execute-local memory.
The patch adds means to check if it is the first execute of a
prepared statement, and if this is the case, to allocate items
in memory of the prepared statement.
The implementation:
- backports Item_arena from 5.0
- adds Item_arena::is_stmt_prepare(), 
  Item_arena::is_first_stmt_execute().
- deletes THD::allocate_temporary_pool_for_ps_preparing(),
  THD::free_temporary_pool_for_ps_preparing(); they
  were redundant.
and adds a few invariants:
- thd->free_list never contains junk (= freed items)
- thd->current_arena is never null. If there is no
  prepared statement, it points at the thd. 
The rest of the patch contains mainly mechanical changes and
cleanups.
2004-08-21 02:02:46 +04:00
serg@serg.mylan
3236093b8b removed using lex->select_lex.options is SHOW TABLE [STATUS] commands (BUG#4288) 2004-06-27 00:34:05 +02:00
serg@serg.mylan
a5c8b3ee59 correct eq() method for Item_param (BUG#4233) 2004-06-26 23:55:38 +02:00
bell@sanja.is.com.ua
45411ca0b5 merge 2004-06-25 18:33:31 +03:00
bell@sanja.is.com.ua
74b01ca387 type of parameter assignment for parameters from variables added (BUG#4280) 2004-06-25 15:16:00 +03:00
bell@sanja.is.com.ua
4092635155 fixed EXPLAIN behaviour with prepared statements (BUG#4271) 2004-06-25 11:37:43 +03:00
pem@mysql.comhem.se
34ddd9c515 Fixed BUG#3486: FOUND_ROWS() fails inside stored procedure [and prepared statement]. 2004-06-22 19:38:07 +02:00
konstantin@mysql.com
7bbdb8408b Fix for bug#4105 "Server crash on attempt to prepare a statement with
character set introducer": add new item type to be returned before from 
Item_param until it's value is set.
This way items like Item_bool_func2 and udf_handler won't treat this item
as constant literal when statement is prepared.
2004-06-18 04:16:08 +04:00
sergefp@mysql.com
fb17025b3e WL#1622 "SQL Syntax for Prepared Statements": Post-review fixes (1 of 2) 2004-05-21 04:27:50 +04:00
sergefp@mysql.com
7084c77651 Added a test for a problem that was fixed by automerge and fixed a typo. 2004-05-07 03:32:51 +04:00
sergefp@mysql.com
9a4acccd05 WL#1622 "SQL Syntax for Prepared Statements" - cosmetic code review fixes 2004-04-30 20:08:38 +04:00