The problem is that field names constructed due to wild-card
expansion done inside a stored procedure could point to freed
memory if the expansion was performed after the first call to
the stored procedure.
The problem was solved by patch for Bug#38691. The solution
was to allocate the database, table and field names in the
in the statement memory instead of table memory.
mysql-test/r/sp.result:
Add test case result for Bug#38823
mysql-test/t/sp.test:
Add test case for Bug#38823
sql/item.cc:
Remark that this also impacts wildcard expansion inside SPs.
Select with a "NULL NOT IN" condition containing complex
subselect from the same table as in the outer select failed
with an assertion.
The failure was caused by a concatenation of circumstances:
1) an inner select was optimized by make_join_statistics to use
the QUICK_RANGE_SELECT access method (that implies an index
scan of the table);
2) a subselect was independent (constant) from the outer select;
3) a condition was pushed down into inner select.
During the evaluation of a constant IN expression an optimizer
temporary changed the access method from index scan to table
scan, but an engine handler was already initialized for index
access by make_join_statistics. That caused an assertion.
Unnecessary index initialization has been removed from
the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset
reinvokes this initialization).
mysql-test/r/subselect3.result:
Added test case for bug #37894.
mysql-test/t/subselect3.test:
Added test case for bug #37894.
sql/opt_range.cc:
Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
Unnecessary index initialization has been removed from
the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset
reinvokes this initialization).
with COALESCE and JOIN
The server returned to a client the VARBINARY column type
instead of the DATE type for a result of the COALESCE,
IFNULL, IF, CASE, GREATEST or LEAST functions if that result
was filesorted in an anonymous temporary table during
the query execution.
For example:
SELECT COALESCE(t1.date1, t2.date2) AS result
FROM t1 JOIN t2 ON t1.id = t2.id ORDER BY result;
To create a column of various date/time types in a
temporary table the create_tmp_field_from_item() function
uses the Item::tmp_table_field_from_field_type() method
call. However, fields of the MYSQL_TYPE_NEWDATE type were
missed there, and the VARBINARY columns were created
by default.
Necessary condition has been added.
mysql-test/r/metadata.result:
Added test case for bug #39283.
mysql-test/t/metadata.test:
Added test case for bug #39283.
sql/sql_select.cc:
Bug #39283: Date returned as VARBINARY to client for queries
with COALESCE and JOIN
To create a column of various date/time types in a
temporary table the create_tmp_field_from_item() function
uses the Item::tmp_table_field_from_field_type() method
call. However, fields of the MYSQL_TYPE_NEWDATE type were
missed there, and the VARBINARY columns were created
by default.
Necessary condition has been added.
derived table cause crash
When a multi-UPDATE command fails to lock some table, and
subsequently succeeds, the tables need to be reopened if
they were altered. But the reopening procedure failed for
derived tables.
Extra cleanup has been added.
mysql-test/r/lock_multi.result:
Added test case for bug #38499.
mysql-test/t/lock_multi.test:
Added test case for bug #38499.
sql/sql_union.cc:
Bug#38499: flush tables and multitable table update with
derived table cause crash
Obsolete assertion has been removed.
sql/sql_update.cc:
Bug#38499: flush tables and multitable table update with
derived table cause crash
Extra cleanup for derived tables has been added:
1) unit.cleanup(),
2) unit->reinit_exec_mechanism().
When running Stored Routines the Status Variable "Questions" was wrongly
incremented. According to the manual it should contain the "number of
statements that clients have sent to the server"
Introduced a new status variable 'questions' to replace the query_id
variable which currently corresponds badly with the number of statements
sent by the client.
The new behavior is ment to be backward compatible with 4.0 and at the
same time work with new features in a similar way.
This is a backport from 6.0
mysql-test/r/status2.result:
Added test case
mysql-test/t/status2.test:
Added test case
sql/mysqld.cc:
Introduced a new status variable 'questions' to replace the query_id
variable which currently corresponds badly with the number of statements
sent by the client.
sql/sql_class.h:
Introduced a new status variable 'questions' to replace the query_id
variable which currently corresponds badly with the number of statements
sent by the client.
sql/sql_parse.cc:
To be backward compatible with 4.0 and at the same time extend the
interpretation of the Question variable, it should be increased on
all COM-commands but COM_STATISTICS, COM_PING, COM_STMT_PREPARE,
COM_STMT_CLOSE and COM_STMT_RESET.
Since COM_QUERY can process multiple statements, there has to be an
extra increase there as well.
sql/sql_show.cc:
Removed deprecated SHOW_QUESTION status code.
sql/structs.h:
Removed deprecated SHOW_QUESTION status code.
``FLUSH TABLES WITH READ LOCK''
Concurrent execution of 1) multitable update with a
NATURAL/USING join and 2) a such query as "FLUSH TABLES
WITH READ LOCK" or "ALTER TABLE" of updating table led
to a server crash.
The mysql_multi_update_prepare() function call is optimized
to lock updating tables only, so it postpones locking to
the last, and if locking fails, it does cleanup of modified
syntax structures and repeats a query analysis. However,
that cleanup procedure was incomplete for NATURAL/USING join
syntax data: 1) some Field_item items pointed into freed
table structures, and 2) the TABLE_LIST::join_columns fields
was not reset.
Major change:
short-living Field *Natural_join_column::table_field has
been replaced with long-living Item*.
mysql-test/r/lock_multi.result:
Added test case for bug #38691.
mysql-test/t/lock_multi.test:
Added test case for bug #38691.
sql/item.cc:
Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''
The Item_field constructor has been modified to allocate
and copy original database/table/field names always (not
during PS preparation/1st execution only), because
an initialization of Item_field items with a pointer to
short-living Field structures is a common practice.
sql/sql_base.cc:
Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''
1) Type adjustment for Natural_join_column::table_field
(Field to Item_field);
2) The setup_natural_join_row_types function has been
updated to take into account new
first_natural_join_processing flag to skip unnecessary
reinitialization of Natural_join_column::join_columns
during table reopening after lock_tables() failure
(like the 'first_execution' flag for PS).
sql/sql_lex.cc:
Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''
Initialization of the new
st_select_lex::first_natural_join_processing flag has
been added.
sql/sql_lex.h:
Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''
The st_select_lex::first_natural_join_processing flag
has been added to skip unnecessary rebuilding of
NATURAL/USING JOIN structures during table reopening
after lock_tables failure.
sql/sql_update.cc:
Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''
Extra cleanup calls have been added to reset
Natural_join_column::table_field items.
sql/table.cc:
Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''
Type adjustment for Natural_join_column::table_field
(Field to Item_field).
sql/table.h:
Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''
Type of the Natural_join_column::table_field field has
been changed from Field that points into short-living
TABLE memory to long-living Item_field that can be
linked to (fixed) reopened table.
The '@' symbol can not be used in the host name according to rfc952.
The fix:
added function check_host_name(LEX_STRING *str)
which checks that all symbols in host name string are valid and
host name length is not more than max host name length
(just moved check_string_length() function from the parser into check_host_name()).
mysql-test/r/create.result:
test result
mysql-test/t/create.test:
test case
sql/mysql_priv.h:
added function check_host_name(LEX_STRING *str)
sql/sql_parse.cc:
added function check_host_name(LEX_STRING *str)
which checks that all symbols in host name string are valid and
host name length is not more than max host name length(HOSTNAME_LENGTH).
sql/sql_yacc.yy:
using newly added function check_host_name()
The problem:
I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL
privileges for a view. It leads to discrepancy between SHOW CREATE VIEW
and I_S.VIEWS.
The fix:
added appropriate check.
mysql-test/r/information_schema_db.result:
test result
mysql-test/t/information_schema_db.test:
test case
sql/sql_show.cc:
The problem:
I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL
privileges for a view. It leads to discrepancy between SHOW CREATE VIEW
and I_S.VIEWS.
The fix:
added appropriate check.
When analyzing the possible index use cases the server was re-using an internal structure.
This is wrong, as this internal structure gets updated during the analysis.
Fixed by making a copy of the internal structure for every place it needs to be used.
Also stopped the generation of empty SEL_TREE structures that unnecessary
complicate the analysis.
mysql-test/r/index_merge.result:
Bug#37943: test case
mysql-test/t/index_merge.test:
Bug#37943: test case
sql/opt_range.cc:
Bug#37943:
- Make copy constructors for SEL_TREE and sub-structures and use them when OR-ing trees.
- don't generate empty SEL_TREEs. Return NULL instead.
from stored procedure.
Problem: we replace all references to local variables in stored procedures
with NAME_CONST(name, value) logging to the binary log. However, if the
value's collation differs we might get an 'illegal mix of collation'
error as we don't pass the collation to the function.
Fix: pass the value's collation to NAME_CONST().
Note: actually we should pass to NAME_CONST() the value's derivation as well.
It's impossible without the parser modifying. Now we always set the
derivation to DERIVATION_IMPLICIT, the same as local variables have.
mysql-test/r/binlog.result:
Fix for bug#39182: Binary log producing incompatible character set query
from stored procedure.
- test result.
mysql-test/r/ctype_cp932_binlog.result:
Fix for bug#39182: Binary log producing incompatible character set query
from stored procedure.
- results adjusted.
mysql-test/r/rpl_sp.result:
Fix for bug#39182: Binary log producing incompatible character set query
from stored procedure.
- results adjusted.
mysql-test/t/binlog.test:
Fix for bug#39182: Binary log producing incompatible character set query
from stored procedure.
- test case.
sql/item.cc:
Fix for bug#39182: Binary log producing incompatible character set query
from stored procedure.
- allow NAME_CONST() to get _charset'foo' COLLATE 'bar' strings
(see Item_func_set_collation).
sql/sp_head.cc:
Fix for bug#39182: Binary log producing incompatible character set query
from stored procedure.
- pass the value's collation to NAME_CONST().
JOIN for the subselect wasn't cleaned if we came upon an error
during sub_select() execution. That leads to the assertion failure
in close_thread_tables()
part of the 6.0 code backported
per-file comments:
mysql-test/r/sp-error.result
Bug#37949 Crash if argument to SP is a subquery that returns more than one row
test result
mysql-test/t/sp-error.test
Bug#37949 Crash if argument to SP is a subquery that returns more than one row
test case
sql/sp_head.cc
Bug#37949 Crash if argument to SP is a subquery that returns more than one row
lex->unit.cleanup() call added if not substatement
Machines with hostname set to "localhost" cause uniqueness errors in
the SQL bootstrap data.
Now, insert zero lines for cases where the (lowercased) hostname is
the same as an already-inserted 'localhost' name. Also, fix a few tests
that expect certain local accounts to have a certain host name.
A stored procedure involving substrings could crash the server on certain
platforms because of invalid memory reads.
During storing the new blob-field value, the cached value's address range
overlapped that of the new field value. This caused problems when the
cached value storage was reallocated to provide access for a new
characater set representation. The patch checks the address ranges, and if
they overlap, the new field value is copied to a new storage before it is
converted to the new character set.
mysql-test/r/sp.result:
Added result set
mysql-test/t/sp.test:
Added test case
sql/field.cc:
The source and destination address ranges of a character conversion must not overlap or the 'from' address will be invalidated as the temporary value-
object is re-allocated to fit the new character set.
sql/field.h:
Added comments
The fix for bug 31887 was incomplete : it assumes that all the
field types returned by the IS_NUM macro are descendants of
Item_num and tries to zero-fill the values before doing constant
substitution with such fields when they are compared to constant string
values.
The only exception to this is Field_timestamp : it's in the IS_NUM
macro, but is not a descendant of Field_num.
Fixed by excluding timestamp fields (Field_timestamp) when zero-filling
when converting the constant to compare with to a string.
Note that this will not exclude the timestamp columns from const
propagation.
mysql-test/r/compare.result:
Bug #39353: test case
mysql-test/t/compare.test:
Bug #39353: test case
sql/item.cc:
Bug #39353: don't zero-fill timestamp fields when const propagating
to a string : they'll be converted to a string in a date/time format
and not as an integer.
NO_BACKSLASH_ESCAPES was not heeded in LOAD DATA INFILE
and SELECT INTO OUTFILE. It is now.
mysql-test/r/loaddata.result:
Show that SQL-mode NO_BACKSLASH_ESCAPES is heeded in
INFILE/OUTFILE, and that dump/restore cycles work!
mysql-test/t/loaddata.test:
Show that SQL-mode NO_BACKSLASH_ESCAPES is heeded in
INFILE/OUTFILE, and that dump/restore cycles work!
sql/sql_class.cc:
Add function to enquire whether ESCAPED BY was given.
When doing SELECT...OUTFILE, use ESCAPED BY if specifically
given; otherwise use sensible default value depending on
SQL-mode features NO_BACKSLASH_ESCAPES.
sql/sql_class.h:
Add function to enquire whether ESCAPED BY was given.
sql/sql_load.cc:
When doing LOAD DATA INFILE, use ESCAPED BY if specifically
given; otherwise use sensible default value depending on
SQL-mode features NO_BACKSLASH_ESCAPES.
Details:
- backport of some improvements which prevent sporadic
failures from 5.1 to 5.0
- @@GLOBAL.CONCURRENT_INSERT= 0 also for slave server
- --sorted_result before all selects which have result
sets with more than one row
- Replace error numbers by error names
Moved fix for this bug to 5.0 as other mysqldump bugs seem tied to concurrent_insert being on
Setting concurrent_insert off during this test as INSERTs weren't being
completely processed before the calls to mysqldump, resulting in failing tests.
Altered .test file to turn concurrent_insert off during the test and to restore it
to whatever the value was at the start of the test when complete.
Re-recorded .result file to account for changes to variables in the test.
Problem: <=> operator may return wrong results
comparing NULL and a DATE/DATETIME/TIME value.
Fix: properly check NULLs.
mysql-test/r/type_datetime.result:
Fix for bug#37526: asymertic operator <=> in trigger
- test result.
mysql-test/t/type_datetime.test:
Fix for bug#37526: asymertic operator <=> in trigger
- test case.
sql/item_cmpfunc.cc:
Fix for bug#37526: asymertic operator <=> in trigger
- if is_nulls_eq is TRUE Arg_comparator::compare_datetime()
should return 1 only if both arguments are NULL.
Problem: SELECT ... REGEXP BINARY NULL may lead to server crash/hang.
Fix: properly handle NULL regular expressions.
mysql-test/r/func_regexp.result:
Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
- test result.
mysql-test/t/func_regexp.test:
Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
- test case.
sql/item_cmpfunc.cc:
Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
- checking regular expressions' null_value
we tested it without a val_xxx() call before, which is wrong.
Now Item_func_regex::regcomp() returns -1 in the case
and allows to handle NULL expessions properly.
sql/item_cmpfunc.h:
Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
- checking regular expressions' null_value
we tested it without a val_xxx() call before, which is wrong.
Now Item_func_regex::regcomp() returns -1 in the case
and allows to handle NULL expessions properly.
in open_table()
Problem: repeating "CREATE... ( AUTOINCREMENT) ... SELECT" may lead to
an assertion failure.
Fix: reset table->auto_increment_field_not_null after each record
writing.
mysql-test/r/create.result:
Fix for bug#38821: Assert table->auto_increment_field_not_null failed
in open_table()
- test result.
mysql-test/t/create.test:
Fix for bug#38821: Assert table->auto_increment_field_not_null failed
in open_table()
- test case.
sql/sql_insert.cc:
Fix for bug#38821: Assert table->auto_increment_field_not_null failed
in open_table()
- reset table->auto_increment_field_not_null after writing a record
for "{CREATE, INSERT}..SELECT".
INSERT .. SELECT .. ON DUPLICATE KEY UPDATE col=DEFAULT
In order to get correct values from update fields that
belongs to the SELECT part in the INSERT .. SELECT .. ON
DUPLICATE KEY UPDATE statement, the server adds referenced
fields to the select list. Part of the code that does this
transformation is shared between implementations of
the DEFAULT(col) function and the DEFAULT keyword (in
the col=DEFAULT expression), and an implementation of
the DEFAULT keyword is incomplete.
mysql-test/r/default.result:
Added test case for bug #39002.
mysql-test/t/default.test:
Added test case for bug #39002.
sql/item.cc:
The Item_default_value::transform() function has been
modified to take into account the fact that the DEFAULT
keyword has no arguments unlike the DEFAULT(col) function
that always has an argument.
returns unexpected result
If:
1. a table has a not nullable BIT column c1 with a length
shorter than 8 bits and some additional not nullable
columns c2 etc, and
2. the WHERE clause is like: (c1 = constant) AND c2 ...,
the SELECT query returns unexpected result set.
The server stores BIT columns in a tricky way to save disk
space: if column's bit length is not divisible by 8, the
server places reminder bits among the null bits at the start
of a record. The rest bytes are stored in the record itself,
and Field::ptr points to these rest bytes.
However if a bit length of the whole column is less than 8,
there are no remaining bytes, and there is nothing to store in
the record at its regular place. In this case Field::ptr points
to bytes actually occupied by the next column in a record.
If both columns (BIT and the next column) are NOT NULL,
the Field::eq function incorrectly deduces that this is the
same column, so query transformation/equal item elimination
code (see build_equal_items_for_cond) may mix these columns
and damage conditions containing references to them.
mysql-test/r/type_bit.result:
Added test case for bug #37799.
mysql-test/t/type_bit.test:
Added test case for bug #37799.
sql/field.h:
1. The Field::eq function has been modified to take types of
comparing columns into account to distinguish between BIT and
not BIT columns referencing the same bytes in a record.
2. Unnecessary type comparison has been removed from the
Field_bit::eq function (moved to Field::eq).
used causes server crash.
When the loose index scan access method is used values of aggregated functions
are precomputed by it. Aggregation of such functions shouldn't be performed
in this case and functions should be treated as normal ones.
The create_tmp_table function wasn't taking this into account and this led to
a crash if a query has MIN/MAX aggregate functions and employs temporary table
and loose index scan.
Now the JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
functions as normal ones when the loose index scan is used.
mysql-test/r/group_min_max.result:
Added a test case for the bug#38195.
mysql-test/t/group_min_max.test:
Added a test case for the bug#38195.
sql/sql_select.cc:
Bug#38195: Incorrect handling of aggregate functions when loose index scan is
used causes server crash.
The JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
functions as normal ones when the loose index scan is used.
Problem: data consistency check (maximum record length) for a correct
MyISAM table with CHECKSUM=1 and ROW_FORMAT=DYNAMIC option
may fail due to wrong inner MyISAM parameter. In result we may
have the table marked as 'corrupted'.
Fix: properly set MyISAM maximum record length parameter.
myisam/mi_create.c:
Fix for bug #37310: 'on update CURRENT_TIMESTAMP' option crashes the table
Use HA_OPTION_PACK_RECORD instead of HA_PACK_RECORD (typo?)
calculating packed record length.
Bug#26687 rpl_ddl test fails if run with --innodb option
Details:
- The current test + the expected results do only fit
if the slave uses MyISAM for mysqltest1.t1.
Therefore skip the test if we do not meet these
conditions.
- The solution for 5.1 will look quite different
because "ps_ddl" is already much improved in
MySQL 5.1.
test_if_data_home_dir fixed to look into real path.
Checks added to mi_open for symlinks into data home directory.
per-file messages:
include/my_sys.h
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
my_is_symlink interface added
include/myisam.h
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
myisam_test_invalid_symlink interface added
myisam/mi_check.c
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
mi_open_datafile calls modified
myisam/mi_open.c
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
code added to mi_open to check for symlinks into data home directory.
mi_open_datafile now accepts 'original' file path to check if it's
an allowed symlink.
myisam/mi_static.c
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
myisam_test_invlaid_symlink defined
myisam/myisamchk.c
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
mi_open_datafile call modified
myisam/myisamdef.h
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
mi_open_datafile interface modified - 'real_path' parameter added
mysql-test/r/symlink.test
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
error codes corrected as some patch now rejected pointing inside datahome
mysql-test/r/symlink.result
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
error messages corrected in the result
mysys/my_symlink.c
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
my_is_symlink() implementsd
my_realpath() now returns the 'realpath' even if a file isn't a symlink
sql/mysql_priv.h
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
test_if_data_home_dir interface
sql/mysqld.cc
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
myisam_test_invalid_symlik set with the 'test_if_data_home_dir'
sql/sql_parse.cc
Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
error messages corrected
test_if_data_home_dir code fixed
Send_field.org_col_name has broken value on secondary execution.
It happens when result field is created from the field which belongs to view
due to forgotten assignment of some Send_field attributes.
The fix:
set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.
mysql-test/r/metadata.result:
result fix
The result file was changed because now forgotten attributes are properly set.
mysql-test/r/sp.result:
test result
mysql-test/t/sp.test:
test case
sql/item.cc:
Send_field.org_col_name has broken value on secondary execution.
It happens when result field is created from the field which belongs to view
due to forgotten assignment of some Send_field attributes.
The fix:
set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.
tests/mysql_client_test.c:
test case fix
The test was changed because now forgotten attributes are properly set.
Length value is the length of the field,
Max_length is the length of the field value.
So Max_length can not be more than Length.
The fix: fixed calculation of the Item_empty_string item length
(Patch applied and queued on demand of Trudy/Davi.)
sql/item.h:
fixed calculation of the item length
sql/sql_show.cc:
removed unnecessary code
When the fractional part in a multiplication of DECIMALs
overflowed, we truncated the first operand rather than the
longest. Now truncating least significant places instead
for more precise multiplications.
(Queuing at demand of Trudy/Davi.)
mysql-test/r/type_newdecimal.result:
show that if we need to truncate the scale of an operand, we pick the
right one (that is, we discard the least significant decimal places)
mysql-test/t/type_newdecimal.test:
show that if we need to truncate the scale of an operand, we pick the
right one (that is, we discard the least significant decimal places)
strings/decimal.c:
when needing to disregard fractional parts, pick the least
significant ones
with blobs containing nulls
Problem: FEDERATED SE improperly stores NULL fields in the record buffer.
Fix: store them properly.
mysql-test/r/federated.result:
Fix for bug #34779: crash in checksum table on federated tables
with blobs containing nulls
- test result.
mysql-test/t/federated.test:
Fix for bug #34779: crash in checksum table on federated tables
with blobs containing nulls
- test case.
sql/ha_federated.cc:
Fix for bug #34779: crash in checksum table on federated tables
with blobs containing nulls
- storing a NULL field in the record buffer
we must initialize its data as other code
may rely on it.
used causes server crash.
When the loose index scan access method is used values of aggregated functions
are precomputed by it. Aggregation of such functions shouldn't be performed
in this case and functions should be treated as normal ones.
The create_tmp_table function wasn't taking this into account and this led to
a crash if a query has MIN/MAX aggregate functions and employs temporary table
and loose index scan.
Now the JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
functions as normal ones when the loose index scan is used.
mysql-test/r/group_min_max.result:
Added a test case for the bug#38195.
mysql-test/t/group_min_max.test:
Added a test case for the bug#38195.
sql/sql_select.cc:
Bug#38195: Incorrect handling of aggregate functions when loose index scan is
used causes server crash.
Now the JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
functions as normal ones when the loose index scan is used.
Bug#35220: ALTER TABLE too picky on reserved word "foreign"
In ALTER TABLE, change the internal parser to search for
``FOREIGN[[:space:]]'' instead of only ``FOREIGN'' when parsing
ALTER TABLE ... DROP FOREIGN KEY ...; otherwise it could be mistaken
with ALTER TABLE ... DROP foreign_col;
(This fix is already present in MySQL 5.1 and higher.)
innodb-5.0-ss2475.
Bug #34286 Assertion failure in thread 2816 in file .\row\row0sel.c line 3500
Since autoinc init performs a MySQL SELECT query to determine the auto-inc
value, set prebuilt->sql_stat_start = TRUE so that it is performed like any
normal SELECT, regardless of the context in which it was invoked.
Bug #35352 If InnoDB crashes with UNDO slots full error the error persists on restart
We've added a heuristic that checks the size of the UNDO slots cache lists
(insert and upate). If either of cached lists has more than 500 entries then we
add any UNDO slots that are freed, to the common free list instead of the cache
list, this is to avoid the case where all the free slots end up in only one of
the lists on startup after a crash.
Tested with test case for 26590 and passes all mysql-test(s).
Bug #36600 SHOW STATUS takes a lot of CPU in buf_get_latched_pages_number
Fixed by removing the Innodb_buffer_pool_pages_latched variable from SHOW
STATUS output in non-UNIV_DEBUG compilation.
min() and max() functions are implemented in MySQL as macros.
This means that max(a,b) is expanded to: ((a) > (b) ? (a) : (b))
Note how 'a' is quoted two times.
Now imagine 'a' is a recursive function call that's several 10s of levels deep.
And the recursive function does max() with a function arg as well to dive into
recursion.
This means that simple function call can take most of the clock time.
Identified and fixed several such calls to max()/min() : including the IF()
sql function implementation.
mysql-test/r/func_if.result:
Bug#37662 test case
mysql-test/t/func_if.test:
Bug#37662 test case
sql/item.cc:
Bug#37662 don't call expensive functions as arguments to min/max
sql/item_cmpfunc.cc:
Bug#37662 don't call expensive functions as arguments to min/max
sql/item_func.cc:
Bug#37662 don't call expensive functions as arguments to min/max
Calling List<Cached_item>::delete_elements for the same list twice
caused a crash of the server in the function JOIN::cleaunup.
Ensured that delete_elements() in JOIN::cleanup would be called only once.
mysql-test/r/subselect.result:
Added a test case for bug #38191.
mysql-test/t/subselect.test:
Added a test case for bug #38191.
sql/sql_select.cc:
Fixed bug #38191.
Ensured that delete_elements() in JOIN::cleanup would be called only once.
Range scan in descending order for c <= <col> <= c type of
ranges was ignoring the DESC flag.
However some engines like InnoDB have the primary key parts
as a suffix for every secondary key.
When such primary key suffix is used for ordering ignoring
the DESC is not valid.
But we generally would like to do this because it's faster.
Fixed by performing only reverse scan if the primary key is used.
Removed some dead code in the process.
mysql-test/r/innodb_mysql.result:
Bug#37830 : test case
mysql-test/t/innodb_mysql.test:
Bug#37830 : test case
sql/opt_range.cc:
Bug#37830 :
- preserve and use used_key_parts to
distinguish when a primary key suffix is used
- removed some dead code
sql/opt_range.h:
Bug#37830 :
- preserve used_key_parts
- dead code removed
sql/sql_select.cc:
Bug#37830 : Do only reverse order traversal
if the primary key suffix is used.
- Revert the fix for bug 33812
- fixed a win32 warning
client/mysql.cc:
revert the fix for bug 33812
mysql-test/r/mysql.result:
revert the fix for bug 33812
mysql-test/t/mysql_delimiter.sql:
revert the fix for bug 33812
mysys/default.c:
fixed a win32 warning
build)
The crash was caused by freeing the internal parser stack during the parser
execution.
This occured only for complex stored procedures, after reallocating the parser
stack using my_yyoverflow(), with the following C call stack:
- MYSQLparse()
- any rule calling sp_head::restore_lex()
- lex_end()
- x_free(lex->yacc_yyss), xfree(lex->yacc_yyvs)
The root cause is the implementation of stored procedures, which breaks the
assumption from 4.1 that there is only one LEX structure per parser call.
The solution is to separate the LEX structure into:
- attributes that represent a statement (the current LEX structure),
- attributes that relate to the syntax parser itself (Yacc_state),
so that parsing multiple statements in stored programs can create multiple
LEX structures while not changing the unique Yacc_state.
Now, Yacc_state and the existing Lex_input_stream are aggregated into
Parser_state, a structure that represent the complete state of the (Lexical +
Syntax) parser.
mysql-test/r/parser_stack.result:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
mysql-test/t/parser_stack.test:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sp.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sp_head.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_class.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_class.h:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_lex.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_lex.h:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_parse.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_prepare.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_trigger.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_view.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_yacc.yy:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
offset for time part in UUIDs was 1/1000 of what it
should be. In other words, offset was off.
Also handle the case where we count into the future
when several UUIDs are generated in one "tick", and
then the next call is late enough for us to unwind
some but not all of those borrowed ticks.
Lastly, handle the case where we keep borrowing and
borrowing until the tick-counter overflows by also
changing into a new "numberspace" by creating a new
random suffix.
mysql-test/r/func_misc.result:
Show that time-part of UUIDs is correct now.
mysql-test/t/func_misc.test:
Show that time-part of UUIDs is correct now
by replicating the C-code's resultin SQL.
Results also decode to expect date-data on
command-line (external validation).
No test for unwinding of borrowed ticks as
this a) is a race and b) depends on what timer
we get.
sql/item_strfunc.cc:
correct offset for date/time-part of UUID.
also make sure that when we counted into
the future earlier (several UUIDs generated
in same tick), we only give back as many
"borrowed" ticks as we can without duplicating
past timestamps. If our tick-counter overflows
before we can give back, or if the system-clock
is set back (by user or Daylight Saving Time),
we create a new random suffix to avoid
collisions and clear the tick-counter.
enabled)
Before this fix, the lexer and parser would treat the ';' character as a
different token (either ';' or END_OF_INPUT), based on convoluted logic,
which failed in simple cases where a stored procedure is implemented as a
single statement, and used in a multi query.
With this fix:
- the character ';' is always parsed as a ';' token in the lexer,
- parsing multi queries is implemented in the parser, in the 'query:' rules,
- the value of thd->client_capabilities, which is the capabilities
negotiated between the client and the server during bootstrap,
is immutable and not arbitrarily modified during parsing (which was the
root cause of the bug)
Bug#35658 (An empty binary value leads to mysqld crash)
Before this fix, the following token
b''
caused the parser to crash when reading the binary value from the empty string.
The crash was caused by:
ptr+= max_length - 1;
because max_length is unsigned and was 0, causing an overflow.
With this fix, an empty binary literal b'' is parsed as a binary value 0,
in Item_bin_string.
mysql-test/r/varbinary.result:
Bug#35658 (An empty binary value leads to mysqld crash)
mysql-test/t/varbinary.test:
Bug#35658 (An empty binary value leads to mysqld crash)
sql/item.cc:
Bug#35658 (An empty binary value leads to mysqld crash)
Bug#33812: mysql client incorrectly parsing DELIMITER
Remove unnecessary and incorrect code that tried
to pull delimiter commands out of the middle of
statements.
as a commentary
mysql client has been modified to interpret EOL after
standalone -- commentary strings like whitespace
character (according to
http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-comments.html)
mysql-test/t/mysql_delimiter.sql:
Added test case for bug #36244.
mysql-test/r/federated_disabled.result:
Bug#37069 (5.0): test case
mysql-test/t/federated_disabled-master.opt:
Bug#37069 (5.0): test case
mysql-test/t/federated_disabled.test:
Bug#37069 (5.0): test case
Fix for this bug and additional improvements/fixes
In detail:
- Remove unicode attribute from several columns
(unicode properties were nowhere needed/tested)
of the table tb3
-> The runnability of these tests depends no more on
the availibility of some optional collations.
- Use a table tb3 with the same layout for all
engines to be tested and unify the engine name
within the protocols.
-> <engine>_trig_<abc>.result have the same content
- Do not load data into tb3 if these rows have no
impact on result sets
- Add tests for NDB (they exist already in 5.1)
- "--replace_result" at various places because
NDB variants of tests failed with "random" row
order in results
This fixes a till now unknown weakness within the
funcs_1 NDB tests existing in 5.1 and 6.0
- Fix the expected result of ndb_trig_1011ext
which suffered from Bug 32656
+ disable this test
- funcs_1 could be executed with the mysql-test-run.pl
option "--reorder", which saves some runtime by
optimizing server restarts.
Runtimes on tmpfs (one attempt only):
with reorder 132 seconds
without reorder 183 seconds
- Adjust two "check" statements within func_misc.test
which were incorrect (We had one run with result set
difference though the server worked good.)
- minor fixes in comments
Fix for this bug and a second similar problem
found during experimenting.
This replaces the first fix (already pushed to 5.1
and merged to 6.0) which
- failed in runs with the embedded server
- cannot be ported back to 5.0
first row or fails with an error:
ERROR 1022 (23000): Can't write; duplicate key in table ''
The server uses intermediate temporary table to store updated
row data. The first column of this table contains rowid.
Current server implementation doesn't reset NULL flag of that
column even if the server fills a column with rowid.
To keep each rowid unique, there is an unique index.
An insertion into an unique index takes into account NULL
flag of key value and ignores real data if NULL flag is set.
So, insertion of actually different rowids may lead to two
kind of problems. Visible effect of each of these problems
depends on an initial engine type of temporary table:
1. If multiupdate initially creates temporary table as
a MyISAM table (a table contains blob columns, and the
create_tmp_table function assumes, that this table is
large), it inserts only one single row and updates
only rows with one corresponding rowid. Other rows are
silently ignored.
2. If multiupdate initially creates MEMORY temporary
table, fills it with data and reaches size limit for
MEMORY tables (max_heap_table_size), multiupdate
converts MEMORY table into MyISAM table and fails
with an error:
ERROR 1022 (23000): Can't write; duplicate key in table ''
Multiupdate has been fixed to update the NULL flag of
temporary table rowid columns.
mysql-test/r/multi_update_tiny_hash.result:
Added test case for bug#36676.
mysql-test/t/multi_update_tiny_hash-master.opt:
Added test case for bug#36676.
mysql-test/t/multi_update_tiny_hash.test:
Added test case for bug#36676.
sql/sql_update.cc:
Fixed bug#36676: multiupdate using LEFT JOIN updates only
first row or fails with an error:
ERROR 1022 (23000): Can't write; duplicate key in table ''
The multi_update::send_data method has been modified to reset null bits of
fields containing rowids.
master also, so that we can visually see the slave is the same.
mysql-test/r/rpl_sp.result:
SHOW CREATE on master also.
mysql-test/t/rpl_sp.test:
SHOW CREATE on master also.
with dependent subqueries
An IN subquery is executed on EXPLAIN when it's not correlated.
If the subquery required a temporary table for its execution
not all the internal structures were restored from pointing to
the items of the temporary table to point back to the items of
the subquery.
Fixed by restoring the ref array when a temp tables were used in
executing the IN subquery during EXPLAIN EXTENDED.
mysql-test/r/subselect.result:
Bug #36011: test case
mysql-test/t/subselect.test:
Bug #36011: test case
sql/sql_select.cc:
Bug #36011: restore the ref array after execution
when there were temp tables.
mysql-test/r/rpl_sp.result:
Add binlog results to show that they're written correctly.
mysql-test/t/rpl_sp.test:
Add binlog results to show that they're written correctly.
slave
The stored-routine code took the contents of the (lowest) parser
and copied it directly to the binlog, which causes problems if there
is a special case of interpretation at the parser level -- which
there is, in the "/*!VER */" comments. The trailing "*/" caused
errors on the slave, naturally.
Now, since by that point we have /properly/ created parse-tree (as
the rest of the server should do!) for the stored-routine CREATE, we
can construct a perfect statement from that information, instead of
writing uncertain information from an unknown parser state.
Fortunately, there's already a function nearby that does exactly
that.
---
Update for Bug#36570. Qualify routine names with db name when
writing to the binlog ONLY if the source text is qualified.
mysql-test/r/binlog_innodb.result:
Offsets changed due to quoting.
---
New offset to account for db-qualified names.
mysql-test/r/ctype_cp932_binlog.result:
Offsets changed due to quoting.
---
Qualify routine names with DB. Offsets change also.
mysql-test/r/mysqlbinlog.result:
Case changed in result due to interpretation of data instead of
literal recitation.
---
Qualify procedure name with db.
mysql-test/r/rpl_sp.result:
Offsets changed due to quoting. Added tests.
---
Qualify routine names with DB if qualified in query. Offsets change also.
mysql-test/t/rpl_sp.test:
Add version-limiting quotes to exercise bug#36570. Test that
backtick-quoted identifiers and labels work also.
---
Use different db to show qualification works. Qualify routine names
with DB if qualified in query.
sql/sp.cc:
In create_string, we may not have a sp_name parameter yet, so
instead pass the char* and length of the only member we'd get out
of it.
Having done that, we can use the same function to write the
CREATE (FUNC|TRIG|PROC) statement to the binlog as we always used
to display the statement to the user.
---
Make the db name part of the CREATE string if it is specified.
Specify it in part of writing to the binlog when creating a new
routine.
sql/sp_head.cc:
Set the sp_head m_explicit_name member as the sp_name member is set.
We can not peek at this later, as the sp_name is gone by then.
sql/sp_head.h:
Add a member to track whether the name is qualified with the
database.
with previous rows.
The WHERE clause containing expression:
CONCAT(empty_field1, empty_field2, ..., 'literal constant', ...)
REGEXP 'regular expression'
may return wrong matches.
Optimization of the CONCAT function has been fixed.
mysql-test/r/func_concat.result:
Added test case for bug #36488.
mysql-test/t/func_concat.test:
Added test case for bug #36488.
sql/item_strfunc.cc:
Fixed bug #36488.
The Item_func_concat::val_str method is optimized to
use first non-empty argument of the CONCAT function for in-place
result accumulation. This optimization is acceptable if that
first argument is not a constant.
However, current implementation checks this condition only for
the first actual argument of the CONCAT function.
So, the Item_func_concat::val_str method can corrupt values
of, for example, literal strings by appending random data.
The Item_func_concat::val_str method has been modified to take
into account the ability to be modified in-place for the first
non-empty argument.
The REPAIR TABLE ... USE_FRM query silently corrupts data of tables
with old .FRM file version.
The mysql_upgrade client program or the REPAIR TABLE query (without
the USE_FRM clause) can't prevent this trouble, because in the
common case they don't upgrade .FRM file to compatible structure.
1. Evaluation of the REPAIR TABLE ... USE_FRM query has been
modified to reject such tables with the message:
"Failed repairing incompatible .FRM file".
2. REPAIR TABLE query (without USE_FRM clause) evaluation has been
modified to upgrade .FRM files to current version.
3. CHECK TABLE ... FOR UPGRADE query evaluation has been modified
to return error status when .FRM file has incompatible version.
4. mysql_upgrade and mysqlcheck client programs call CHECK TABLE
FOR UPGRADE and REPAIR TABLE queries, so their behaviors have
been changed too to upgrade .FRM files with incompatible
version numbers.
mysql-test/std_data/bug36055.MYD:
Added test data for bug #36055.
mysql-test/std_data/bug36055.MYI:
Added test data for bug #36055.
mysql-test/std_data/bug36055.frm:
Added test data for bug #36055.
mysql-test/r/repair.result:
Added test case for bug# 36055.
mysql-test/t/repair.test:
Added test case for bug# 36055.
sql/handler.cc:
Fixed bug #36055: mysql_upgrade doesn't really 'upgrade' tables
The handler::ha_check_for_upgrade method has been modified to
return error if .FRM file has incompatible version number.
sql/sql_table.cc:
Fixed bug #36055: mysql_upgrade doesn't really 'upgrade' tables
The prepare_for_repair function has been modified to reject
REPAIR TABLE ... USE_FRM queries on incompatible .FRM files
with the message: "Failed repairing incompatible .FRM file".
Problem was that mysql_create_view did not remove all comments characters
when writing to binlog, resulting in parse error of stmt on slave side.
Solution was to use the recreated select clause
and add a generated CHECK OPTION clause if needed.
mysql-test/r/rpl_sp.result:
Bug#32575 - Parse error of stmt with extended comments on slave side
Updated test result
mysql-test/r/rpl_view.result:
Bug#32575 - Parse error of stmt with extended comments on slave side
Updated test result
mysql-test/t/rpl_view.test:
Bug#32575 - Parse error of stmt with extended comments on slave side
Added test case
sql/sql_view.cc:
Bug#32575 - Parse error of stmt with extended comments on slave side
Problem was that mysql_create_view did not remove all comments characters
when writing to binlog, resulting in parse error of stmt on slave side.
Solution was to use the recreated select clause and generate
'WITH {LOCAL|CASCADED} CHECK OPTION'.
The bug is a regression introduced by the patch for bug32798.
The code in Item_func_group_concat::clear() relied on the 'distinct'
variable to check if 'unique_filter' was initialized. That, however,
is not always valid because Item_func_group_concat::setup() can do
shortcuts in some cases w/o initializing 'unique_filter'.
Fixed by checking the value of 'unique_filter' instead of 'distinct'
before dereferencing.
mysql-test/r/func_gconcat.result:
Added test cases for bugs #35298 and #36024.
mysql-test/t/func_gconcat.test:
Added test cases for bugs #35298 and #36024.
sql/item_sum.cc:
Check if unique_filter != NULL before dereferencing it. Non-zero value
of distinct does not always mean that unique_filter is initialized
because Item_func_group_concat::setup() can do shortcuts is some cases
When a zero length is provided to the my_decimal_length_to_precision
function along with unsigned_flag set to false it returns a negative value.
For queries that employs temporary tables may cause failed assertion or
excessive memory consumption while temporary table creation.
Now the my_decimal_length_to_precision and the my_decimal_precision_to_length
functions take unsigned_flag into account only if the length/precision
argument is non-zero.
mysql-test/t/type_decimal.test:
Added a test case for the bug#36023: Incorrect handling of zero length caused
an assertion to fail.
mysql-test/r/type_decimal.result:
Added a test case for the bug#36023: Incorrect handling of zero length caused
an assertion to fail.
sql/my_decimal.h:
Bug#36023: Incorrect handling of zero length caused an assertion to fail.
Now the my_decimal_length_to_precision and the my_decimal_precision_to_length
functions take unsigned_flag into account only if the length/precision
argument is non-zero.
Post-commit minor cleanup of testcase (bug#36139).
mysql-test/r/subselect.result:
Post-commit minor cleanup of testcase (bug#36139).
mysql-test/t/subselect.test:
Post-commit minor cleanup of testcase (bug#36139).
impossible WHERE/HAVING clause
(subselect_single_select_engine::exec).
Allocation and initialization of joined table list t1, t2... of
subqueries like:
NOT IN (SELECT ... FROM t1,t2,... WHERE 0)
is optimized out, however server tries to traverse this list.
mysql-test/r/subselect3.result:
Added test case for bug#36005.
mysql-test/t/subselect3.test:
Added test case for bug#36005.
sql/sql_select.cc:
Fixed bug#36005.
1. JOIN::prepare initializes JOIN::table counter (actually a size
of the JOIN::join_tab array) and sets it to a number of joined tables.
2. The make_join_statistics function (when called from JOIN::optimize)
allocates and fills the JOIN::join_tab array.
However, when optimizing subselect has impossible (definite false)
WHERE or HAVING clause, optimizer skips call to make_join_statistics
and leaves JOIN::join_tab == NULL.
3. subselect_single_select_engine::exec does traversal of the JOIN::join_tab
array and the server dies because array is not allocated but array
counter is greater than 0.
The JOIN::optimize method has been modified to reset the JOIN::table
counter to 0 in cause of impossible WHERE/HAVING clause.
Grouping or ordering of long values in not indexed BLOB/TEXT columns
with GBK or BIG5 charsets crashes the server.
MySQL server uses sorting (the filesort procedure) in the temporary
table to evaluate the GROUP BY clause in case of lack of suitable index.
That procedure takes into account only first @max_sort_length bytes
(system variable, usually 1024) of TEXT/BLOB sorting key string.
The my_strnxfrm_gbk and my_strnxfrm_big5 fill temporary keys
with data of whole blob length instead of @max_sort_length bytes
length. That buffer overrun has been fixed.
mysql-test/r/ctype_gbk.result:
Added test case for bug #35993.
mysql-test/t/ctype_gbk.test:
Added test case for bug #35993.
strings/ctype-big5.c:
Fixed bug #35993: memory corruption and crash with multibyte conversion.
Buffer overrun has been fixed in the my_strnxfrm_big5 function.
strings/ctype-gbk.c:
Fixed bug #35993: memory corruption and crash with multibyte conversion.
Buffer overrun has been fixed in the my_strnxfrm_gbk function.
- Make convert_zerofill_number_to_string() take into account that the
constant it is converting may evaluate to NULL.
mysql-test/r/subselect.result:
BUG#36139 "float, zerofill, crash with subquery"
- Testcase
mysql-test/t/subselect.test:
BUG#36139 "float, zerofill, crash with subquery"
- Testcase
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
mysql-test/r/type_blob.result:
Auto merged
mysql-test/t/type_blob.test:
Auto merged
sql/field.cc:
Auto merged
sql/unireg.h:
Auto merged
Make maximum blob size to be 2**32-1, regardless of word size.
Fix failure of timestamp with size of 2**31-1. The method of
rounding up to the nearest even number would overflow.
mysql-test/r/type_blob.result:
2**32-1 is not a special case for timestamp.
Test 2**32-1 and 2**64 as the reliable test points for both 32-
and 64-bit machines. I'd like to test 2**32, but that would make
tests that vary between architectures.
I'd like to generalize the tests by pulling the max blob size from
the server, and then "eval"ing N-1, N, and N+1 instead of all these
literal numbers, but I have not found a way to get UINT_MAX.
mysql-test/t/type_blob.test:
2**32-1 is not a special case for timestamp.
Test 2**32-1 and 2**64 as the reliable test points for both 32-
and 64-bit machines. I'd like to test 2**32, but that would make
tests that vary between architectures.
I'd like to generalize the tests by pulling the max blob size from
the server, and then "eval"ing N-1, N, and N+1 instead of all these
literal numbers, but I have not found a way to get UINT_MAX.
sql/field.cc:
Fix a bug where the round-to-even code for TIMESTAMP fields
failed where the size would overflow the size to zero and then
fail.
Also, since we silently truncate the size of TIMESTAMP fields, set
the maximum size we report is allowable to be the largest parsable
number.
sql/unireg.h:
Make BLOB size the maximum that the packed value in
field_blob::get_length() allows.
Mtr restarts servers because an option file exist for slave.
The option file for slave forces to skip test.foo table for replication.
But really test case does not invlved test.foo table at all.
So option file can be removed and mtr will not restart servers for test case.
BitKeeper/deleted/.del-rpl_view-slave.opt:
Rename: mysql-test/t/rpl_view-slave.opt -> BitKeeper/deleted/.del-rpl_view-slave.opt
mysql-test/t/disabled.def:
updated
Added --log-slave-updates because test requires it.
The events based on LOAD DATA INFILE masked by --replace_regex instead restarting of slave.
Added waiting start and stop of slave after START|STOP SLAVE statements.
mysql-test/r/rpl_log.result:
updated result file
mysql-test/t/disabled.def:
updated disabled.def
mysql-test/t/rpl_log-slave.opt:
updated option for slave
mysql-test/t/rpl_log.test:
updated test
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
sql/item_create.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sql_yacc.yy:
Auto merged
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
sql/field.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/unireg.h:
Auto merged
mysql-test/r/type_blob.result:
Manual merge.
mysql-test/t/type_blob.test:
Manual merge.
mysql-test/r/rpl_packet.result:
Result change.
mysql-test/t/rpl_packet.test:
Setting net_buffer_length correctly for the test instead of relying on it
being set correctly. Waiting for slave to stop after issuing a SLAVE STOP
and waiting for slave to start when issuing a SLAVE START to prevent race
conditions causing test failure.
1. Use 'dat' extension, because it is handled in Makefile.am;
2. Fix typo: the bug id is 35469, not 35649.
mysql-test/std_data/bug35469.dat:
Rename: mysql-test/std_data/bug35649.data -> mysql-test/std_data/bug35469.dat
mysql-test/r/loaddata.result:
Update result file.
mysql-test/t/loaddata.test:
1. Use 'dat' extension, because it is handled in Makefile.am;
2. Fix typo: the bug id is 35469, not 35649.
The problem was that LOAD DATA code (sql_load.cc) didn't take into
account that there may be items, representing references to other
columns. This is a usual case in views. The crash happened because
Item_direct_view_ref was casted to Item_user_var_as_out_param,
which is not a base class.
The fix is to
1) Handle references properly;
2) Ensure that an item is treated as a user variable only when
it is a user variable indeed;
3) Report an error if LOAD DATA is used to load data into
non-updatable column.
mysql-test/r/loaddata.result:
Update result file.
mysql-test/t/loaddata.test:
Add a test case form Bug#35469: server crash with
LOAD DATA INFILE to a VIEW.
sql/share/errmsg.txt:
Introduce a new error.
sql/sql_load.cc:
Handle reference-items properly.
mysql-test/std_data/bug35649.data:
Add a data file for the test case.
into moonbone.local:/work/27219-5.0-opt-mysql
sql/item.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_select.cc:
Auto merged
Mixing aggregate functions and non-grouping columns is not allowed in the
ONLY_FULL_GROUP_BY mode. However in some cases the error wasn't thrown because
of insufficient check.
In order to check more thoroughly the new algorithm employs a list of outer
fields used in a sum function and a SELECT_LEX::full_group_by_flag.
Each non-outer field checked to find out whether it's aggregated or not and
the current select is marked accordingly.
All outer fields that are used under an aggregate function are added to the
Item_sum::outer_fields list and later checked by the Item_sum::check_sum_func
function.
mysql-test/t/group_by.test:
Added a test case for the bug#27219: Aggregate functions in ORDER BY.
mysql-test/r/group_by.result:
Added a test case for the bug#27219: Aggregate functions in ORDER BY.
sql/sql_select.cc:
Bug#27219: Aggregate functions in ORDER BY.
Implementation of new check for mixing non aggregated fields and aggregation
function in the ONLY_FULL_GROUP_BY mode.
sql/sql_lex.cc:
Bug#27219: Aggregate functions in ORDER BY.
Initialization of the full_group_by_flag bitmap.
SELECT_LEX::test_limit function doesn't reset ORDER BY
clause anymore.
sql/sql_lex.h:
Bug#27219: Aggregate functions in ORDER BY.
The full_group_by_flag is added to the SELECT_LEX class.
sql/item_sum.h:
Bug#27219: Aggregate functions in ORDER BY.
The outer_fields list is added to the Item_sum class.
sql/mysql_priv.h:
Bug#27219: Aggregate functions in ORDER BY.
Defined a set of constants used in the new check for mixing non aggregated
fields and sum functions in the ONLY_FULL_GROUP_BY_MODE.
sql/item_subselect.cc:
Bug#27219: Aggregate functions in ORDER BY.
The Item_in_subselect::select_in_like_transformer function now drops
ORDER BY clause in all selects in a subquery.
sql/item_sum.cc:
Bug#27219: Aggregate functions in ORDER BY.
Now the Item_sum::check_sum_func function now checks whether fields in the
outer_fields list are aggregated or not and marks selects accordingly.
sql/item.cc:
Bug#27219: Aggregate functions in ORDER BY.
Now the Item_field::fix_fields function checks whether the field is aggregated
or not and marks its select_lex accordingly.
Fixed interference between tests: Users were added but not properly removed.
This caused later tests to fail.
mysql-test/r/grant.result:
Fixed interference between tests: Users were added but not properly removed.
This caused later tests to fail.
mysql-test/t/grant.test:
Fixed interference between tests: Users were added but not properly removed.
This caused later tests to fail.
mysql-test/r/binlog_killed_simulate.result:
Update test result after push of bug#33029
mysql-test/r/mix_innodb_myisam_binlog.result:
Update test result after push of bug#33029
mysql-test/r/multi_update.result:
Update test result after push of bug#33029
mysql-test/r/rpl_auto_increment_bug33029.result:
disable warning messages
mysql-test/r/rpl_user.result:
Update test result after push of bug#33029
mysql-test/t/rpl_auto_increment_bug33029.test:
disable warning messages
View definition as SELECT ... FROM DUAL WHERE ... has
valid syntax, but use of such view in SELECT or
SHOW CREATE VIEW syntax causes unexpected syntax error.
Server omits FROM DUAL clause when storing view body
string in a .frm file for further evaluation.
However, syntax of SELECT-witout-FROM query is more
restrictive than SELECT FROM DUAL syntax, and doesn't
allow the WHERE clause.
NOTE: this syntax difference is not documented.
View registration procedure has been modified to
preserve original structure of view's body.
mysql-test/r/view.result:
Added test case for bug #35193.
mysql-test/t/view.test:
Added test case for bug #35193.
sql/sql_select.cc:
Fixed bug #35193.
The st_select_lex::print function always omits FROM DUAL clause,
even if original SELECT query has the WHERE clause.
The mysql_register_view function uses this function to reconstruct
a body of view's AS clause for further evaluation and stores that
reconstructed clause in a .frm file.
SELECT without FROM syntax is more restrictive than
SELECT FROM DUAL syntax: second one allows
the WHERE clause, but first one is not.
Use of this view in SELECT or SHOW CREATE VIEW queries
causes unexpected syntax errors.
The st_select_lex::print function has been modified to
reconstruct FROM DUAL clause in queries when needed.
TODO: Syntax difference is not documented and should be
eliminated, however improvement of
the SELECT-without-FROM syntax is not trivial and leads to
significant modification of grammar file because of additional
shift/reduce conflicts.
into stella.local:/home2/mydev/mysql-5.0-axmrg
mysql-test/r/ctype_big5.result:
Auto merged
mysql-test/r/ctype_cp932.result:
Auto merged
mysql-test/r/ctype_euckr.result:
Auto merged
mysql-test/r/ctype_gb2312.result:
Auto merged
mysql-test/r/ctype_gbk.result:
Auto merged
mysql-test/r/ctype_uca.result:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
sql/slave.cc:
Auto merged
instructions)
This bug can not be reproduced in the current version,
adding the test case to the test suite for coverage, no code change.
mysql-test/r/sp-code.result:
Bug#20906 (Multiple assignments in SET in stored routine produce incorrect
instructions)
mysql-test/t/sp-code.test:
Bug#20906 (Multiple assignments in SET in stored routine produce incorrect
instructions)
Minor test case cleanup after bug#34529.
mysql-test/r/information_schema.result:
Minor test case cleanup after bug#34529.
mysql-test/t/information_schema.test:
Minor test case cleanup after bug#34529.
localhost/default port
When creating federated table that points to unspecified host or
localhost on unspecified port or port is 0, small memory leak occurs.
This happens because we make a copy of unix socket path, which is
never freed.
With this fix we do not make a copy of unix socket path, instead
share->socket points to MYSQL_UNIX_ADDR constant directly.
This fix is covered by a test case for BUG34788.
Affects 5.0 only.
mysql-test/t/federated.test:
A test case for BUG#35509.
sql/ha_federated.cc:
When creating federated table we call parse_url() to check if connect
string is correct. parse_url() may make a copy of unix socket path if
port is not specified or 0 and host is not specified or 'localhost'.
This copy is never freed.
As there is no need to make a copy of unix socket path, let
share->socket point to MYSQL_UNIX_ADDR directly.
correctly - crashes server !
Creating federated table with connect string containing empty
(zero-length) host name and port is evaluated as 0 (port is
incorrect, omitted or 0) crashes server.
This happens because federated calls strcmp() with NULL pointer.
Fixed by avoiding strcmp() call if hostname is set to NULL.
mysql-test/r/federated.result:
A test case for BUG#34788.
mysql-test/t/federated.test:
A test case for BUG#34788.
sql/ha_federated.cc:
Fixed that parse_url() may call strcmp() with NULL pointer.
binlogging of insert into a autoincrement blackhole table ignored
an explicit set insert_id.
Fixed with refining of the blackhole's insert method to call
update_auto_increment() that prepares binlogging the insert query
with the preceeding set insert_id.
Note, as the engine does not store any actual data one has to explicitly
provide to the server with the value of the autoincrement column via
set insert_id. Otherwise binlogging will happend with the default
set insert_id=1.
mysql-test/r/blackhole.result:
results changed
mysql-test/t/blackhole.test:
a regression test for the bug added
sql/ha_blackhole.cc:
blackhole's insert method is refined to call update_auto_increment()
that prepares binlogging the insert query with the preceeding set insert_id.
When swapping out heap I_S tables to disk, this is done after plan refinement.
Thus, READ_RECORD::file will still point to the (deleted) heap handler at start
of execution. This causes segmentation fault if join buffering is used and the
query is a star query where the result is found to be empty before accessing
some table. In this case that table has not been initialized (i.e. had its
READ_RECORD re-initialized) before the cleanup routine tries to close the handler.
Fixed by updating READ_RECORD::file when changing handler.
mysql-test/r/information_schema.result:
Bug#34529: Test result.
mysql-test/t/information_schema.test:
Bug#34529: Test case.
sql/sql_show.cc:
Bug#34529: The fix.
Before breaking the connection we have to check that there's no query
executing at the moment. Otherwise it can lead to crash in embedded server.
client/mysqltest.c:
Bug #33334 mysqltest_embedded crashes when disconnecting before reap.
Wait until the query thread is finished before we break the connection.
Waiting part moved to a separate wait_query_thread_end() function
mysql-test/r/flush.result:
Bug #33334 mysqltest_embedded crashes when disconnecting before reap.
test result
mysql-test/t/flush.test:
Bug #33334 mysqltest_embedded crashes when disconnecting before reap.
test case
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged
libmysql/libmysql.c:
Auto merged
sql-common/client.c:
Auto merged
tests/mysql_client_test.c:
Manually merged.