Commit graph

63338 commits

Author SHA1 Message Date
Ramil Kalimullin
e4d2fd35a7 Auto-merge from mysql-5.1-bugteam. 2010-11-18 13:40:57 +03:00
Sergey Glukhov
1c94d43bbb Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings
ESCAPE argument might be empty string. It leads
to server crash under some circumstances.
The fix:
-added check if ESCAPE argument result is not empty string

mysql-test/r/ctype_latin1.result:
  test case
mysql-test/t/ctype_latin1.test:
  test case
sql/item_cmpfunc.cc:
  -added check if ESCAPE argument result is not empty string
2010-11-18 11:53:08 +03:00
Davi Arnaut
c324624291 Bug#57994: Compiler flag change build error : my_redel.c
Use __builtin_stpcpy only if the system supports stpcpy.
This is necessary as in some cases a call to stpcpy will
be emitted if the built-in can not optimized.

include/m_string.h:
  The expansion of stpcpy (in glibc) causes warnings if the
  return value of strmov is not being used. Since stpcpy is
  a GNU extension and the expansion ends up using a built-in
  provided by GCC, use the compiler provided built-in directly
  when possible. Nonetheless, the C library must have stpcpy
  as a call be emitted if the built-in can not optimized.
2010-11-17 07:41:29 -02:00
Mattias Jonsson
21bc09c26b post-push fix, backported --replace_result patch
for --list_files in mysqltest.

client/mysqltest.cc:
  Backported --replace_result for --list_files.
mysql-test/r/mysqltest.result:
  updated test.
mysql-test/t/mysqltest.test:
  added test for replace_result on list_files.
2010-11-17 10:13:57 +01:00
Mattias Jonsson
dd0a6227c7 post-push fix for test to pass on windows 2010-11-15 23:27:37 +01:00
Mattias Jonsson
027d647521 merge 2010-11-15 16:32:21 +01:00
Alexander Barkov
1b583fa5da Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr'
Problem: When GET_FORMAT() is called two times from the upper
level function (e.g. LEAST in the bug report), on the second
call "res= args[0]->val_str(...)" and str point to the same
String object.

1. Fix: changing the order from
- get val_str into tmp_value then convert to str
to
- get val_str into str then convert to tmp_value

The new order is more correct: the purpose of "str" parameter
is exactly to call val_str() for arguments.
The purpose of String class members (like tmp_value) is to do further
actions on the result.
Doing it in the other way around give unexpected surprises.

2. Using str_value instead of str to do padding, for the same reason.
2010-11-12 13:12:15 +03:00
Alexander Barkov
aa668865e2 Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
Bug#57820 extractvalue crashes

Problem: ExtractValue and Replace crashed in some cases
due to invalid handling of empty and NULL arguments.

Per file comments:

  @mysql-test/r/ctype_ujis.result
  @mysql-test/r/xml.result
  @mysql-test/t/ctype_ujis.test
  @mysql-test/t/xml.test
  Adding tests

  @sql/item_strfunc.cc
  Make sure Item_func_replace::val_str safely handles empty strings.

  @sql/item_xmlfunc.cc
  set null_value if nodeset_func returned NULL,
  which is possible when the second argument is an
  unset user variable.
2010-11-11 13:25:23 +03:00
Davi Arnaut
cd1c6e220d Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
Bug#57994: Compiler flag change build error : my_redel.c
Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc

Fix assorted compiler generated warnings.

cmd-line-utils/readline/bind.c:
  Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
  
  Initialize variable to work around a false positive warning.
include/m_string.h:
  Bug#57994: Compiler flag change build error : my_redel.c
  
  The expansion of stpcpy (in glibc) causes warnings if the
  return value of strmov is not being used. Since stpcpy is
  a GNU extension and the expansion ends up using a built-in
  provided by GCC, use the compiler provided built-in directly
  when possible.
include/my_compiler.h:
  Define a dummy MY_GNUC_PREREQ when not compiling with GCC.
libmysql/libmysql.c:
  Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
  
  Variable might not be used in some cases. So, tag it as unused.
mysys/mf_keycache.c:
  Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
  
  Use UNINIT_VAR to work around a false positive warning.
mysys/my_getncpus.c:
  Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
  
  Declare variable in the same block where it is used.
regex/regexec.c:
  Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
  
  Work around a compiler bug which causes the cast to not be enforced.
sql/debug_sync.cc:
  Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc
  
  Use UNINIT_VAR to work around a false positive warning.
sql/handler.cc:
  Use UNINIT_VAR to work around a false positive warning.
