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.
PCRE unit tests failed on Ubuntu Precise, because "source"
is not a known command in "dash" (the default shell in Precise).
Changing "source" to ".", which should be understood in all shells.
Apparently in a general case a short-cut for the distinct optimization
is invalid if join buffers are used to join tables after the tables whose
values are to selected.
MDEV-4425 Regexp enhancements
Adding ${CMAKE_BINARY_DIR}/pcre into search path for *.h files.
Needed for find pcre.h (which is generated from pcre.h.in) when
build directory != source directory.
Adding ${CMAKE_BINARY_DIR}/pcre into search path for *.h files.
Needed for find pcre.h (which is generated from pcre.h.in) when
build directory != source directory.
- Make EXPLAIN UPDATE/DELETE work inside SPs
- Return correct error code from mysql_delete()
- EXPLAIN <multi-DELETE> will create a multi_delete object (as it
affects the optimization). select_result will be only used for
producing EXPLAIN output.
--replace_regex /.prefix.sql.share.charsets[/\]/MYSQL_CHARSETSDIR/
select @@global.character_sets_dir;
The intention of the '[/\]' part was to replace both slash
'/' and backslash '\\', so it does not depend on the OS.
The pattern '[/\]' was actually wrong, because ']' is escaped
and should be considered as a part of the class, instead of
being a closing bracket for the class. However, due to some bug
in the old REGEX library it worked fine.
After switching to PCRE, mysqltest correctly complains about unbalaced '[]'.
The expected correct pattern should be '[/\\]'.
However, due to some bug in mysqltest, it eats consequetive baskslashes
in a strange way, so there is no a way to have to consequetive
backslashes after unescaping.
Workaround:
using [[:punct:]] as a pattern that matches both slash and backslash,
which should be fine for this test purposes.
libmysqld.a(pcre_exec.c.o): relocation R_X86_64_32S against
`_pcre_ucd_stage1' can not be used when making a shared object;
make[2]: Leaving directory `/mnt/buildbot/build/mariadb-10.0.3'
recompile with -fPIC
Changing ADD_LIBRARY(pcre) to ADD_CONVENIENCE_LIBRARY(pcre)
"PCRE_STATIC" must be defined before including pcre.h
to avoid linking errors:
- unresolved external symbol __imp_regerror
- unresolved external symbol __imp_pcre_exec