into mysql.com:/home/svoj/devel/mysql/BUG26881/mysql-5.0-engines
myisam/mi_create.c:
Auto merged
mysql-test/t/merge.test:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/sql_parse.cc:
Use local.
mysql-test/r/merge.result:
SCCS merged
differences in tables
Certain merge tables were wrongly reported as having incorrect definition:
- Some fields that are 1 byte long (e.g. TINYINT, CHAR(1)), might
be internally casted (in certain cases) to a different type on a
storage engine layer. (affects 4.1 and up)
- If tables in a merge (and a MERGE table itself) had short VARCHAR column (less
than 4 bytes) and at least one (but not all) tables were ALTER'ed (even to an
identical table: ALTER TABLE xxx ENGINE=yyy), table definitions went ouf of
sync. (affects 4.1 only)
This is fixed by relaxing a check for underlying conformance and setting
field type to FIELD_TYPE_STRING in case varchar is shorter than 4
when a table is created.
myisam/mi_create.c:
Added a comment.
mysql-test/r/merge.result:
A test case for bug#26881.
mysql-test/t/merge.test:
A test case for bug#26881.
sql/ha_myisam.cc:
Relaxed some checks performed by check_definition():
As comparing of fulltext keys (and key segments) is not yet implemented,
only return an error in case one of keys is fulltext and other is not.
Otherwise, if both keys are fulltext, accept them as is.
As comparing of spatial keys (and key segments) is not yet implemented,
only return an error in case one of keys is spatial and other is not.
Otherwise, if both keys are spatial, accept them as is.
A workaround to handle situation when field is casted from FIELD_SKIP_ZERO
to FIELD_NORMAL. This could happen only in case field length is 1 and row
format is fixed.
sql/sql_parse.cc:
When a table that has varchar field shorter than 4 is created, field type is
set to FIELD_TYPE_VAR_STRING. Later, when a table is modified using alter
table, field type is changed to FIELD_TYPE_STRING (see Field_string::type).
That means HA_OPTION_PACK_RECORD flag might be lost and thus null_bit might
be shifted by alter table, in other words alter table doesn't create 100%
equal table definition.
This is usually not a problem, since when a table is created/altered,
definition on a storage engine layer is based on one that is passed from
sql layer. But it is a problem for merge engine - null_bit is shifted when
a table (merge or underlying) is altered.
Set field type to FIELD_TYPE_STRING in case FIELD_TYPE_VAR_STRING is shorter
than 4 when a table is created as it is done in Field::type.
When the SUBSTRING() function was used over a LONGTEXT field the max_length of
the SUBSTRING() result was wrongly calculated and set to 0. As the max_length
parameter is used while tmp field creation it limits the length of the result
field and leads to printing an empty string instead of the correct result.
Now the Item_func_substr::fix_length_and_dec() function correctly calculates
the max_length parameter.
mysql-test/t/func_str.test:
Added a test case for the bug#15757: Wrong SUBSTRING() result when a tmp table was employed.
mysql-test/r/func_str.result:
Added a test case for the bug#15757: Wrong SUBSTRING() result when a tmp table was employed.
sql/item_strfunc.cc:
Bug#15757: Wrong SUBSTRING() result when a tmp table was employed.
Now the Item_func_substr::fix_length_and_dec() function correctly calculates
the max_length parameter.
Crash happened because the function get_best_group_min_max detected
joins with ROLLUP incorrectly.
mysql-test/r/olap.result:
Added a test case for bug #26830.
mysql-test/t/olap.test:
Added a test case for bug #26830.
into magare.gmz:/home/kgeorge/mysql/autopush/B26281-5.0-opt
sql/item_strfunc.cc:
Auto merged
mysql-test/r/func_str.result:
resolved test merge conflicts
mysql-test/t/func_str.test:
resolved test merge conflicts
Fixed boundry checks in the INSERT() function:
were one off.
mysql-test/r/func_str.result:
Bug #26281: test case
mysql-test/t/func_str.test:
Bug #26281: test case
sql/item_strfunc.cc:
Bug #26281: fixed boundry checks
construct references invalid name.
Derived tables currently cannot use outer references.
Thus there is no outer context for them.
The 4.1 code takes this fact into account while the
Item_field::fix_outer_field code of 5.0 lost the check that blocks
any attempts to resolve names in outer context for derived tables.
mysql-test/r/union.result:
Added a test case for bug #26661.
mysql-test/t/union.test:
Added a test case for bug #26661.
sql/item.cc:
Fixed bug #26661.
Derived tables currently cannot use outer references.
Thus there is no outer context for them.
The 4.1 code takes this fact into account while the
Item_field::fix_outer_field code of 5.0 lost the check that blocks
any attempts to resolve names in outer context for derived tables.
into mysql.com:/home/hf/work/mrg/mysql-5.0-opt
mysql-test/r/order_by.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/order_by.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/func_str.result:
merging
mysql-test/r/sp.result:
merging
mysql-test/r/view.result:
merging
mysql-test/t/func_str.test:
merging
mysql-test/t/view.test:
merging
into chilla.local:/home/mydev/mysql-5.0-bug25673
myisam/rt_index.c:
Auto merged
myisam/rt_key.c:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
myisam/rt_split.c:
Bug#25673 - spatial index corruption, error 126 incorrect key file for table
Manual merge from 4.1
mysql-test/r/gis-rtree.result:
Bug#25673 - spatial index corruption, error 126 incorrect key file for table
Manual merge from 4.1
incorrect key file for table
In certain cases it could happen that deleting a row could
corrupt an RTREE index.
According to Guttman's algorithm, page underflow is handled
by storing the page in a list for later re-insertion. The
keys from the stored pages have to be inserted into the
remaining pages of the same level of the tree. Hence the
level number is stored in the re-insertion list together
with the page.
In the MySQL RTree implementation the level counts from zero
at the root page, increasing numbers for levels down the tree.
If during re-insertion of the keys the tree height grows, all
level numbers become invalid. The remaining keys will be
inserted at the wrong level.
The fix is to increment the level numbers stored in the
reinsert list after a split of the root block during reinsertion.
myisam/rt_index.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added a loop in rtree_delete() to increment the level numbers
stored in the reinsert list after a split of the root block
during reinsertion.
Added comments and DBUG statements.
myisam/rt_key.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added DBUG statements.
myisam/rt_split.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added DBUG statements.
mysql-test/r/gis-rtree.result:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added the test result.
mysql-test/t/gis-rtree.test:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added a test.
Postfix for bug#22331 for windows platform.
explain.test, explain.result:
Cleanup after bugfix#22331.
mysql-test/t/explain.test:
Cleanup after bugfix#22331.
mysql-test/r/explain.result:
Cleanup after bugfix#22331.
sql/sql_select.cc:
Postfix for bug#22331 for windows platform.
into moonbone.local:/mnt/gentoo64/work/25373-bug-5.0-opt-mysql
mysql-test/r/subselect.result:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_lex.cc:
SCCS merged
result.
For built-in functions like sqrt() function names are hard-coded and can be
compared by pointer. But this isn't the case for a used-defined stored
functions - names there are dynamical and should be compared as strings.
Now the Item_func::eq() function employs my_strcasecmp() function to compare
used-defined stored functions names.
mysql-test/t/sp.test:
Added a test case for bug#25373: Stored functions wasn't compared correctly which leads to a wrong result.
mysql-test/r/sp.result:
Added a test case for bug#25373: Stored functions wasn't compared correctly which leads to a wrong result.
sql/item_func.cc:
Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
result.
Now the Item_func::eq() function employs my_strcasecmp() function to compare
used-defined stored functions names.
away.
During optimization stage the WHERE conditions can be changed or even
be removed at all if they know for sure to be true of false. Thus they aren't
showed in the EXPLAIN EXTENDED which prints conditions after optimization.
Now if all elements of an Item_cond were removed this Item_cond is substituted
for an Item_int with the int value of the Item_cond.
If there were conditions that were totally optimized away then values of the
saved cond_value and having_value will be printed instead.
mysql-test/t/explain.test:
Added a test case for the bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away.
mysql-test/r/subselect.result:
Corrected test case result after fix for bug#22331.
mysql-test/r/func_test.result:
Corrected test case result after fix for bug#22331.
mysql-test/r/explain.result:
Added a test case for the bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away.
sql/sql_select.cc:
Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
away.
Now if all elements of an Item_cond were removed this Item_cond is substituted
for an Item_int with the int value of the Item_cond.
If there were conditions that were totally optimized away then values of the
saved cond_value and having_value will be printed instead.
sql/sql_lex.h:
Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
away.
The cond_value and the having_value variables are
added to the SELECT_LEX class.
sql/sql_lex.cc:
Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
away.
The initialization of the cond_value and the having_value variables.
sql/sql_select.h:
Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
away.
Now having_value is also stored in the JOIN class.
into quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/mrg0306/50
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_parse.cc:
Auto merged
Functions over sum functions wasn't set up correctly for the ORDER BY clause
which leads to a wrong order of the result set.
The split_sum_func() function is called now for each ORDER BY item that
contains a sum function to set it up correctly.
mysql-test/t/order_by.test:
Added a test case for bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
mysql-test/r/order_by.result:
Added a test case for bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
sql/sql_select.cc:
Bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
The split_sum_func() function is called now for each ORDER BY item that
contains a sum function to set it up correctly.
into weblab.(none):/home/marcsql/TREE/mysql-5.0-8407_b
mysql-test/r/view.result:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_update.cc:
Auto merged
sql/table.cc:
Auto merged
sql/table.h:
Auto merged
sql/sql_base.cc:
Manual merge
Bug 18914 (Calling certain SPs from triggers fail)
Bug 20713 (Functions will not not continue for SQLSTATE VALUE '42S02')
Bug 21825 (Incorrect message error deleting records in a table with a
trigger for inserting)
Bug 22580 (DROP TABLE in nested stored procedure causes strange dependency
error)
Bug 25345 (Cursors from Functions)
This fix resolves a long standing issue originally reported with bug 8407,
which affect the behavior of Stored Procedures, Stored Functions and Trigger
in many different ways, causing symptoms reported by all the bugs listed.
In all cases, the root cause of the problem traces back to 8407 and how the
server locks tables involved with sub statements.
Prior to this fix, the implementation of stored routines would:
- compute the transitive closure of all the tables referenced by a top level
statement
- open and lock all the tables involved
- execute the top level statement
"transitive closure of tables" means collecting:
- all the tables,
- all the stored functions,
- all the views,
- all the table triggers
- all the stored procedures
involved, and recursively inspect these objects definition to find more
references to more objects, until the list of every object referenced does
not grow any more.
This mechanism is known as "pre-locking" tables before execution.
The motivation for locking all the tables (possibly) used at once is to
prevent dead locks.
One problem with this approach is that, if the execution path the code
really takes during runtime does not use a given table, and if the table is
missing, the server would not execute the statement.
This in particular has a major impact on triggers, since a missing table
referenced by an update/delete trigger would prevent an insert trigger to run.
Another problem is that stored routines might define SQL exception handlers
to deal with missing tables, but the server implementation would never give
user code a chance to execute this logic, since the routine is never
executed when a missing table cause the pre-locking code to fail.
With this fix, the internal implementation of the pre-locking code has been
relaxed of some constraints, so that failure to open a table does not
necessarily prevent execution of a stored routine.
In particular, the pre-locking mechanism is now behaving as follows:
1) the first step, to compute the transitive closure of all the tables
possibly referenced by a statement, is unchanged.
2) the next step, which is to open all the tables involved, only attempts
to open the tables added by the pre-locking code, but silently fails without
reporting any error or invoking any exception handler is the table is not
present. This is achieved by trapping internal errors with
Prelock_error_handler
3) the locking step only locks tables that were successfully opened.
4) when executing sub statements, the list of tables used by each statements
is evaluated as before. The tables needed by the sub statement are expected
to be already opened and locked. Statement referencing tables that were not
opened in step 2) will fail to find the table in the open list, and only at
this point will execution of the user code fail.
5) when a runtime exception is raised at 4), the instruction continuation
destination (the next instruction to execute in case of SQL continue
handlers) is evaluated.
This is achieved with sp_instr::exec_open_and_lock_tables()
6) if a user exception handler is present in the stored routine, that
handler is invoked as usual, so that ER_NO_SUCH_TABLE exceptions can be
trapped by stored routines. If no handler exists, then the runtime execution
will fail as expected.
With all these changes, a side effect is that view security is impacted, in
two different ways.
First, a view defined as "select stored_function()", where the stored
function references a table that may not exist, is considered valid.
The rationale is that, because the stored function might trap exceptions
during execution and still return a valid result, there is no way to decide
when the view is created if a missing table really cause the view to be invalid.
Secondly, testing for existence of tables is now done later during
execution. View security, which consist of trapping errors and return a
generic ER_VIEW_INVALID (to prevent disclosing information) was only
implemented at very specific phases covering *opening* tables, but not
covering the runtime execution. Because of this existing limitation,
errors that were previously trapped and converted into ER_VIEW_INVALID are
not trapped, causing table names to be reported to the user.
This change is exposing an existing problem, which is independent and will
be resolved separately.
mysql-test/r/information_schema_db.result:
Revised the pre-locking code implementation, aligned the tests.
mysql-test/r/sp-error.result:
Revised the pre-locking code implementation, aligned the tests.
mysql-test/r/sp.result:
Revised the pre-locking code implementation, aligned the tests.
mysql-test/r/trigger.result:
Revised the pre-locking code implementation, aligned the tests.
mysql-test/r/view.result:
Revised the pre-locking code implementation, aligned the tests.
mysql-test/t/sp-error.test:
Revised the pre-locking code implementation, aligned the tests.
mysql-test/t/sp.test:
Revised the pre-locking code implementation, aligned the tests.
mysql-test/t/trigger.test:
Revised the pre-locking code implementation, aligned the tests.
sql/lock.cc:
table->placeholder now checks for schema_table
sql/mysqld.cc:
my_message_sql(): invoke internal exception handlers
sql/sp_head.cc:
exec_open_and_lock_tables(): open and lock tables, or return the
continuation destination of this instruction
sql/sp_head.h:
exec_open_and_lock_tables(): open and lock tables, or return the
continuation destination of this instruction
sql/sql_base.cc:
Prelock_error_handler: delay open table errors until execution
sql/sql_class.cc:
THD: add internal error handler, as an exception mechanism.
sql/sql_class.h:
THD: add internal error handler, as an exception mechanism.
sql/sql_update.cc:
table->placeholder now checks for schema_table
sql/table.cc:
st_table_list::hide_view_error(): masked more errors for view security
sql/table.h:
table->placeholder now checks for schema_table, and unopened tables
Using INSERT DELAYED on MERGE tables could lead to table
corruptions.
The manual lists a couple of storage engines, which can be
used with INSERT DELAYED. MERGE is not in this list.
The attempt to try it anyway has not been rejected yet.
This bug was not detected earlier as it can work under
special circumstances. Most notable is low concurrency.
To be safe, this patch rejects any attempt to use INSERT
DELAYED on MERGE tables.
mysql-test/r/merge.result:
Bug#26464 - insert delayed + update + merge = corruption
Added test result.
mysql-test/t/merge.test:
Bug#26464 - insert delayed + update + merge = corruption
Added test.
sql/ha_myisammrg.h:
Bug#26464 - insert delayed + update + merge = corruption
Removed HA_CAN_INSERT_DELAYED flag from table_flags().
The insert delayed thread upgrades the lock from the first
entry in MYSQL_LOCK::locks only. Hence it is incapable to
handle MERGE tables, which have as many entries in this
array as they have MyISAM sub-tables.
- Add test case that shows how slave server hangs in "STOP SLAVE"
when run on MySQL version 5.0.33 compiled with OpenSSL.
Works fine with latest version of MySQL since that problem
has been fixed by patch for bug#24148. The fix has been noted in
the changelog for MySQL 5.0.36
mysql-test/r/rpl_ssl.result:
New BitKeeper file ``mysql-test/r/rpl_ssl.result''
mysql-test/t/rpl_ssl.test:
New BitKeeper file ``mysql-test/t/rpl_ssl.test''
into mysql.com:/home/ram/work/b23616/b23616.5.0
mysql-test/r/func_time.result:
Auto merged
mysql-test/t/func_time.test:
Auto merged
sql-common/my_time.c:
Auto merged
The flag alias_name_used was not set on for the outer references
in subqueries. It resulted in replacement of any outer reference
resolved against an alias for a full field name when the frm
representation of a view with a subquery was generated.
If the subquery and the outer query referenced the same table in
their from lists this replacement effectively changed the meaning
of the view and led to wrong results for selects from this view.
Modified several functions to ensure setting the right value of
the alias_name_used flag for outer references resolved against
aliases.
mysql-test/r/view.result:
Added a test case for bug #26560.
mysql-test/t/view.test:
Added a test case for bug #26560.
sql/item.cc:
Fixed bug #26560.
Made the function resolve_ref_in_select_and_group analyze the return
value of the last parameter with the type of the name resolution for
the submitted reference. If the reference has been resolved against
an alias name from select list then its flag alias_name_used is set on.
Now this value is used in Item_field::fix_outer_field to initialize the flag
when the item_ref object is created for an outer reference.
Added a parameter for the second Item_ref::Item_ref constructor to initialize
properly the flag alias_name_used. The default value of the parameter is FALSE.
If this flag is set on at the creation of an object by this constructor it
will never be changed. Corrected appropriately the Item_ref::set_properties
function.
The function Item_ref::print now prints alias name for an outer reference
if the flag alias_name_used is set on.
sql/item.h:
Fixed bug #26560.
Added a parameter for the second Item_ref::Item_ref constructor to initialize
properly the flag alias_name_used. The default value of the parameter is FALSE.
A similar change has been applied to the first Item_direct_ref::Item_direct_ref
constructor.
sql/mysql_priv.h:
Fixed bug #26560.
Added an an enumeration type enum_resolution_type to return info on
how the function find_item_in_list has resolved the submitted item.
The type is used only for this function.
sql/sql_base.cc:
Fixed bug #26560.
Made the last parameter of the function find_field_in_tables return
more detailed information on how the submitted item has been resolved.
Now it says whether the item has been resolved
against an alias name,
or as a field name without alias,
or as a field name hidden by alias,
or was resolved ignoring alias.
sql/sql_select.cc:
Fixed bug #26560.
Took into account the new type of the last parameter of the function
find_item_in_list.
When the ORDER BY clause gets fixed it's allowed to search in the current
item_list in order to find aliased fields and expressions. This is ok for a
SELECT but wrong for an UPDATE statement. If the ORDER BY clause will
contain a non-existing field which is mentioned in the UPDATE set list
then the server will crash due to using of non-existing (0x0) field.
When an Item_field is getting fixed it's allowed to search item list for
aliased expressions and fields only for selects.
sql/sql_base.cc:
Bug#25126: Wrongly resolved field leads to a crash.
When an Item_field is getting fixed it's allowed to search item list for
aliased expressions and fields only for selects.
sql/sql_select.cc:
Bug#25126: Wrongly resolved field leads to a crash.
When an Item_field is getting fixed it's allowed to search item list for
aliased expressions and fields only for selects.
mysql-test/r/update.result:
Added a test case for bug#25126: Wrongly resolved field leads to a crash.
mysql-test/t/update.test:
Added a test case for bug#25126: Wrongly resolved field leads to a crash.