sql/slave.cc:
  Use UNINIT_VAR to work around a false positive warning.
sql/sql_partition.cc:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisam/ft_nlq_search.c:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisam/mi_create.c:
  Use UNINIT_VAR to work around a false positive warning.
storage/myisammrg/myrg_open.c:
  Use UNINIT_VAR to work around a false positive warning.
tests/mysql_client_test.c:
  Change function to take a pointer to const, no need for a cast.
2010-11-10 19:14:47 -02:00
Mattias Jonsson
6780abfce6 merge 2010-11-15 23:57:14 +01:00
Mattias Jonsson
3df98a289c merge 2010-11-15 17:13:53 +01:00
Mattias Jonsson
47b514ffce Bug#58197: main.variables-big fails on windows
The test result differs on windows, since
it writes out 'localhost:<port>' instead of
only 'localhost', since it uses tcp/ip instead
of unix sockets on windows.

Fixed by replacing that column.

Also requires --big-test from some long running tests
and added a weekly run of all test requiring --big-test.

mysql-test/collections/default.weekly:
  Added a run of big-test (already exists in 5.5).
mysql-test/r/variables-big.result:
  Updated results
mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
  requiring --big-test since the test takes long time
mysql-test/suite/parts/t/partition_alter1_1_2_innodb.test:
  requiring --big-test since the test takes long time
mysql-test/suite/parts/t/partition_alter1_2_innodb.test:
  requiring --big-test since the test takes long time
mysql-test/suite/parts/t/partition_alter4_innodb.test:
  requiring --big-test since the test takes long time
mysql-test/t/disabled.def:
  Disabled two tests since they fail and was already
  reported as bugs (but was never run since they requires
  --big-test flag).
mysql-test/t/variables-big.test:
  Replacing column 3 in process list since it
  is not the same on windows as in unix.
2010-11-15 16:17:38 +01:00
Mattias Jonsson
e0a8c25438 Bug#57890: Assertion failed: next_insert_id == 0
with on duplicate key update

There was a missed corner case in the partitioning
handler, which caused the next_insert_id to be changed
in the second level handlers (i.e the hander of a partition),
which caused this debug assertion.

The solution was to always ensure that only the partitioning
level generates auto_increment values, since if it was done
within a partition, it may fail to match the partition
function.

mysql-test/suite/parts/inc/partition_auto_increment.inc:
  Added tests
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
  updated results
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
  updated results
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
  updated results
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
  updated results
sql/ha_partition.cc:
  In <engine>::write_row the auto_inc value is generated
  through handler::update_auto_increment (which calls <engine>::get_auto_increment() if needed).
  If:
  * INSERT_ID was set to 0
  * it was updated to 0 by 'INSERT ... ON DUPLICATE KEY UPDATE' and changed partitions for the row
  Then it would try to generate a auto_increment value in the
  <engine for a specific partition>::write_row, which will
  trigger the assert.
  
  So the solution is to prevent this by,
  in ha_partition::write_row set auto_inc_field_not_null and
  add MODE_NO_AUTO_VALUE_ON_ZERO
  in ha_partition::update_row (when changing partition) temporary
  set table->next_number_field to NULL which calling the
  partitions ::write_row().
2010-11-11 11:34:55 +01:00
Sergey Vojtovich
13bc5b3f3d BUG#58079 - Remove the IBM DB2 storage engine 2010-11-11 13:03:17 +03:00
Dmitry Shulga
871f36357e Fixed bug#54375 - Error in stored procedure leaves connection
in different default schema.

In strict mode, when data truncation or conversion happens,
THD::killed is set to THD::KILL_BAD_DATA.

This is abuse of KILL mechanism to guarantee that execution
of statement is aborted.

The stored procedures execution, on the other hand,
upon detection that a connection was killed, would
terminate immediately, without trying to restore the caller's
context, in particular, restore the caller's current schema.

The fix is, when terminating a stored procedure execution,
to only bypass cleanup if the entire connection was killed,
not in case of other forms of KILL.


mysql-test/r/sp-bugs.result:
  Added result for a test case for bug#54375.
mysql-test/t/sp-bugs.test:
  Added test case for bug#54375.
sql/sp_head.cc:
  sp_head::execute modified: restore saved current db if
  connection is not killed.
2010-11-11 10:52:51 +06:00
Dmitry Shulga
4b0fe88708 Fixed bug#56619 - Assertion failed during
ALTER TABLE RENAME, DISABLE KEYS.

