Accessing well defined MERGE table may return an error
stating that the merge table is incorrectly defined. This
happens if MERGE child tables were accessed before and we
failed to open another incorrectly defined MERGE table in
this connection.
myrg_open() internally used my_errno as a variable for determining
failure, and thus could be tricked into a wrong decision by other
uses of my_errno.
With this fix we use function local boolean flag instead of my_errno
to determine failure.
myisammrg/myrg_open.c:
There are two requirement for accessing/setting my_errno variable,
which were not followed by myrg_open():
- it must be checked immediately after a function returned an error. There
must be no calls to other functions that may change it's value between.
- my_errno value must be set right before a function is going to return an
error. There must be no calls to other functions that may change it's
value between (that's why we have these tricks with save_errno at the
bottom of myrg_open()).
myrg_open() internally used my_errno as a variable for determining
failure, and thus could be tricked into a wrong decision by other
uses of my_errno.
mysql-test/r/merge.result:
A test case for BUG#32047.
mysql-test/t/merge.test:
A test case for BUG#32047.
The original symptoms of this bug have been fixed as a consequence of other bug fixes.
Taking this time to correct some formatting, such as replacing error numbers with names.
Beginning this with 5.0
- If missing: add "disconnect <session>"
- If physical disconnect of non "default" sessions is not finished
at test end: add routine which waits till this happened
+ additional improvements like
- remove superfluous files created by the test
- replace error numbers by error names
- remove trailing spaces, replace tabs by spaces
- unify writing of bugs within comments
- correct comments
- minor changes of formatting
Modifications according to the code review are included.
Fixed tests:
grant2
grant3
lock_tables_lost_commit
mysqldump
openssl_1
outfile
When storing a NULL to a TIMESTAMP NOT NULL DEFAULT ...,
NULL returned from some functions threw a 'cannot be NULL error.'
NULL-returns now correctly result in the timestamp-field being
assigned its default value.
mysql-test/r/type_timestamp.result:
Show that for TIMESTAMP NOT NULL DEFAULT, NULL function returns
set default now.
mysql-test/t/type_timestamp.test:
Show that for TIMESTAMP NOT NULL DEFAULT, NULL function returns
set default now.
sql/item.cc:
When storing a returned NULL (from a time- or date-related
function), make sure to apply NULL-means-DEFAULT magic where
applicable.
messed up
"ROW(...) IN (SELECT ... FROM DUAL)" always returned TRUE.
Item_in_subselect::row_value_transformer rewrites "ROW(...)
IN SELECT" conditions into the "EXISTS (SELECT ... HAVING ...)"
form.
For a subquery from the DUAL pseudotable resulting HAVING
condition is an expression on constant values, so further
transformation with optimize_cond() eliminates this HAVING
condition and resets JOIN::having to NULL.
Then JOIN::exec treated that NULL as an always-true-HAVING
and that caused a bug.
To distinguish an optimized out "HAVING TRUE" clause from
"HAVING FALSE" we already have the JOIN::having_value flag.
However, JOIN::exec() ignored JOIN::having_value as described
above as if it always set to COND_TRUE.
The JOIN::exec method has been modified to take into account
the value of the JOIN::having_value field.
mysql-test/r/subselect3.result:
Added test case for bug #39069.
mysql-test/t/subselect3.test:
Added test case for bug #39069.
sql/sql_select.cc:
Bug #39069: <row constructor> IN <table-subquery> seriously
messed up
The JOIN::exec method has been modified to take into account
the value of the JOIN::having_value field.
Dirty close tricky does not work on Windows.
mysql-test/r/query_cache_notembedded.result:
Remove test case result.
mysql-test/t/query_cache_notembedded.test:
Remove test case.
Re-generated the PKI files needed.
Removed the ones that are not needed.
Updated the tests to reference the correct SSL subject.
mysql-test/r/openssl_1.result:
Bug #42366: Updated the tests to reference the correct SSL subject
mysql-test/std_data/cacert.pem:
Bug #42366: Re-generated the PKI files needed.
mysql-test/std_data/client-cert.pem:
Bug #42366: Re-generated the PKI files needed.
mysql-test/std_data/client-key.pem:
Bug #42366: Re-generated the PKI files needed.
mysql-test/std_data/server-cert-des.pem:
Bug #42366: Removed the ones that are not needed.
mysql-test/std_data/server-cert.pem:
Bug #42366: Re-generated the PKI files needed.
mysql-test/std_data/server-key-des.pem:
Bug #42366: Removed the ones that are not needed.
mysql-test/std_data/server-key.pem:
Bug #42366: Re-generated the PKI files needed.
mysql-test/std_data/server8k-cert.pem:
Bug #42366: Re-generated the PKI files needed.
mysql-test/std_data/server8k-key.pem:
Bug #42366: Re-generated the PKI files needed.
mysql-test/t/openssl_1.test:
Bug #42366: Updated the tests to reference the correct SSL subject
The problem is that the query cache was storing partial results
if the statement failed when sending the results to the client.
This could cause clients to hang when trying to read the results
from the cache as they would, for example, wait indefinitely for
a eof packet that wasn't saved.
The solution is to always discard the caching of a query that
failed to send its results to the associated client.
mysql-test/r/query_cache_notembedded.result:
Add test case result for Bug#40264
mysql-test/t/query_cache_notembedded.test:
Add test case for Bug#40264
sql/sql_cache.cc:
Abort if a unreported error was raised.
The problem is that the query cache stores packets containing
the server status of the time when the cached statement was run.
This might lead to a wrong transaction status in the client side
if a statement is cached during a transaction and is later served
outside a transaction context (and vice-versa).
The solution is to take into account the transaction status when
storing in and serving from the query cache.
mysql-test/r/innodb_cache.result:
Update test case result.
mysql-test/r/query_cache.result:
Add test case result for Bug#36326
mysql-test/t/query_cache.test:
Add test case for Bug#36326
sql/mysql_priv.h:
Add new flags.
sql/sql_cache.cc:
Remember the transaction and autocommit status stored in the packet.
tests/mysql_client_test.c:
Add test case for Bug#36326
The greedy optimizer tracks the current level of nested joins and the position
inside these by setting and maintaining a state that's global for the whole FROM
clause.
This state was correctly maintained inside the selection of the next partial plan
table (in best_extension_by_limited_search()).
greedy_search() also moves the current position by adding the last partial match
table when there's not enough tables in the partial plan found by
best_extension_by_limited_search().
This may require update of the global state variables that describe the current
position in the plan if the last table placed by greedy_search is not a top-level
join table.
Fixed by updating the state after placing the partial plan table in greedy_search()
in the same way this is done on entering the best_extension_by_limited_search().
Fixed the signature of the function called to update the state :
check_interleaving_with_nj
mysql-test/r/greedy_optimizer.result:
Bug #38795: test case
mysql-test/t/greedy_optimizer.test:
Bug #38795: test case
sql/sql_select.cc:
Bug #38795: correctly update current position when placing
the next partial plan table in greedy_search().
When substituting system constant functions with a constant result
the server was not expecting that the function may return NULL.
Fixed by checking for NULL and returning Item_null (in the relevant
collation) if the result of the system constant function was NULL.
mysql-test/r/mysql.result:
Bug #41437: test case
mysql-test/t/mysql.test:
Bug #41437: test case.
Relies on database() returning NULL if no database is
selected.
sql/item_strfunc.cc:
Bug #41437: Check for NULL result on evaluating the system
constant function and return a constant NULL item.
Passing dubious "year zero" in non-zero date (not "0000-00-00") could
lead to negative value for year internally, while variable was unsigned.
This led to Really Bad Things further down the line.
Now doing calculations with signed type for year internally.
mysql-test/r/date_formats.result:
show that very early dates no longer break DATE_FORMAT(..., '%W')
mysql-test/t/date_formats.test:
show that very early dates no longer break DATE_FORMAT(..., '%W')
sql-common/my_time.c:
Allow negative years numbers internally while keeping the interface.
otherwise if somebody passes year zero for whatever reason, we'll
get an integer wrap-around that can lead to Really Bad Things further
down the line. Note that amusingly, calcday_nr() already had signed
output and calc_weekday() already had signed input, anyway.
Added global status variable 'Queries' which represents
total amount of queries executed by server including
statements executed by SPs.
note: It's old behaviour of 'Questions' variable.
mysql-test/r/status.result:
test result
mysql-test/t/status.test:
test case
sql/mysqld.cc:
Added global status variable 'Queries' which represents
total amount of queries executed by server including
statements executed by SPs.
note: It's old behaviour of 'Questions' variable.
sql/sql_show.cc:
Added global status variable 'Queries' which represents
total amount of queries executed by server including
statements executed by SPs.
note: It's old behaviour of 'Questions' variable.
sql/structs.h:
Added global status variable 'Queries' which represents
total amount of queries executed by server including
statements executed by SPs.
note: It's old behaviour of 'Questions' variable.
Table could be marked dependent because it is
either 1) an inner table of an outer join, or 2) it is a part of
STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not
be assigned. The fix is to set st_table::maybe_null to 'true' only
for those tables which are used in outer join.
mysql-test/r/select.result:
test result
mysql-test/t/select.test:
test case
sql/sql_select.cc:
Table could be marked dependent because it is
either 1) an inner table of an outer join, or 2) it is a part of
STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not
be assigned. The fix is to set st_table::maybe_null to 'true' only
for those tables which are used in outer join.
sql/sql_select.h:
added comment
init user->user struct with
thd->security_ctx->priv_user context
if user->user is not initializied
mysql-test/r/grant.result:
test result
mysql-test/t/grant.test:
test case
sql/set_var.cc:
init user->user struct with
thd->security_ctx->priv_user context
if user->user is not initializied
replace wild_case_compare with my_wildcmp which is multibyte safe function
mysql-test/r/lowercase_utf8.result:
test result
mysql-test/t/lowercase_utf8-master.opt:
test case
mysql-test/t/lowercase_utf8.test:
test case
sql/sql_show.cc:
replace wild_case_compare with my_wildcmp which is multibyte safe function
The MONTHNAME/DAYNAME functions
returns binary string, so the LOWER/UPPER functions
are not effective on the result of MONTHNAME/DAYNAME call.
Character set of the MONTHNAME/DAYNAME function
result has been changed to connection character set.
include/m_ctype.h:
added my_charset_repertoire function
mysql-test/r/ctype_ucs.result:
test result
mysql-test/r/func_time.result:
test result
mysql-test/t/ctype_ucs.test:
test case
mysql-test/t/func_time.test:
test case
sql/item_timefunc.cc:
Item_func_monthname::fix_length_and_dec and
Item_func_dayname::fix_length_and_dec methods have been
modified to use connection character set
sql/item_timefunc.h:
Item_func_monthname::fix_length_and_dec and
Item_func_dayname::fix_length_and_dec methods have been
modified to use connection character set
sql/mysql_priv.h:
added max_month_name_length, max_day_name_length fields into MY_LOCALE struct
sql/mysqld.cc:
The test_lc_time_sz function controls modifications
of the locale database in debugging mode.
sql/sql_locale.cc:
initialization of max_month_name_length, max_day_name_length fields
strings/ctype.c:
added my_charset_repertoire function
- QUICK_INDEX_MERGE_SELECT deinitializes its rnd_pos() scan when it reaches EOF, but we
need to make the deinitialization in QUICK_INDEX_MERGE_SELECT destructor also. This is because
certain execution strategies can stop scanning without reaching EOF, then then try to do a full
table scan on this table. Failure to deinitialize caused the full scan to use (already empty)
table->sort and produce zero records.
mysql-test/r/index_merge.result:
BUG#40974: Incorrect query results when using clause evaluated using range check
- Testcase
mysql-test/t/index_merge.test:
BUG#40974: Incorrect query results when using clause evaluated using range check
- Testcase
IF(..., CAST(longtext AS UNSIGNED), signed_val)
(was: LEFT JOIN on inline view crashes server)
Select from a LONGTEXT column wrapped with an expression
like "IF(..., CAST(longtext_column AS UNSIGNED), smth_signed)"
failed an assertion or crashed the server. IFNULL function was
affected too.
LONGTEXT column item has a maximum length of 32^2-1 bytes,
at the same time this is a maximum possible length of any
MySQL item. CAST(longtext_column AS UNSIGNED) returns some
unsigned numeric result of length 32^2-1, so the result of
IF/IFNULL function of this number and some other signed number
will have text length of (32^2-1)+1=32^2 (one byte for the
minus sign) - there is integer overflow, and the length is
equal to zero. That caused assert/crash.
CAST AS UNSIGNED function has been modified to limit maximal
length of resulting number to 67 (maximal length of DECIMAL
and two characters for minus sign and dot).
mysql-test/r/func_if.result:
Added test case for bug #40761.
mysql-test/t/func_if.test:
Added test case for bug #40761.
sql/item_func.h:
Bug #40761: Assert on sum function on
IF(..., CAST(longtext AS UNSIGNED), signed_val)
CAST AS UNSIGNED function has been modified to limit maximal
length of resulting number to 67 (maximal length of DECIMAL
and two characters for minus sign and dot).
IF(..., CAST(longtext AS UNSIGNED), signed_val)
(was: LEFT JOIN on inline view crashes server)
Select from a LONGTEXT column wrapped with an expression
like "IF(..., CAST(longtext_column AS UNSIGNED), smth_signed)"
failed an assertion or crashed the server. IFNULL function was
affected too.
LONGTEXT column item has a maximum length of 32^2-1 bytes,
at the same time this is a maximum possible length of any
MySQL item. CAST(longtext_column AS UNSIGNED) returns some
unsigned numeric result of length 32^2-1, so the result of
IF/IFNULL function of this number and some other signed number
will have text length of (32^2-1)+1=32^2 (one byte for the
minus sign) - there is integer overflow, and the length is
equal to zero. That caused assert/crash.
The bug has been fixed by the same solution as in the CASE
function implementation.
mysql-test/r/func_if.result:
Added test case for bug #40761.
mysql-test/t/func_if.test:
Added test case for bug #40761.
sql/item_cmpfunc.cc:
Bug #40761: Assert on sum function on
IF(..., CAST(longtext AS UNSIGNED), signed_val)
1. Item_func_case::agg_str_lengths method has been moved
to the Item_func superclass.
2. Item_func_ifnull/Item_func_if::fix_length_and_dec methods
have been updated to calculate max_length, decimals and
unsigned flag like Item_func_case.
sql/item_cmpfunc.h:
Bug #40761: Assert on sum function on
IF(..., CAST(longtext AS UNSIGNED), signed_val)
Item_func_case::agg_str_lengths method has been moved to
the Item_func superclass.
sql/item_func.cc:
Bug #40761: Assert on sum function on
IF(..., CAST(longtext AS UNSIGNED), signed_val)
Item_func_case::agg_str_lengths method has been moved to
the Item_func superclass.
sql/item_func.h:
Bug #40761: Assert on sum function on
IF(..., CAST(longtext AS UNSIGNED), signed_val)
Item_func_case::agg_str_lengths method has been moved to
the Item_func superclass.
Fix parsing of mysql client commands, especially in relation to
single-line comments when --comments was specified.
This is a little tricky, because we need to allow single-line
comments in the middle of statements, but we don't want to allow
client commands in the middle of statements. So in
comment-preservation mode, we go ahead and send single-line
comments to the server immediately when we encounter them on their
own.
This is still slightly flawed, in that it does not handle a
single-line comment with leading spaces, followed by a client-side
command when --comment has been enabled. But this isn't a new
problem, and it is quite an edge condition. Fixing it would require
a more extensive overall of how the mysql client parses commands.
Removed values with more than 15 significant digits from the test case. Results of
reading/printing such values using system library functions depend on implementation
and thus are not portable.
mysql-test/r/type_float.result:
Removed values with more than 15 significant digits from the test case.
mysql-test/t/type_float.test:
Removed values with more than 15 significant digits from the test case.
if table has bit fields then uneven bits(if exist) are stored into null bits place.
So we need to copy null bits in case of uneven bit field presence.
mysql-test/r/type_bit.result:
test result
mysql-test/t/type_bit.test:
test case
sql/sql_select.cc:
if table has bit fields then uneven bits(if exist) are stored into null bits place.
So we need to copy null bits in case of uneven bit field presence.
added ability for TINY[MEDIUM] text fields
to be converted to greater subtype during
alter if necessary(altered charset)
mysql-test/r/alter_table.result:
test result
mysql-test/t/alter_table.test:
test case
sql/sql_table.cc:
added ability for TINY[MEDIUM] text fields
to be converted to greater subtype during
alter if necessary(altered charset)
the problem: FORMAT func max_length value was calculated incorrectly
the fix: correct calculation of max_length
mysql-test/r/func_str.result:
test result
mysql-test/t/func_str.test:
test case
sql/item_strfunc.h:
the problem: FORMAT func max_length value was calculated incorrectly
the fix: correct calculation of max_length
show default value for BIT field in printable format
mysql-test/r/type_bit.result:
Bug#35796 SHOW CREATE TABLE and default value for BIT field
test result
mysql-test/t/type_bit.test:
Bug#35796 SHOW CREATE TABLE and default value for BIT field
test case
sql/item.cc:
Bug#35796 SHOW CREATE TABLE and default value for BIT field
issue an error if BIN|HEX deafult value is empty value
(behaviour like for INT fields)
The reason for the failures was bug #21205 (fixed in 6.0 by dtoa, but still present in 5.0/5.1).
mysql-test/r/type_float.result:
Modified the failing test case so that bug #21205 does not occur.
mysql-test/t/type_float.test:
Modified the failing test case so that bug #21205 does not occur.
Bug #41173 rpl_packet fails sporadically on pushbuild: query 'DROP TABLE t1' failed
The both issues appeared to be a race between the SQL thread executing CREATE table t1
and the IO thread that is expected to stop at the consequent big size event.
The two events need serialization which is implemented.
The early bug required back-porting a part fixes for bug#38350 exclusively for 5.0 version.
mysql-test/r/rpl_packet.result:
results changed due to bug#33420, bug#41173.
mysql-test/t/rpl_packet.test:
adding synchronization for sql and io thread (bug#41173 problem).
simplifying the output to show only a relevant info (5.0 sole problem bug#33420).
bigint' fails on windows.
Visual Studio does not take into account some x86 hardware limitations
which leads to incorrect results when converting large DOUBLE values
to BIGINT UNSIGNED ones.
Fixed by adding a workaround for double->ulonglong conversion on
Windows.
include/config-win.h:
Added double2ulonglong(double) function implementing a workaround for
broken double->ulonglong conversion on Windows/x86.
include/my_global.h:
Define double2ulonglong() as a simple typecast for anything but
Windows.
mysql-test/r/type_float.result:
Added a test case for bug #27483.
mysql-test/t/type_float.test:
Added a test case for bug #27483.