Problem: currently, UCS-2 cannot be used as a client character set.
Fix: raise an error if one attempts to set it to USC-2.
mysql-test/r/ctype_ucs.result:
Fix for bug#31615: crash after set names ucs2 collate xxx
- test result.
mysql-test/t/ctype_ucs.test:
Fix for bug#31615: crash after set names ucs2 collate xxx
- test case.
sql/set_var.cc:
Fix for bug#31615: crash after set names ucs2 collate xxx
- raise an error if one is going to set character_set_client to UCS-2.
sql/set_var.h:
Fix for bug#31615: crash after set names ucs2 collate xxx
- raise an error if one is going to set character_set_client to UCS-2.
Bug#28878: InnoDB tables with UTF8 character set and indexes cause wrong result for DML
When making key reference buffers over CHAR fields whitespace (0x20) must be used to fill in the remaining space in the field's buffer. This is what Field_string::store() does. Fixed Field_string::get_key_image() to do the same.
mysql-test/r/innodb_mysql.result:
Bug#28878: test case
mysql-test/t/innodb_mysql.test:
Bug#28878: test case
sql/field.cc:
Bug#28878: Fill with space instead of binary zeros.
in get_index_for_order(), don't walk over the end of the index key parts
when matching index description and needed ordering.
mysql-test/r/delete.result:
BUG#30385: Testcase
mysql-test/t/delete.test:
BUG#30385: Testcase
SELECT statement itself returns empty.
As a result of this bug 'SELECT AGGREGATE_FUNCTION(fld) ... GROUP BY'
can return one row instead of an empty result set.
When GROUP BY only has fields of constant tables
(with a single row), the optimizer deletes the group_list.
After that we lose the information about whether we had an
GROUP BY statement. Though it's important
as SELECT min(x) from empty_table; and
SELECT min(x) from empty_table GROUP BY y; have to return
different results - the first query should return one row,
second - an empty result set.
So here we add the 'group_optimized_away' flag to remember this case
when GROUP BY exists in the query and is removed
by the optimizer, and check this flag in end_send_group()
mysql-test/r/group_by.result:
Bug #29717 INSERT INTO SELECT inserts values even if
SELECT statement itself returns empty.
test result
mysql-test/r/insert_select.result:
Bug #29717 INSERT INTO SELECT inserts values even if
SELECT statement itself returns empty.
test result
mysql-test/t/group_by.test:
Bug #29717 INSERT INTO SELECT inserts values even if
SELECT statement itself returns empty.
This is additional testcase that is more basic than the
original bug's testcase and has the same reason.
mysql-test/t/insert_select.test:
Bug #29717 INSERT INTO SELECT inserts values even if
SELECT statement itself returns empty.
test case
sql/sql_select.cc:
Bug #29717 INSERT INTO SELECT inserts values even if
SELECT statement itself returns empty.
Remember the 'GROUP BY was optimized away' case in the JOIN::group_optimized
and check this in the end_send_group()
sql/sql_select.h:
Bug #29717 INSERT INTO SELECT inserts values even if
SELECT statement itself returns empty.
JOIN::group_optimized member added to remember the 'GROUP BY optimied away'
case
to 150 or 107 characters for those messages which are generated
by the embedded server during release builds.
This fixes bug#16635:
Error messages wrong: absolute path names, "%s" format code
See the bug report or the changelog for "sql/share/english/errmsg.txt"
for instructions how to do that with other languages,
even at the customer site, and for the restrictions to keep.
sql/share/english/errmsg.txt:
The embedded server uses absolute path names in its error messages,
in the release build environment these exceed the 64 character limit
which the format strings for the error messages impose (bug#16635).
But when the messages are output, the server does the "printf()"
internally in a 256 character buffer; the constant text and the
expanded variables (strings, error number) must fit into this.
(If the buffer would overflow, a format specification will not be
expanded but just copied with its code, and the message output
will just contain '%s' or '%d' where a value is expected.)
So the string lengths are increased to 150 characters in those messages
which are issued by the embedded server during release tests
and contain 1 (one) path name,
but only to 107 in the "rename" message which contains 2 (two).
This solves bug#16635 for the release builds.
For other languages used by OEM customers, similar fixes may be needed,
but we cannot test them.
These fixes can be done even in a binary installation at the customer site
by following these steps:
cd <<install-root>>/share
$EDITOR <<lang>>/errmsg.txt
../../bin/comp_err -C./charsets/ <<lang>>/errmsg.txt <<lang>>/errmsg.sys
and then restarting the server.
This bug manifested itself for join queries with GROUP BY and HAVING clauses
whose SELECT lists contained DISTINCT. It occurred when the optimizer could
deduce that the result set would have not more than one row.
The bug could lead to wrong result sets for queries of this type because
HAVING conditions were erroneously ignored in some cases in the function
remove_duplicates.
mysql-test/r/having.result:
Added a test case for bug #29911.
mysql-test/t/having.test:
Added a test case for bug #29911.
into sin.intern.azundris.com:/home/tnurnberg/27198/41-27198
sql/mysql_priv.h:
Bug #27198: Error returns from time() are ignored
manual merge
sql/sql_class.h:
Bug #27198: Error returns from time() are ignored
manual merge
gettimeofday() can fail and presumably, so can time().
Keep an eye on it.
Since we have no data on this at all so far, we just
retry on failure (and log the event), assuming that
this is just an intermittant failure. This might of
course hang the threat until we succeed. Once we know
more about these failures, an appropriate more clever
scheme may be picked (only try so many times per thread,
etc., if that fails, return last "good" time() we got or
some such). Using sql_print_information() to log as this
probably only occurs in high load scenarios where the debug-
trace likely is disabled (or might interfere with testing
the effect). No test-case as this is a non-deterministic
issue.
sql/mysql_priv.h:
Bug#27198: Error returns from time() are ignored
move declarations for log.cc to before inclusion of
sql_class.h as we now use sql_print_information() in
there.
sql/sql_class.h:
Bug#27198: Error returns from time() are ignored
gettimeofday() can fail and presumably, so can time().
Keep an eye on it.
The `SELECT 'r' INTO OUTFILE ... FIELDS ENCLOSED BY 'r' ' statement
encoded the 'r' string to a 4 byte string of value x'725c7272'
(sequence of 4 characters: r\rr).
The LOAD DATA statement decoded this string to a 1 byte string of
value x'0d' (ASCII Carriage Return character) instead of the original
'r' character.
The same error also happened with the FIELDS ENCLOSED BY clause
followed by special characters: 'n', 't', 'r', 'b', '0', 'Z' and 'N'.
NOTE 1: This is a result of the undocumented feature: the LOAD DATA INFILE
recognises 2-byte input sequences like \n, \t, \r and \Z in addition
to documented 2-byte sequences: \0 and \N. This feature should be
documented (here backspace character is a default ESCAPED BY character,
in the real-life example it may be any ESCAPED BY character).
NOTE 2, changed behaviour:
Now the `SELECT INTO OUTFILE' statement with the `FIELDS ENCLOSED BY'
clause followed by one of: 'n', 't', 'r', 'b', '0', 'Z' or 'N' characters
encodes this special character itself by doubling it ('r' --> 'rr'),
not by prepending it with an escape character.
sql/sql_class.h:
Fixed bug #29294.
The ESCAPE_CHARS macro constant is defined to enumerate
symbolic names of espace-sequences like '\n', '\t' etc.
The select_export::is_ambiguous_field_sep field has been added
to distinguish special values of the field_sep field from
another values (see ESCAPE_CHARS).
sql/sql_class.cc:
Fixed bug #29294.
The select_export::send_data method has been modified to
encode special values of the field_sep field by
doubling of those values instead of prepending them with a
value of the escape_char field.
Example: The SELECT 'r' INTO OUTFILE FIELDS ENCLOSED BY 'r'
now produces the 'rr' output string instead of x'5c72'
(i.e. instead of sequence of 2 bytes: \ and r).
sql/sql_load.cc:
Fixed bug #29294.
Added commentary for the READ_INFO::unescape method.
mysql-test/t/loaddata.test:
Updated test case for bug #29294.
mysql-test/r/loaddata.result:
Updated test case for bug #29294.
Sometimes special 0 ENUM values was ALTERed to normal
empty string ENUM values.
Special 0 ENUM value has the same string representation
as normal ENUM value defined as '' (empty string).
The do_field_string function was used to convert
ENUM data at an ALTER TABLE request, but this
function doesn't care about numerical "indices" of
ENUM values, i.e. do_field_string doesn't distinguish
a special 0 value from an empty string value.
A new copy function called do_field_enum has been added to
copy special 0 ENUM values without conversion to an empty
string.
sql/field_conv.cc:
Fixed bug #29251.
The Copy_field::get_copy_func method has been modified to
return a pointer to the do_field_enum function if a conversion
between two columns of incompatible enum types is required.
The do_field_enum function has been added for the correct
conversion of special 0 enum values.
mysql-test/t/type_enum.test:
Updated test case for bug #29251.
mysql-test/r/type_enum.result:
Updated test case for bug #29251.
we use net->vio in my_net_local_init, but in the my_net_init
implementation we set it after the call, so work with unspecified
net->vio value
sql/net_serv.cc:
Bug #29117 (init_file test crashes with embedded server)
as we started using net->vio in my_net_local_init, we should set
it before the call
Improved check for thread identity in the "embedded" case,
provided by Monty.
This finishes the fixes for bug#27078.
sql/item_func.cc:
Improved check for thread identity in the "embedded" case,
provided by Monty.
This finishes the fixes for bug#27078.
protocol
Fixed duplicated code, same as last commit.
One could send a malformed packet that caused the server to SEGV. In
recent versions of the password protocol, the client tells the server
what length the ciphertext is (almost always 20). If that length was
large enough to overflow a signed char, then the number would jump to
very large after being casted to unsigned int.
Instead, cast the *passwd char to uchar.
sql/sql_parse.cc:
Additional location of signed-char casted to uint.
protocol
One could send a malformed packet that caused the server to SEGV. In
recent versions of the password protocol, the client tells the server
what length the ciphertext is (almost always 20). If that length was
large enough to overflow a signed char, then the number would jump to
very large after being casted to unsigned int.
Instead, cast the *passwd char to uchar.
sql/sql_parse.cc:
Cast *passwd to get rid of the sign, so that sign extension doesn't
cause the sequence 125, 126, 127, 4294967169, 4294967170.
forbid the use of subselect in PURGE LOGS BEFORE command
mysql-test/r/subselect.result:
test result
mysql-test/t/subselect.test:
test case
sql/sql_yacc.yy:
forbid the use of subselect in PURGE LOGS BEFORE command
corruption errors: 126,134,145
When one thread attempts to lock two (or more) tables and another
thread executes statement that aborts these locks (e.g. REPAIR
TABLE) we may get a table object with wrong lock type in a table
cache.
For example if SELECT FROM t1,t2 was aborted, subsequent INSERT
INTO t1 may be executed under read lock.
As a result we may get various table corruptions and even a server
crash.
This is fixed by resetting lock type in case lock was aborted by
another thread.
I failed to create reasonable test case for this bug.
sql/lock.cc:
If thr_multi_lock was aborted by another thread, it unlocks tables
that were locked before one that was aborted. Lock type for tables
that were after a table that was aborted preserved. Thus we need
to reset lock data in case thr_multi_lock was aborted.
for a query over an empty table right after its creation.
The crash is the result of an attempt made by JOIN::optimize to evaluate
the WHERE condition when no records have been actually read.
The added test case can reproduce the crash only with InnoDB tables and
only with 5.0.x.
mysql-test/r/innodb_mysql.result:
Added a test case for bug #28272.
mysql-test/t/innodb_mysql.test:
Added a test case for bug #28272.
sql/sql_select.cc:
Fixed bug #28272: crash that occurs when running an EXPLAIN command
for a query over an empty table right after its creation.
The crash is the result of an attempt made by JOIN::optimize to evaluate
the WHERE condition when no records have been actually read.
Such attempts could be observed only with EXPLAIN commands.
Now at the optimization phase the WHERE condition is never evaluated if
there is no record previously read from the table.
statement from a UNION query with ORDER BY an expression containing
RAND().
The crash happened because the global order by list in the union query
was not re-initialized for execution.
(Local order by lists were re-initialized though).
mysql-test/r/ps.result:
Added a test case for bug #27937.
mysql-test/t/ps.test:
Added a test case for bug #27937.
sql/sql_union.cc:
Fixed bug #27937: crash for the the second execution of a prepared
statement from a UNION query with ORDER BY an expression containing
RAND().
The crash happened because the global order by list in the union query
was not re-initialized for execution.
(Local order by lists were re-initialized though).
Added re-initialization of the global order by list in the function
st_select_lex_unit::init_prepare_fake_select_lex.
- Queries in the query cache are identified by the individual
characters in the query statement, the current database and
the current environment expressed as a set of system variable
flags.
- Since the set of environment flags didn't properly describe the
current environment unexpected results were returned from the
query cache.
- Query cache is now cleared when the variable ft_boolean_syntax is
updated.
- An identification flag for the variable default_week_format is
added to the query cache record.
Thanks to Martin Friebe who has supplied significant parts of this patch.
mysql-test/r/query_cache.result:
Added test case
mysql-test/t/query_cache.test:
Added test case
sql/mysql_priv.h:
- Added missing flags to reflect the significant local environment
settings of the cached query.
sql/set_var.cc:
- Added query cache flush when system variable ft_boolean_syntax is
updated since this also invalidates all cached result sets using this
variable.
sql/sql_cache.cc:
- Added another local system variable as an identification flag
for cached queries.
Warnings may show up in the error log that complain about a table, yet
don't tell us which table.
Add the database and table names to the message.
sql/ha_myisam.cc:
Add the database and table names to the warning message.
When checking for applicability of join cache
we must disable its usage only if there is no
temp table in use.
When a temp table is used we can use join
cache (and it will not make the result-set
unordered) to fill the temp table. The filesort()
operation is then applied to the data in the temp
table and hence is not affected by join cache
usage.
Fixed by narrowing the condition for disabling
join cache to exclude the case where temp table
is used.
mysql-test/r/join.result:
Bug #27531: test case
mysql-test/t/join.test:
Bug #27531: test case
sql/sql_select.cc:
Bug #27531:
Disable join cache only if not using temp table
The generic string to int conversion was used by the Item_func_signed and
the Item_func_unsigned classes to convert DATE/DATETIME values to the
SIGNED/UNSIGNED type. But this conversion produces wrong results for such
values.
Now if the item which result has to be converted can return its result as
longlong then the item->val_int() method is used to allow the item to carry
out the conversion itself and return the correct result.
This condition is checked in the Item_func_signed::val_int() and the
Item_func_unsigned::val_int() functions.
mysql-test/t/cast.test:
Added a test case for the bug#23656: Wrong conversion result of a DATETIME to integer using CAST function.
mysql-test/r/cast.result:
Added a test case for the bug#23656: Wrong conversion result of a DATETIME to integer using CAST function.
sql/item_func.cc:
Bug#23656: Wrong conversion result of a DATETIME to integer using CAST function.
Now if the item which result has to be converted can return its result as
longlong then the item->val_int() method is used to allow the item to carry
out the conversion itself and return the correct result.
This condition is checked in the Item_func_signed::val_int() and the
Item_func_unsigned::val_int() functions.
some rollup rows (rows with NULLs for grouping attributes) if GROUP BY
list contained constant expressions.
This happened because the results of constant expressions were not put
in the temporary table used for duplicate elimination. In fact a constant
item from the GROUP BY list of a ROLLUP query can be replaced for an
Item_null_result object when a rollup row is produced .
Now the JOIN::rollup_init function wraps any constant item referenced in
the GROYP BY list of a ROLLUP query into an Item_func object of a special
class that is never detected as constant item. This ensures creation of
fields for such constant items in temporary tables and guarantees right
results when the result of the rollup operation first has to be written
into a temporary table, e.g. in the cases when duplicate elimination is
required.
mysql-test/r/olap.result:
Added a test case for bug #24856.
mysql-test/t/olap.test:
Added a test case for bug #24856.
sql/item_func.h:
Fixed bug #24856: the result set of a ROLLUP query with DISTINCT could lack
some rollup rows (rows with NULLs for grouping attributes) if GROUP BY
list contained constant expressions.
Itroduced class Item_func_rollup_const derived from Item_func. The object of
this class are never detected as constant items.
We use them for wrapping constant items from the GROUP BY list of any ROLLUP
query. This wrapping allows us to ensure writing constant items into temporary
tables whenever the result of the ROLLUP operation has to be written into a
temporary table, e.g. when ROLLUP is used together with DISTINCT in the SELECT
list.
sql/sql_select.cc:
Fixed bug #24856: the result set of a ROLLUP query with DISTINCT could lack
some rollup rows (rows with NULLs for grouping attributes) if GROUP BY
list contained constant expressions.
Now the JOIN::rollup_init function wraps any constant item referenced in
the GROYP BY list of a ROLLUP query into an Item_func object of a special
class that is never detected as constant item. This ensures creation of
fields for such constant items in temporary tables and guarantees right
results when the result of the rollup operation first has to be written
into a temporary table, e.g. in the cases when duplicate elimination is
required.
INSERT...ON DUPLICATE KEY UPDATE may cause error 1032:
"Can't find record in ..." if we are inserting into
InnoDB table unique index of partial key with
underlying UTF-8 string field.
This error occurs because INSERT...ON DUPLICATE uses a wrong
procedure to copy string fields of multi-byte character sets
for index search.
mysql-test/t/innodb_mysql.test:
Added test case for bug #13191.
mysql-test/r/innodb_mysql.result:
Added test case for bug #13191.
sql/field.h:
Fixed bug #13191.
Field_string::get_key_image() virtual function was overloaded
to implement copying of variable length character (UTF-8) fields.
Field::get_key_image() function prototype has been changed to
return byte size of copied data.
sql/field.cc:
Fixed bug #13191.
Field_string::get_key_image() virtual function was overloaded
to implement copying of variable length character (UTF-8) fields.
Field::get_key_image() function prototype has been changed to
return byte size of copied data.
sql/key.cc:
Fixed bug #13191.
INSERT...ON DUPLICATE KEY UPDATE may cause error 1032:
"Can't find record in ...".
This error occurs because INSERT...ON DUPLICATE uses
a wrong procedure to copy field parts for index search.
key_copy() function has been fixed.