The code of ALTER TABLE RENAME, DISABLE KEYS could
issue a commit while holding LOCK_open mutex.
This is a regression introduced by the fix for
Bug 54453.
This failed an assert guarding us against a potential
deadlock with connections trying to execute
FLUSH TABLES WITH READ LOCK.

The fix is to move acquisition of LOCK_open outside
the section that issues ha_autocommit_or_rollback().
LOCK_open is taken to protect against concurrent
operations with .frms and the table definition
cache, and doesn't need to cover the call to commit.

A test case added to innodb_mysql.test.

The patch is to be null-merged to 5.5, which
already has 54453 null-merged to it.

mysql-test/suite/innodb/r/innodb_mysql.result:
  Added test results for test for bug#56619.
mysql-test/suite/innodb/t/innodb_mysql.test:
  Added test for bug#56619.
sql/sql_table.cc:
  mysql_alter_table() modified: moved acquisition of LOCK_open
  after call to ha_autocommit_or_rollback.
2010-11-10 14:32:42 +06:00
Dmitry Shulga
2c16c7e985 Fixed Bug#57386 - main.execution_constants segfault on MIPS64EL.
sql/item_func.cc:
  Item_func::fix_fields modified: increased minimal required stack
  size in call to check_stack_overrun().
2010-11-10 11:49:37 +06:00
Davi Arnaut
1b88853ab8 Bug#57210: remove pstack
Quoting from the bug report:

The pstack library has been included in MySQL since version
4.0.0. It's useless and should be removed.

Details: According to its own documentation, pstack only works
on Linux on x86 in 32 bit mode and requires LinuxThreads and a
statically linked binary. It doesn't really support any Linux
from 2003 or later and doesn't work on any other OS.

The --enable-pstack option is thus deprecated and has no effect.
2010-11-09 12:45:13 -02:00
Bjorn Munch
6eaa3c0750 merge from 5.1-mtr 2010-11-09 11:20:50 +01:00
Horst.Hunger
8e0f8d438b due to merge. 2010-11-08 16:35:46 +01:00
Horst.Hunger
bf10c4a583 Fix for bug#52501 consisting of changes of some sys_vars tests including review results. 2010-11-08 16:30:26 +01:00
Jon Olav Hauglid
83e40f9634 Bug #45288 pb2 returns a lot of compilation warnings
GCOV builds were broken after the patch for Bug#57933
which added add -Wdeclaration-after-statement to gcc builds.

This patch fixes:
stacktrace.c:328: warning: ISO C90 forbids mixed
declarations and code

No test case added.
2010-11-08 12:51:48 +01:00
Sergey Glukhov
9f71cfc0a9 null merge 2010-11-08 13:55:43 +03:00
Sergey Glukhov
50a3c55ee7 Bug#52711 Segfault when doing EXPLAIN SELECT with union...order by (select... where...)
backport from 5.1


mysql-test/r/subselect.result:
  backport from 5.1
mysql-test/t/subselect.test:
  backport from 5.1
sql/sql_select.cc:
  backport from 5.1
2010-11-08 13:51:39 +03:00
Sergey Glukhov
0a29baba4b Fix for bug #54575: crash when joining tables with unique set column(backport from 5.1)
Problem: a flaw (derefencing a NULL pointer) in the LIKE optimization
code may lead to a server crash in some rare cases.

Fix: check the pointer before its dereferencing.


mysql-test/r/func_like.result:
  Fix for bug #54575: crash when joining tables with unique set column
    - test result.
mysql-test/t/func_like.test:
  Fix for bug #54575: crash when joining tables with unique set column
    - test case.
sql/item_cmpfunc.cc:
  Fix for bug #54575: crash when joining tables with unique set column
  - check res2 buffer pointer before its dereferencing 
    as it may be NULL in some cases.
2010-11-08 13:34:27 +03:00
Anitha Gopi
d7202ef7f8 Bug#58041 : Moved rpl_binlog_row to daily. Run just main suite for ps_row and embedded per push. Other suites run daily 2010-11-08 14:57:05 +05:30
Dmitry Shulga
8f237f5874 A fix and a test case for Bug#47924 -main.log_tables times out
sporadically.

The cause of the sporadic time out was a leaking protection
against the global read lock, taken by the RENAME statement,
and not released in case of an error occurred during RENAME.
The leaking protection counter would lead to the value of
protect_against_global_read never dropping to 0.
Consequently FLUSH TABLES in all connections, including the
one that leaked the protection, could not proceed.
 
The fix is to ensure that all branchesin RENAME code properly
release GRL protection.

mysql-test/r/log_tables.result:
  Added results for test for bug#47924.
mysql-test/t/log_tables.test:
  Added test for bug#47924.
