Commit graph

25671 commits

Author SHA1 Message Date
Evgeny Potemkin
60fc8507bd Bug#30302: Tables that were optimized away are printed in the
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.
2009-10-19 15:13:26 +04:00
Vladislav Vaintroub
3c55783320 Bug #48047 Can't do normal shutdown
Fix a regression that crept in when downporting Windows improvements.
Instead of a shutdown thread, another thread that  handledsocket connection was created.
2009-10-15 05:18:52 +02:00
Gleb Shchepa
1360ca0962 Backport of fix to bug #33629 into mysql-next-mr-bugfixing.
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.
2009-10-13 21:50:08 +05:00
Sergei Golubchik
285257f7c8 bug#33731 - INSTALL/UNINSTALL PLUGIN: Inconsistent handling of identifier case
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.
2009-10-12 20:15:10 +02:00
Alexander Nozdrin
192faa573d Pull from mysql-next-mr. 2009-10-09 13:50:49 +04:00
Alexander Nozdrin
01b455d84e Merge from mysql-next-mr. 2009-10-08 11:42:38 +04:00
Alexander Nozdrin
63e5078825 A backport of a patch for Bug#35297.
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.
2009-10-08 00:57:03 +04:00
Alexander Nozdrin
5281fa364e A backport a patch of Bug#34828.
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.
2009-10-07 20:49:26 +04:00
Alexander Nozdrin
9384835087 A backport of patch for Bug#26704.
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.
2009-10-07 20:39:57 +04:00
Guilhem Bichot
56312dc7cf Backport of the fix for BUG#33730 "Full table scan instead selected partitions for query more than 10 partitions"
from 6.0, made in sergefp@mysql.com-20090205190644-q8632sniogedhtsu
2009-10-05 22:59:19 +02:00
Alexander Nozdrin
b966a29740 Merge from mysq-next-mr-wtf. 2009-10-02 16:14:59 +04:00
Alexander Nozdrin
d23d61ef60 Merge from mysql-next-mr. 2009-10-02 16:02:56 +04:00
Vladislav Vaintroub
4acaca0202 backport of
Revision: 
2597.72.1 revid:sp1r-Reggie@core.-20080403153947-15243
removed instances of __NT__ from code. We now only build "NT" binaries
2009-09-30 22:10:22 +02:00
Vladislav Vaintroub
14c2cfb568 Backport of this changeset
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()
2009-09-30 17:40:12 +02:00
Vladislav Vaintroub
eaba74fee5 Backport http://lists.mysql.com/commits/57778
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
2009-09-30 15:35:01 +02:00
Alexander Barkov
f02800bd97 Backporting WL#3759 Optimize identifier conversion in client-server protocol
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.
2009-09-30 10:09:28 +05:00
Vladislav Vaintroub
b73763e0f9 Backport of the patch
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".
2009-09-30 03:39:37 +02:00
Georgi Kodinov
e004e26624 merge mysql-trunk-wl4444_4571 to mysql-wl3220-next-mr 2009-09-29 10:34:37 +03:00
Mikael Ronstrom
ccae404afa Merge to mysql-next-mr 2009-09-28 09:39:50 +02:00
Georgi Kodinov
2118bd104c Ported WL#3220 to mysql-next-mr. 2009-09-28 10:21:25 +03:00
Marc Alff
1ecaf1bc1e Merge mysql-next-mr (revno 2882) --> mysql-trunk-signal 2009-09-22 09:22:22 -06:00
Bjorn Munch
bb181d25cb new merge from trunk 2009-09-21 11:43:01 +02:00
Marc Alff
4fa77f94b6 Merge mysql-next-mr (revno 2880) --> mysql-trunk-signal 2009-09-20 22:50:05 -06:00
Bjorn Munch
f89b36fcbf new merge from trunk 2009-09-18 16:44:11 +02:00
Alexander Nozdrin
adb4d9c4a6 Merge 5.1-bugteam -> trunk-alik (up to revno:3111). 2009-09-18 10:55:20 +04:00
Sergey Glukhov
2535ede713 Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
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
2009-09-17 16:33:23 +05:00
Marc Alff
071634bb35 Merge mysql-next-mr --> mysql-trunk-signal 2009-09-17 03:20:11 -06:00
Alexander Nozdrin
80c91e4298 Merge from mysql-5.1-bugteam. 2009-09-16 10:52:43 +04:00
Kristofer Pettersson
7ee331ab5d autocommit 2009-09-15 09:34:30 +02:00
Kristofer Pettersson
d98625d5ca autocommit 2009-09-15 09:33:25 +02:00
Mattias Jonsson
23dc8abe2b merge 2009-09-12 00:40:23 +02:00
Ramil Kalimullin
b6c16b329a Fix for bug#47130: misplaced or redundant check for null pointer?
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.
2009-09-11 22:06:27 +05:00
Sergey Glukhov
0412a7c753 5.0-bugteam->5.1-bugteam merge 2009-09-10 15:30:03 +05:00
Sergey Glukhov
10406ae658 Bug#46815 CONCAT_WS returning wrong data
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.
2009-09-10 15:24:07 +05:00
unknown
e436b8866b BUG#45999 Row based replication fails when auto_increment field = 0
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. ..
2009-09-10 18:05:53 +08:00
Mikael Ronstrom
ec5b259543 Automerge 2009-09-10 11:18:50 +02:00
Marc Alff
63e56390a3 WL#2110 (SIGNAL)
WL#2265 (RESIGNAL)

Manual merge of SIGNAL and RESIGNAL to mysql-trunk-signal,
plus required dependencies.
2009-09-10 03:18:29 -06:00
Mikael Ronstrom
d0d52e9f11 WL#4444 Added TRUNCATE partition support, fixes bug#19405 and bug #35111 2009-09-10 11:15:39 +02:00
Mikael Ronstrom
52d9a4d3d6 WL#4571, Enable Key cache defined for a partition to enable more scalability on partitioned MyISAM tables among other things 2009-09-10 11:14:23 +02:00
Sergey Glukhov
104d9ce76a Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
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
2009-09-10 13:49:49 +05:00
Sergey Vojtovich
6d3e743d5b Merge 5.1-bugteam -> 5.1-bugteam-local. 2009-09-10 13:38:59 +05:00
Alexander Nozdrin
70972926ab A patch for Bug#45118 (mysqld.exe crashed in debug mode
on Windows in dbug.c) -- part 2: a patch for the DBUG subsystem
to detect misuse of DBUG_ENTER / DBUG_RETURN macros.
5.1 version.
2009-09-10 11:40:57 +04:00
Sergey Vojtovich
eb7a3fc9cb Local merge. 2009-09-10 11:54:26 +05:00
Sergey Vojtovich
32055c1c72 Local merge. 2009-09-10 11:53:35 +05:00
Sergey Vojtovich
3228a2be66 BUG#45638 - Create temporary table with engine innodb fails
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.
2009-09-09 14:38:50 +05:00
Georgi Kodinov
0ab24bef29 automerge 2009-09-08 12:37:09 +03:00
Alexey Kopytov
0a7e41864c Automerge. 2009-09-08 12:36:40 +04:00
Martin Hansson
fe3b6356ca Bug#46259: Merge 2009-09-07 16:52:47 +02:00
Mikael Ronstrom
bdd4374445 Automerge 2009-09-07 12:22:57 +02:00
Martin Hansson
2cb3a131f4 Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
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.
2009-09-07 11:57:22 +02:00