EXPLAIN EXTENDED warning.
Query optimizer searches for the constant tables and optimizes them away. This
means that fields of such tables are substituted for their values and on later
phases they are treated as constants. After this constant tables are removed
from the query execution plan. Nevertheless constant tables were shown in
the EXPLAIN EXTENDED warning thus producing query that might be not an
equivalent of the original query.
Now the print_join function skips all tables that were optimized away from
printing to the EXPLAIN EXTENDED warning. If all tables were optimized away it
produces the 'FROM dual' clause.
mysql-test/r/explain.result:
A test case added for the bug#30302.
mysql-test/r/func_default.result:
Adjusted test case result after fix for the bug#30302.
mysql-test/r/func_regexp.result:
Adjusted test case result after fix for the bug#30302.
mysql-test/r/func_test.result:
Adjusted test case result after fix for the bug#30302.
mysql-test/r/having.result:
Adjusted test case result after fix for the bug#30302.
mysql-test/r/select.result:
Adjusted test case result after fix for the bug#30302.
mysql-test/r/subselect.result:
Adjusted test case result after fix for the bug#30302.
mysql-test/r/subselect3.result:
Adjusted test case result after fix for the bug#30302.
mysql-test/r/type_datetime.result:
Adjusted test case result after fix for the bug#30302.
mysql-test/t/explain.test:
A test case added for the bug#30302.
sql/sql_select.cc:
Bug#30302: Tables that were optimized away are printed in the
EXPLAIN EXTENDED warning.
Now the print_join function skips all tables that were optimized away from
printing to the EXPLAIN EXTENDED warning. If all tables were optimized away it
produces the 'FROM dual' clause.
sql/table.h:
Adjusted test case result after fix for the bug#30302.
The optimized_away flag is added to the TABLE_LIST struct.
Fix a regression that crept in when downporting Windows improvements.
Instead of a shutdown thread, another thread that handledsocket connection was created.
Bug #33629: last_day function can return null, but has 'not null' flag set for result
LAST_DAY and MAKEDATE functions are documented as
returning NULL value, but actually they was implemented
as returning NOT NULL typed values.
That caused a confusing error "ERROR 1048 (23000): Column
'...' cannot be null" on queries like:
SELECT 1 FROM (SELECT LAST_DAY('0')) a;
mysql-test/r/func_sapdb.result:
Updated test case for bug #33629.
mysql-test/r/func_time.result:
Updated test case for bug #33629.
mysql-test/r/type_date.result:
Added test case for bug #33629.
mysql-test/t/type_date.test:
Added test case for bug #33629.
sql/item_timefunc.h:
Bug #33629: last_day function can return null, but has 'not null' flag set for result
1. The Item_func_makedate::fix_length_and_dec method
has been modified to declare MAKEDATE() as a function
returning nullable value.
2. The Item_func_last_day::fix_length_and_dec method
has been overloaded for the same purpose.
indexed column in mysql.plugin table should use case-insensitive collation
for index lookups to work
(backport from 6.0)
sql/sql_plugin.cc:
generate the key correctly using key_copy.
field->store() stores the value in record format, not key format.
Original revision in mysql-6.0-codebase is:
revno: 2617.31.14
committer: Konstantin Osipov <kostja@sun.com>
branch nick: mysql-6.0-runtime
timestamp: Sat 2009-03-28 11:42:55 +0300
message:
Bug#35297 SHOW CREATE EVENT does not show the DEFINER:
update test result after a merge from now.
Original revision is from mysql-6.0-codebase:
revno: 2617.23.13
committer: Alexander Nozdrin <alik@sun.com>
branch nick: 6.0-rt-bug34828
timestamp: Tue 2009-02-24 14:25:46 +0300
message:
A patch for Bug#34828: OF is taken as OFF and a value of 0
is set for variable SQL_notes.
The problem was that partial match was allowed for keywords.
A fix is to disable partial match and require full match.
Original revision is from mysql-6.0-codebase:
revno: 2630.3.1
committer: Alexander Nozdrin <alik@mysql.com>
branch nick: 6.0-rt-bug26704
timestamp: Thu 2008-05-29 21:04:06 +0400
message:
A fix for Bug#26704: Failing DROP DATABASE brings
mysql-client out of sync.
The problem was that we changed current database w/o caring
whether it was dropped successfully or not.
The fix is not to change current database if we failed to drop it.
http://lists.mysql.com/commits/59686
Cleanup pthread_self(), pthread_create(), pthread_join() implementation on Windows.
Prior implementation is was unnecessarily complicated and even differs in embedded
and non-embedded case.
Improvements in this patch:
* pthread_t is now the unique thread ID, instead of HANDLE returned by beginthread
This simplifies pthread_self() to be just straight GetCurrentThreadId().
prior it was much art involved in passing the beginthread() handle from the caller
to the TLS structure in the child thread ( did not work for the main thread of
course)
* remove MySQL specific my_thread_init()/my_thread_end() from pthread_create.
No automagic is done on Unix on pthread_create(). Having the same on Windows will
improve portability and avoid extra #ifdef's
* remove redefinition of getpid() - it was defined as GetCurrentThreadId()
2677 Vladislav Vaintroub 2008-11-04
CMakeLists.txt files cleanup
- remove SAFEMALLOC and SAFE_MUTEX definitions that were
present in *each* CMakeLists.txt. Instead, put them into top level
CMakeLists.txt, but disable on Windows, because
a) SAFEMALLOC does not add any functionality that is not already
present in Debug C runtime ( and 2 safe malloc one on top of the other
only unnecessarily slows down the server)
b)SAFE_MUTEX does not work on Windows and have been
explicitely disabled on Windows with #undef previously. Fortunately,
ntdll does pretty good job identifying l problems with
CRITICAL_SECTIONs.
DebugBreak()s on using uninited critical section, unlocking unowned
critical section)
-Also, remove occationally used -D_DEBUG (added by compiler
anyway)
sql/udf_example.c:
use unixish end of line
This patch provides performance improvements:
- send_fields() when character_set_results = latin1
is now about twice faster for column/table/database
names, consisting on ASCII characters.
Changes:
- Protocol doesn't use "convert" temporary buffer anymore,
and converts strings directly to "packet".
- General conversion optimization: quick conversion
of ASCII strings was added.
modified files:
include/m_ctype.h
- Adding a new flag.
- Adding a new function prototype
libmysqld/lib_sql.cc
- Adding quick conversion method for embedded library:
conversion is now done directly to result buffer,
without using a temporary buffer.
mysys/charset.c
- Mark all dynamic ucs2 character sets as non-ASCII
- Mark some dymamic 7bit and 8bit charsets as non-ASCII
(for example swe7 is not fully ASCII compatible).
sql/protocol.cc
- Adding quick method to convert a string directly
into protocol buffer, without using a temporary buffer.
sql/protocol.h
- Adding a new method prototype
sql/sql_string.cc
Optimization for conversion between two ASCII-compatible charsets:
- quickly convert ASCII strings,
switch to mc_wc->wc_mb method only when a non-ASCII character is met.
- copy four ASCII characters at once on i386
strings/conf_to_src.c
- Marking non-ASCII character sets with a flag.
strings/ctype-extra.c
- Regenerating ctype-extra.c by running "conf_to_src".
strings/ctype-uca.c
- Marking UCS2 character set as non-ASCII.
strings/ctype-ucs2.c
- Marking UCS2 character set as non-ASCII.
strings/ctype.c
- A new function to detect if a 7bit or 8bit character set
is ascii compatible.
http://lists.mysql.com/commits/57725
Vladislav Vaintroub 2008-11-03
Cleanup CMakeLists.txt(s) - remove winsock2 (ws2_32) from
TARGET_LINK_LIBRARIES.
Every exe or dll linked with mysys needs ws2_32, because
mysys uses winsock function WSAStartup in my_init().
However, there is no need to explicitely add ws2_32 to
the list of TARGET_LINK_LIBRARIES multiple times.
Visual Studio comes with a handy pragma that tells linker
to add library. So patch replaces bunch of ws2_32 in
CMakeLists with single pragma comment(lib,"ws2_32")
in my_init.c
Additionally, reference to non-existing "debug" library
has been removed from TARGET_LINK_LIBRARIES. The correct
name of the library is "dbug".
additional backport of of bug43138 fix
mysql-test/t/myisam-system.test:
additional backport of of bug43138 fix
sql/sql_db.cc:
additional backport of of bug43138 fix
Problem: LOGGER::general_log_write() relied on valid "thd" parameter passed
but had inconsistent "if (thd)" check.
Fix: as we always pass a valid "thd" parameter to the method,
redundant check removed.
sql/log.cc:
Fix for bug#47130: misplaced or redundant check for null pointer?
- code clean-up, as we rely on the "thd" parameter in the
LOGGER::general_log_write(), redundant "if (thd)" check removed,
added assert(thd) instead.
The problem is that argument buffer can be used as result buffer
and it leads to argument value change.
The fix is to use 'old buffer' as result buffer only
if first argument is not constant item.
mysql-test/r/func_str.result:
test result
mysql-test/t/func_str.test:
test case
sql/item_strfunc.cc:
The problem is that argument buffer can be used as result buffer
and it leads to argument value change.
The fix is to use 'old buffer' as result buffer only
if first argument is not constant item.
In RBR, There is an inconsistency between slaves and master.
When INSERT statement which includes an auto_increment field is executed,
Store engine of master will check the value of the auto_increment field.
It will generate a sequence number and then replace the value, if its value is NULL or empty.
if the field's value is 0, the store engine will do like encountering the NULL values
unless NO_AUTO_VALUE_ON_ZERO is set into SQL_MODE.
In contrast, if the field's value is 0, Store engine of slave always generates a new sequence number
whether or not NO_AUTO_VALUE_ON_ZERO is set into SQL_MODE.
SQL MODE of slave sql thread is always consistency with master's.
Another variable is related to this bug.
If generateing a sequence number is decided by the values of
table->auto_increment_field_not_null and SQL_MODE(if includes MODE_NO_AUTO_VALUE_ON_ZERO)
The table->auto_increment_is_not_null is FALSE, which causes this bug to appear. ..
partial backport of bug43138 fix
mysql-test/r/warnings.result:
test result
mysql-test/t/warnings.test:
test case
sql/sql_class.cc:
partial backport of bug43138 fix
sql/sql_class.h:
partial backport of bug43138 fix
sql/sql_table.cc:
partial backport of bug43138 fix
Create temporary InnoDB table fails on case insensitive
filesystems, when lower_case_table_names is 2 (e.g. OS X)
and temporary directory path contains upper case letters.
The problem was that tmpdir prefix was converted to lower
case when table was created, but was passed as is when
table was opened.
Fixed by leaving tmpdir prefix part intact.
mysql-test/r/lowercase_mixed_tmpdir_innodb.result:
A test case for BUG#45638.
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt:
A test case for BUG#45638.
mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh:
A test case for BUG#45638.
mysql-test/t/lowercase_mixed_tmpdir_innodb.test:
A test case for BUG#45638.
sql/handler.cc:
Fixed get_canonical_filename() to not lowercase filesystem
path prefix for temporary tables.
The parser rule for expressions in a udf parameter list contains
two hacks:
First, the parser input stream is read verbatim, bypassing
the lexer.
Second, the Item::name field is overwritten. If the argument to a
udf was a field, the field's name as seen by name resolution was
overwritten this way.
If the field name was quoted or escaped, it would appear as e.g. "`field`".
Fixed by not overwriting field names.
mysql-test/r/udf.result:
Bug#46259: Test result.
mysql-test/t/udf.test:
Bug#46259: Test case.
sql/sql_yacc.yy:
Bug#46259: Fix.