sql/sql_rename.cc:
  mysql_rename_tables() modified: replaced return from function
  to goto to clean up code block in case of error.
2010-11-07 23:42:54 +06:00
Bjorn Munch
866cec611a Bug #57840 MTR: parallel execution breaks with smart ordering of test cases
There were actually more problems in this area:
  Slaves (if any) were unconditionally restarted, this appears unnecessary.
  Sort criteria were suboptimal, included the test name.
Added logic to "reserve" a sequence of tests with same config for one thread
Got rid of sort_criteria hash, put it into the test case itself
Adds little sanity check that expected worker picks up test
Fixed some tests that may fail if starting on running server
Some of these fail only if *same* test is repeated.
Finally, special sorting of tests that do --force-restart
2010-11-05 15:26:38 +01:00
Guilhem Bichot
f6ae96d40d BUG#57933 "add -Wdeclaration-after-statement to gcc builds";
first part, for autotools build.

config/ac-macros/maintainer.m4:
  Add the flag. With it, and as we use -Werror, we nicely get
  "error: ISO C90 forbids mixed declarations and code" if
  a declaration follows a statement in C code.
  Note that g++ refuses this flag.
2010-11-05 14:17:47 +01:00
Georgi Kodinov
7b2e07232a merge 2010-11-03 16:09:17 +02:00
Georgi Kodinov
4cfa91f42c bumped up the version 2010-11-03 16:03:40 +02:00
Georgi Kodinov
39bceaac02 added windows cmake binaries 2010-11-03 15:31:42 +02:00
unknown
b01a4ceb56 Raise version number after cloning 5.1.53 2010-11-03 14:02:15 +01:00
Georgi Kodinov
5e100a64b5 merge 2010-11-03 12:24:47 +02:00
Georgi Kodinov
1a5a109524 Bug #51208: Extra string allocation from thd->mem_root
in sql_show.cc, find_files()

Removed the extra allocation.
2010-11-02 15:20:02 +02:00
unknown
19c1d32a62 Merge from mysql-5.1.52-release 2010-11-01 19:44:43 +01:00
Sergey Glukhov
930cf09ec7 test case fix 2010-11-01 09:47:57 +03:00
Gleb Shchepa
20d704978d Bug #52160: crash and inconsistent results when grouping
by a function and column

The bugreport reveals two different bugs about grouping
on a function:

1) grouping by the TIME_TO_SEC function result caused
   a server crash or wrong results and
2) grouping by the function returning a blob caused
   an unexpected "Duplicate entry" error and wrong
   result.

Details for the 1st bug:

TIME_TO_SEC() returns NULL if its argument is invalid (empty
string for example). Thus its nullability depends not only
on the nullability of its arguments but also on their values.
Fixed by (overoptimistically) setting TIME_TO_SEC() to be
nullable despite the nullability of its arguments.

Details for the 2nd bug:

The server is unable to create indices on blobs without
explicit blob key part length. However, this fact was
ignored for blob function result fields of GROUP BY
intermediate tables.
Fixed by disabling GROUP BY index creation for blob
function result fields like regular blob fields.


mysql-test/r/func_time.result:
  Test case for bug #52160.
mysql-test/r/type_blob.result:
  Test case for bug #52160.
mysql-test/t/func_time.test:
  Test case for bug #52160.
mysql-test/t/type_blob.test:
  Test case for bug #52160.
sql/item_timefunc.h:
  Bug #52160: crash and inconsistent results when grouping
              by a function and column
  
  TIME_TO_SEC() returns NULL if its argument is invalid (empty
  string for example). Thus its nullability depends not only
  Fixed by (overoptimistically) setting TIME_TO_SEC() to be
  nullable despite the nullability of its arguments.
sql/sql_select.cc:
  Bug #52160: crash and inconsistent results when grouping
              by a function and column
  
  The server is unable to create indices on blobs without
  explicit blob key part length. However, this fact was
  ignored for blob function result fields of GROUP BY
  intermediate tables.
  Fixed by disabling GROUP BY index creation for blob
  function result fields like regular blob fields.
2010-10-31 19:04:38 +03:00
Georgi Kodinov
d89c7a82e0 merge 2010-10-29 14:04:13 +03:00
Georgi Kodinov
fd46de026d merge to 5.1-security 2010-10-29 14:02:49 +03:00
Georgi Kodinov
64044fdf19 merge to 5.1-security 2010-10-29 13:06:21 +03:00
Georgi Kodinov
33ec6f801b merge to 5.0-security 2010-10-29 13:05:24 +03:00
Sergey Glukhov
4a23ac20d9 Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
Lines below which were added in the patch for Bug#56814 cause this crash:

