- Port grant_explain_non_select.{test,result} from mysql-5.6
- Per Sanja's hint, fix mysql_make_view() to take into
account that EXPLAIN now is not necessarily EXPLAIN SELECT.
- Fix a problem with EXPLAIN multi_table UPDATE:
= Do use multi_update object, because multi_update::prepare() does
various setup, e.g. it disables index-only for the tables to be updated.
= Protect multi_update::prepare() from being invoked multiple times.
If the query has subqueries, they may try to invoke it, for some reason.
Update the SHOW EXPLAIN code to work with the
new architecture (part#1):
Before, SHOW EXPLAIN operated on real query plan structures,
which meant it had to check when SELECTs are created/deleted.
SELECTs would call apc_target->enable() when they got a query
plan and disable() when their query plan was deleted.
Now, Explain data structure becomes available at once (and we
call apc_target->enable()) and then it stays until it is deleted
(when that happens, we call apc_target->disable()).
Objects of the classes Item_func_isnull and Item_func_isnotnull
must have the flag sargable set to TRUE.
Set the value of the flag sargable only in constructors of the
classes inherited from Item_int_func.
Make IO thread check for end of event group, so that upon
disconnect at the end of an event group it can report the last
read GTID as expected. Also inject a fake Rotate event at
reconnect when skipping part of an initial event group, to
give SQL thread the correct Read_Master_Log_Pos.
Reported by Pavel Ivanov.
The bug caused a memory overwrite in the function update_ref_and_keys()
It happened due to a wrong value of SELECT_LEX::cond_count. This value
historically was calculated by the fix_fields method. Now the logic of
calling this method became too complicated and, as a result, this value
is calculated not always correctly.
The patch changes the way how and when the values of SELECT_LEX::cond_count
and of SELECT_LEX::between_count are calculated. The new code does it just at
the beginning of update_ref_and_keys().
- Don't save UNION's EXPLAIN data if optimization failed with
an error. We could end up saving incomplete plan, which will
cause a crash when we attempt to print it.
Backport mysql-test/t/myisam_explain_non_select_all.test from mysql-5.6
- the .result file was modified because MariaDB choses different
query plans in a number cases. Also, we don't have some of the
"incorrect EXPLAIN output" bugs that they still have.
The .test file and includes were taken verbatim with one
exception: two tests were disabled with --disable parsing:
1. @@sql_safe_updates is not enforced EXPLAINs of multitable
updates. In MariaDB, the execution itself will produce
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, but EXPLAIN won't.
2. Their case #71 hits some old bug in MyISAM (See their comments
in explain_non_select.inc for details).
The Gis_point::init_from_wkt called the String::realloc(),
and this call is quite slow in the DEBUG mode. Which makes
loading the huge polygon hang forever.
Fixed by using the String::realloc(size, inc_size) version instead
as it's done for other spatial features.
- Generate correct contents of `Extra` column for UPDATEs/DELETEs that use quick selects
- UPDATEs with used_key_is_modified=true will show "Using buffer"
Do not pass PCRE_UCP flag for binary data.
This makes bytes 0x80..FF not to belong to
generic character classes \d (digit) and \w (word character).
SELECT 0xFF RLIKE '\\w';
-> 0
Note, this change does not affect non-binary data,
which is still examined with the PCRE_UCP flag by default.
- Run probes like MYSQL_INSERT_SELECT_START or
MYSQL_MULTI_DELETE_START for EXPLAIN, too.
We should run them, because 1. EXPLAIN SELECT does it, and
2. MySQL also does it.
For aggregated fields from views/derived tables the possible adjustment
of thd->lex->in_sum_func->max_arg_level in the function Item_field::fix_fields
must be done before we leave the function.
Fixing compilation failure on Solaris.
The int64_t type was not defined because stdint.h was not included
due to a missing definition in pcre/config-cmake.h.in.