+      if (table->table)
+        table->table->maybe_null= FALSE;

Consider following test case:
--
CREATE TABLE t1(f1 INT NOT NULL);
INSERT INTO t1 VALUES (16777214),(0);

SELECT COUNT(*) FROM t1 LEFT JOIN t1 t2
ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;

DROP TABLE t1;
--

We set TABLE::maybe_null to FALSE for t2 table
and in create_tmp_field() we create appropriate tmp table field
using create_tmp_field_from_item() function instead of
create_tmp_field_from_field. As a result we have
LONGLONG field. As we have GROUP BY clause we calculate
group buffer length, see calc_group_buffer().
Item from group list which is used for calculation
refer to the field from real tables and have LONG type.
So group buffer length become insufficient for storing of
LONGLONG value. It leads to overwriting of wrong memory
area in do_field_int() function which is called from
end_update().
After some investigation I found out that
create_tmp_field_from_item() is used only for OLAP
grouping and can not be used for common grouping
as it could be an incompatibility between tmp
table fields and group buffer length.
We can not remove create_tmp_field_from_item() call from
create_tmp_field as OLAP needs it and we can not use this
function for common grouping. So we should remove setting
TABLE::maybe_null to FALSE from simplify_joins().
In this case we'll get wrong behaviour of
list_contains_unique_index() back. To fix it we
could use Field::real_maybe_null() check instead of
Field::maybe_null() and add addition check of
TABLE_LIST::outer_join.


mysql-test/r/group_by.result:
  test case
mysql-test/r/join_outer.result:
  test case
mysql-test/t/group_by.test:
  test case
mysql-test/t/join_outer.test:
  test case
sql/sql_select.cc:
  --remove wrong code
  --use Field::real_maybe_null() check instead of
    Field::maybe_null() and add addition check of
    TABLE_LIST::outer_join
2010-10-29 12:23:06 +04:00
Vasil Dimov
23552ecd41 Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-10-29 10:45:11 +03:00
Sergey Glukhov
c04bf683fe Bug#57194 group_concat cause crash and/or invalid memory reads with type errors
The problem is caused by bug49487 fix and became visible
after after bug56679 fix.
Items are cleaned up and set to unfixed state after filling derived table.
So we can not rely on item::fixed state in Item_func_group_concat::print
and we can not use 'args' array as items there may be cleaned up.
The fix is always to use orig_args array of items as it
always should contain the correct data.


mysql-test/r/func_gconcat.result:
  test case
mysql-test/t/func_gconcat.test:
  test case
sql/item_sum.cc:
  The fix is always to use orig_args array of items.
2010-10-29 11:44:32 +04:00
Calvin Sun
460ad14e04 Bug#52062: Compiler warning in os0file.c on windows 64-bit
On Windows, the parameter for number of bytes passed into WriteFile()
and ReadFile() is DWORD. Casting is needed to silence the warning on
64-bit Windows.

Also, adding several asserts to ensure the variable for number of bytes
is no more than 32 bits, even on 64-bit Windows.

This is for InnoDB Plugin.

rb://415
Approved by: Inaam
2010-10-28 00:10:28 -05:00
Calvin Sun
16feea4109 Bug#52062: Compiler warning in os0file.c on windows 64-bit
On Windows, the parameter for number of bytes passed into WriteFile()
and ReadFile() is DWORD. Casting is needed to silence the warning on
64-bit Windows.

Also, adding several asserts to ensure the variable for number of bytes
is no more than 32 bits, even on 64-bit Windows.

This is for built-in InnoDB.

rb://415
Approved by: Inaam
2010-10-27 23:18:59 -05:00
Sergey Glukhov
c7371c9e75 Bug#57477 SIGFPE when dividing a huge number a negative number
The problem is dividing by const value when
the result is out of supported range.
The fix:
-return LONGLONG_MIN if the result is out of supported range for DIV operator.
-return 0 if divisor is -1 for MOD operator.


mysql-test/r/func_math.result:
  test case
mysql-test/t/func_math.test:
  test case
sql/item_func.cc:
  -return LONGLONG_MIN if the result is out of supported range for DIV operator.
  -return 0 if divisor is -1 for MOD operator.
2010-10-27 18:12:10 +04:00
Vasil Dimov
4bf273c8f1 Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-10-27 16:39:22 +03:00
Anitha Gopi
fcfda43ca3 Fixed bug numbers in disabled.def files 2010-10-27 09:54:04 +05:30