Commit graph

25136 commits

Author SHA1 Message Date
Tatiana A. Nurnberg
b7b603d0fc auto-merge 2008-11-27 12:50:51 +01:00
Tatiana A. Nurnberg
61296d6db7 auto-merge 2008-11-27 12:33:04 +01:00
Ingo Struewing
41494f86f4 Bug#28234 - global/session scope - documentation vs implementation
Post-pushbuild fix.

- Windows does not have 'socket' system variable.
- Compiler warning in sql/slave.cc

mysql-test/r/variables.result:
  Bug#28234 - global/session scope - documentation vs implementation
  Updated test result.
mysql-test/t/variables.test:
  Bug#28234 - global/session scope - documentation vs implementation
  Removed test for 'socket' variable. Windows doesn't have it.
sql/slave.cc:
  Bug#28234 - global/session scope - documentation vs implementation
  Changed type of constant to avoid a compiler warning.
2008-11-27 11:50:28 +01:00
unknown
96e0bf50d9 Merge from mysql-5.1.30-release 2008-11-27 00:02:10 +01:00
Tatiana A. Nurnberg
d096079d33 Bug#37553: MySql Error Compare TimeDiff & Time
We pretended that TIMEDIFF() would always return positive results;
this gave strange results in comparisons of the TIMEDIFF(low,hi)<TIME(0)
type that rendered a negative result, but still gave false in comparison.
We also inadvertantly dropped the sign when converting times to
decimal.

CAST(time AS DECIMAL) handles signs of the times correctly.
TIMEDIFF() marked up as signed. Time/date comparison code switched to
signed for clarity.

mysql-test/r/func_sapdb.result:
  show that time-related comparisons work with negative
  time values now.
  show that converting time to DECIMAL no longer drops sign.
mysql-test/t/func_sapdb.test:
  show that time-related comparisons work with negative
  time values now.
  show that converting time to DECIMAL no longer drops sign.
sql/item_cmpfunc.cc:
  signed returns
sql/item_cmpfunc.h:
  signed now (time/date < > =)
sql/item_func.cc:
  signed now
sql/item_timefunc.h:
  Functions such as TIMEDIFF() return signed results!
  The file-comments pretended we were doing that all along, anyway...
sql/my_decimal.cc:
  heed sign when converting time to my_decimal;
  times may actually be negative!
  Needed for SELECT CAST(time('-73:42:12') AS DECIMAL);
sql/mysql_priv.h:
  using signed for dates and times now
2008-11-26 09:28:17 +01:00
Vladislav Vaintroub
bc08b15849 merge 2008-11-25 20:18:43 +01:00
unknown
bb7ae40a7a Fix of the small merge bug. 2008-11-25 17:34:05 +02:00
Guilhem Bichot
3c1e153a82 Manually applying the patch for BUG40954 "Crash in MyISAM index code with concurrency test using partitioned tables"
so that it stops crashing pushbuild2/5.1-maria and we can see the other failures which it hid.

mysql-test/r/partition.result:
  Manually applying the patch for BUG40954 "Crash in MyISAM index code with concurrency test using partitioned tables"
mysql-test/t/partition.test:
  Manually applying the patch for BUG40954 "Crash in MyISAM index code with concurrency test using partitioned tables"
sql/ha_partition.cc:
  Manually applying the patch for BUG40954 "Crash in MyISAM index code with concurrency test using partitioned tables"
2008-11-25 10:05:48 +01:00
Ingo Struewing
eefbc08bc5 merge 2008-11-25 09:29:58 +01:00
Ingo Struewing
f65bd582be merge 2008-11-25 09:27:40 +01:00
Ramil Kalimullin
df8a5474f8 Fix for bug#40984: backport fix from 39585 into 5.0
Problem: in 5.0 'check table for upgrade' doesn't detect
incompatible collation changes made in 5.0.48.

Fix: backport #39585 fix to 5.0


sql/handler.cc:
  Fix for bug#40984: backport fix from 39585 into 5.0
    - backport of #39585 fix
sql/handler.h:
  Fix for bug#40984: backport fix from 39585 into 5.0
    - backport of #39585 fix
2008-11-25 10:22:02 +04:00
Build Team
74b3540919 mysql-test/r/partition.result
mysql-test/t/partition.test
sql/ha_partition.cc
  Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
  Problem was usage of read_range_first with an empty key.
  Solution was to not to give a key if it was empty. (real author Mattias Jonsson)

storage/archive/archive_reader.c
client/mysqlslap.c
  Aligned the copyright texts output from "--version" of tools, to
  let internal tools be able to change them if needed.

storage/ndb/test/tools/connect.cpp
storage/ndb/test/run-test/atrt.hpp
  Corrected a few GPL headers not restricted to GPL version 2

Makefile.am
  Added missing --report-features to the 'test-bt-fast' target

support-files/mysql.spec.sh
  Reversed the removal of the "%define license GPL" in as internal
  tools depended on it
2008-11-25 03:04:58 +01:00
Mattias Jonsson
d47f9233f4 merge 2008-11-24 23:18:45 +01:00
Mattias Jonsson
d5057740a0 Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
Problem was usage of read_range_first with an empty key.

Solution was to not to give a key if it was empty.

mysql-test/r/partition.result:
  Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
  
  Updated test result.
mysql-test/t/partition.test:
  Bug#40954: Crash in MyISAM index code with concurrency test using partitioned tables
  
  Added test case
2008-11-24 17:24:03 +01:00
Georgi Kodinov
f31d305238 merged bug 39656 to 5.1-bugteam 2008-11-24 18:00:09 +02:00
Georgi Kodinov
c9be1c9f88 merged bug 39656 to 5.0-bugteam 2008-11-24 17:38:52 +02:00
Georgi Kodinov
d795963cba Bug #39656: Behaviour different for agg functions with & without where -
ONLY_FULL_GROUP_BY

The check for non-aggregated columns in queries with aggregate function, but without
GROUP BY was treating all the parts of the query as if they are in the SELECT list.
Fixed by ignoring the non-aggregated fields in the WHERE clause.

mysql-test/r/func_group.result:
  Bug #39656: test case
mysql-test/t/func_group.test:
  Bug #39656: test case
sql/sql_select.cc:
  Bug #39656: ignore the new non-aggregated column refs in a WHERE
  by saving the state so far and then adding only the new values of the other
  parts of the bitmask.
2008-11-24 17:30:47 +02:00
Guilhem Bichot
a4c0b51bdc post-merge fix (compiler warning) 2008-11-22 16:21:07 +01:00
Vladislav Vaintroub
3374afe8b0 merge 2008-11-22 01:22:20 +01:00
Vladislav Vaintroub
bebde5dba0 merge 2008-11-22 01:10:38 +01:00
Ingo Struewing
f92c573145 Bug#28234 - global/session scope - documentation vs implementation
Several system variables did not behave like system variables should do.
When trying to SET them or use them in SELECT, they were reported as
"unknown system variable". But they appeared in SHOW VARIABLES.

This has been fixed by removing the "fixed_vars" array of variables
and integrating the variables into the normal system variables chain.
All of these variables do now behave as read-only global-only
variables. Trying to SET them tells they are read-only, trying to
SELECT the session value tells they are global only. Selecting the
global value works. It delivers the same value as SHOW VARIABLES.


mysql-test/r/variables-notembedded.result:
  Bug#28234 - global/session scope - documentation vs implementation
  New test result.
mysql-test/r/variables.result:
  Bug#28234 - global/session scope - documentation vs implementation
  New test result.
mysql-test/t/variables-notembedded.test:
  Bug#28234 - global/session scope - documentation vs implementation
  Added a test for each moved variable that is not present in an
  embedded server.
mysql-test/t/variables.test:
  Bug#28234 - global/session scope - documentation vs implementation
  Added a test for each moved variable that is also present in an
  embedded server.
sql/item_func.cc:
  Bug#28234 - global/session scope - documentation vs implementation
  Added SHOW_BOOL to some Item_func_get_system_var methods.
sql/set_var.cc:
  Bug#28234 - global/session scope - documentation vs implementation
  Moved all variables from the "fixed_vars" array into the normal
  system variables chain by using the new variable class sys_var_const.
  Removed the fixed_show_vars array and its initialization in
  enumerate_sys_vars().
  Removed mysql_append_static_vars(), which added fixed_vars arrays
  to the fixed_show_vars array.
sql/set_var.h:
  Bug#28234 - global/session scope - documentation vs implementation
  Added the new system variable class sys_var_const.
  Removed declaration of mysql_append_static_vars().
sql/slave.cc:
  Bug#28234 - global/session scope - documentation vs implementation
  Moved the definition of show_slave_skip_errors() from sql_repl.cc
  to here and renamed it to print_slave_skip_errors().
  Changed print_slave_skip_errors() to create a static buffer with
  a printable version of the error numbers set.
  Added a call of print_slave_skip_errors() to init_slave_skip_errors().
sql/slave.h:
  Bug#28234 - global/session scope - documentation vs implementation
  Added declaration of slave_skip_error_names.
sql/sql_repl.cc:
  Bug#28234 - global/session scope - documentation vs implementation
  Moved all variables from the "fixed_vars" array into the normal
  system variables chain by using the new variable class sys_var_const.
  Moved the definition of show_slave_skip_errors() to slave.cc and
  modified it to compute the string once at server initialization only.
  Removed the call to mysql_append_static_vars().
2008-11-22 00:22:21 +01:00
Guilhem Bichot
33b194c36e Merge of 5.1-main into 5.1-maria. There were no changes to storage/myisam, or mysql-test/t/*myisam*.
However there were three new tests mysql-test/suite/parts/t/partition*myisam.test, of which I make here
copies for Maria.
2008-11-21 15:21:50 +01:00
Alexey Botchkov
3f2044cd6e warning of notused function fixed 2008-11-21 18:15:11 +04:00
Ramil Kalimullin
1b8a4c573c Auto-merge 2008-11-21 17:32:45 +04:00
Ramil Kalimullin
bb38a57abb Auto-merge 2008-11-21 17:20:58 +04:00
Sergey Glukhov
bd6376f1d1 Bug#34760 Character set autodetection appears to fail
the problem is the same as reported in bug#20835,
so the fix is backport of bug#20835 patch.


mysql-test/r/subselect.result:
  test result
mysql-test/t/subselect.test:
  test case
2008-11-21 16:39:59 +04:00
Ramil Kalimullin
39efef853b Fix for bug#36772: When using UTF8, CONVERT with GROUP BY
returns truncated results

Problem: performig conversion from {INT, DECIMAL, REAL} to CHAR
we incorrectly set its max length in some cases that may lead
to truncated results returned.

Fix: properly set CONVERT({INT, DECIMAL, REAL}, CHAR) result's
max length.


mysql-test/r/ctype_utf8.result:
  Fix for bug#36772: When using UTF8, CONVERT with GROUP BY
  returns truncated results
    - test result.
mysql-test/t/ctype_utf8.test:
  Fix for bug#36772: When using UTF8, CONVERT with GROUP BY
  returns truncated results
    - test case.
sql/item_timefunc.cc:
  Fix for bug#36772: When using UTF8, CONVERT with GROUP BY
  returns truncated results
    - calculating Item_char_typecast::max_length use initial
  argument's charset mbmaxlen instead of from_cs->mbmaxlen,
  as from_cs may differ in some case (see comment above).
2008-11-21 13:48:22 +04:00
Vladislav Vaintroub
0b98b8973b merge 2008-11-21 10:00:21 +01:00
Tatiana A. Nurnberg
85c04371d7 Bug#39591: Crash if table comment is longer than 62 characters
It was possible to crash a mysqld build with EXTRA_DEBUG using
CREATE TABLE ... COMMENT with a specially-crafted UTF-8 string.

This CS removes the check that caused it since it no longer
applies in current servers anyway, and adds comments instead
to avoid future confusion. 

mysql-test/r/strict.result:
  Try to crash mysqld with a "suitable" multi-byte (3-byte UTF-8) string
  for a table comment.
mysql-test/t/strict.test:
  Try to crash mysqld with a "suitable" multi-byte (3-byte UTF-8) string
  for a table comment.
sql/unireg.cc:
  Talk at length about limits in .frm form-info, characters vs bytes,
  inlined vs extra-segement TABLE-COMMENTS, and the differences in
  6.0+ vs <6.0 when it comes to UTF-8.
  
  Also, remove a check that no longer applies and that could lead to
  problems in pathological cases.
2008-11-20 15:39:39 +01:00
Ramil Kalimullin
c3dc1d6dfb Fix for bug#40770: Server Crash when running with triggers including
variable settings (rpl_sys)

Problem: under certain conditions (e.g. user variables usage in triggers)
accessing a user defined variable we may use a variables hash table that
belongs to already deleted thread. It happens if
thd= new THD;
has the same address as just deleted thd as we use
if (stored_thd == thd)
to check.
That may lead to unpredictable results, server crash etc.

Fix: use thread_id instead of thd address to distinguish threads.

Note: no simple and repeatable test case.


sql/item_func.cc:
  Fix for bug#40770: Server Crash when running with triggers including
  variable settings (rpl_sys)
    - store and use thd->thread_id to distinguish threads instead of
  thread address as it may be the same as just deleted thread had, 
  i.e. we may get (old_thd == new_thd) after
  delete old_thd;
  new_thd= new THD;
    - set entry_thread_id only when we get a real entry, clear it 
  if the hash search fails.
sql/item_func.h:
  Fix for bug#40770: Server Crash when running with triggers including
  variable settings (rpl_sys)
    - Item_func_set_user_var::entry_thread_id introduced.
2008-11-20 15:25:26 +04:00
Ramil Kalimullin
1cd8b9f700 Fix for bug#40875: Memory leak in FEDERATED handler
Problem: memory leak occurs when we open a federated table
that has its share in the hash.

Fix: free not used memory.

Note: the fix should NOT be merged to 5.1 (the code changed).


sql/ha_federated.cc:
  Fix for bug#40875: Memory leak in FEDERATED handler
    - free memory (tmp_share.scheme) allocated in the parse_url()
  if it isn't used anymore.
2008-11-20 14:08:36 +04:00
Staale Smedseng
e5ae4e2392 A fix for Bug#22891 "session level max_allowed_packet can be
set but is ignored".
                                  
This patch makes @@session.max_allowed_packed and
@@session.net_buffer_length read-only as suggested in the bug
report. The user will have to use SET GLOBAL (and reconnect)
to alter the session values of these variables.
                            
The error string ER_VARIABLE_IS_READONLY is introduced.
                            
Tests are modified accordingly.


sql/set_var.cc:
  The class sys_var_thd_ulong_session_readonly is introduced as
  a specialization of sys_var_thd_ulong implementing a read-only
  session variable. The class overrides check() and
  check_default() to achieve the read-only property for the
  session part of the variable.
sql/set_var.h:
  The class sys_var_thd_ulong_session_readonly is introduced as
  a specialization of sys_var_thd_ulong implementing a read-only
  session variable. The class overrides check() and
  check_default() to achieve the read-only property for the
  session part of the variable.
sql/share/errmsg.txt:
  New error ER_VARIABLE_IS_READONLY.
2008-11-20 08:51:48 +01:00
Vladislav Vaintroub
09ac30f679 Bug#39494 : key_buffer_size > 4GB does not work on 64 bit Windows
Cache size  is truncated via 32bit ulong  in  ha_init_key_cache() and 
ha_resize_key_cache() 

This change fixes the cast to size_t instead of ulong. This cast is safe,
because key_buffer_size parameter is limited to SIZE_T_MAX
2008-11-19 16:02:38 +01:00
Alexey Botchkov
9ac2f96015 merging 2008-11-19 14:01:21 +04:00
Alexey Botchkov
4d3f05b09b Bug#38293 Libmysqld crash in mysql_library_init if language file missing
That's a Win-specific error.
    When we create libmysqld.dll we have many libraries like mysys, dbug,
    strings, etc linked into that dll, so the application built upon
    this library shouldn't link these libraries to itself, rather use
    those inside the dll.

    Fixed by redirecting calls into the libmysqld.dll

per-file comments:
  dbug/dbug.c
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
    fake _db_something definitions added

  include/my_dbug.h
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
  fake _db_something declarations added

  libmysqld/examples/CMakeLists.txt
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
    superfluous libraries removed from linking

  libmysqld/libmysqld.def
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
    set of mysys functions added to the export section
2008-11-19 13:57:23 +04:00
Sergey Vojtovich
ca1ad1c552 Merge. 2008-11-18 15:38:28 +04:00
Sergey Vojtovich
780186f962 Merge. 2008-11-18 15:10:52 +04:00
Kristofer Pettersson
f9570f68d9 Automerge 2008-11-18 12:33:38 +01:00
V Narayanan
065321f0be Bug#39616: Missing quotes from .CSV crashes server
When a CSV file contained comma separated elements 
that were not enclosed in quotes, it was causing the
mysql server to crash.
      
The old algorithm that parsed the content of a row in
mysql 5.0 was assuming that the values of the fields
in a .CSV file will be enclosed in quotes and will be
separated by commas.

This was causing the old algorithm to fail when the 
content of the file resembled the following
3,"sans quotes"
The CSV engine that is part of mysql 5.0 was expecting
the above to be
"3","sans quotes"
      
The above is just one example of where the engine was
failing for what would be recognized as a valid .CSV 
file content otherwise.
      
The proposed fix changes the old algorithm being used
to parse rows from the .CSV file to handle two separate
cases

1) When the current field of the row is enclosed in quotes
2) When the current field of the row is not enclosed in 
   quotes

mysql-test/r/csv.result:
  Contains additional test output corresponding to the new 
  tests added.
mysql-test/t/csv.test:
  Contains additional tests for testing the behaviour of the CSV 
  storage engine when the fields are not enclosed in quotes.
sql/examples/ha_tina.cc:
  Changes the parsing logic of the rows in a CSV file to account for
  fields that are not enclosed in quotes.
2008-11-18 11:31:03 +05:30
Alexey Botchkov
ed77f02a92 merging 2008-11-17 19:43:10 +04:00
Alexey Botchkov
88a8863627 Bug#31616 div_precision_increment description looks wrong
Item_func_div didn't calculate the precision of the result properly.
  The result of 5/0.0001 is 5000 so we have to add decimals of the divisor
  to the planned precision.

per-file comments:
  mysql-test/r/type_newdecimal.result
Bug#31616 div_precision_increment description looks wrong
    test result fixed

  mysql-test/t/type_newdecimal.test
Bug#31616 div_precision_increment description looks wrong
    test case

  sql/item_func.cc
Bug#31616 div_precision_increment description looks wrong
    precision must be increased with args[1]->decimals parameter
2008-11-17 19:41:09 +04:00
Kristofer Pettersson
d5e934d0bc Automerge 2008-11-17 15:22:29 +01:00
Kristofer Pettersson
9ca6e03b66 Bug#40778 thd_security_context has bad architecture; allocates on unprotected memroot
The function thd_security_context allocates memory on an unprotected MEM_ROOT if the
message length becomes longer than requested and the initial buffer memory needs to
be reallocated.
                  
This patch fixes the design error by copying parts of the reallocated buffer 
to the destination buffer. This works because the destination buffer isn't
owned by the String object and thus isn't freed when a new buffer is allocated.
Any new memory allocated by the String object is reclaimed when the object
is destroyed at the end of the function call.
2008-11-17 15:17:21 +01:00
Mattias Jonsson
9be8ab541c merge 2008-11-15 00:26:48 +01:00
Mattias Jonsson
1db7d8f6cb Bug#40595: Non-matching rows not released with READ-COMMITTED on tables
with partitions

Pre push fix, optimized replace_regex, to cut 2 seconds
from test time.
2008-11-14 23:51:17 +01:00
Gleb Shchepa
8155de51e5 manual merge 5.0-bugteam --> 5.1-bugteam (bug 40021)
sql_view.cc: required_view_parameters has been decreased by 2 
(not by 1) because its value was incorrect: 16 instead of 15
(minor performance issue).


sql/sql_view.cc:
  sql_view.cc: required_view_parameters has been decreased by 2 
  (not by 1) because its value was incorrect: 16 instead of 15
  (minor performance issue).
2008-11-14 21:37:27 +04:00
Gleb Shchepa
56b9586fd1 Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade

Obsolete arc/ directory and view .frm file backup support
has been removed by the patch for bug 17823. However, that
bugfix caused a problem with "live downgrades" of the
server: if we rename some view 4 times under 5.1.29/5.0.72
and then try to rename it under 5.1.28/5.0.70 on the same
database, the server fails with a error:

  query 'RENAME TABLE ... TO ...' failed: 6: Error on
  delete of '....frm-0001' (Errcode: 2)

Also .frm file of that view may be lost (renamed to .frm~).

The server failed because it tried to rename latest 3
backup .frm files renaming the view: the server used an
integer value of the "revision" field of .frm file to
extract those file names. After the fix for bug 17823 those
files were not created/maintained any more, however the
"revision" field was incremented as usual. So, the server
failed renaming non existent files.

This fix solves the problem by removing the support for
"revision" .frm file field:
1. New server silently ignores existent "revision" fields
   in old .frm files and never write it down;
2. Old server assumes, that missing "revision" field in new
   .frm files means default value of 0.
3. Accordingly to the fix for bug 17823 the new server
   drops arc/ directory on alter/rename view, so after
   "live downgrade" old server begins maintenance of the
   arc/ directory from scratch without conflicts with .frm
   files.


sql/parse_file.cc:
  Bug #40021: Renaming view fails, archived .frm for view is
              missing after downgrade
  
  1. static write_parameter(): the old_version parameter
     and the section for FILE_OPTIONS_REV have been re moved.
  2. write_parameter(): the max_versions parameter has been
     removed;
  3. sql_create_definition_file(): removal of dead code;
  4. rename_in_schema_file(): revision and num_view_backups
     parameters and dead code have been removed;
  5. File_parser::parse(): FILE_OPTIONS_REV section has been
     removed.
sql/parse_file.h:
  Bug #40021: Renaming view fails, archived .frm for view is
              missing after downgrade
  
  1. The FILE_OPTIONS_REV constant has been removed.
  2. sql_create_definition_file and rename_in_schema_file
     functions: obsolete versions, revision and
     num_view_backups parameters have been removed.
sql/sql_db.cc:
  Bug #40021: Renaming view fails, archived .frm for view is
              missing after downgrade
  
  Commentary update.
sql/sql_trigger.cc:
  Bug #40021: Renaming view fails, archived .frm for view is
              missing after downgrade
  
  sql_create_definition_file() calls have been updates to
  new parameter lists.
sql/sql_view.cc:
  Bug #40021: Renaming view fails, archived .frm for view is
              missing after downgrade
  
  1. The mysql_create_view function code is used for both
     CREATE VIEW and ALTER queries, but query cache is
     necessary for ALTER command only. Check for a non first
     view revision has been replaced with a direct check for
     ALTER query.
  2. The num_view_backups global constant has been removed.
  3. view_parameters: the "revision" .frm field support has
     been removed.
  4. sql_create_definition_file and rename_in_schema_file
     function calls have been updates to new parameter lists.
sql/table.h:
  Bug #40021: Renaming view fails, archived .frm for view is
              missing after downgrade
  
  TABLE_LIST: the revision field has been removed.
2008-11-14 21:25:57 +04:00
unknown
bfba620e45 Changes of copyright output from "--version" and similar.
Changes of copyright in RPM spec file.
2008-11-14 17:29:38 +01:00
Vladislav Vaintroub
f2a610e1e0 Bug #20430 mysqld.exe windows service stuck in "SERVICE_STOP_PENDING"
status

The problem appears to be a race condition, when service is being
stopped right after startup. We set the service status to SERVICE_RUNNING
way too early it cannot yet handle stop requests -  initialization has
not finished and  hEventShutdown  that signals server to stop is not yet
created. If somebody issues "net stop MySQL" at this time, MySQL is not
informed about the stop and continues to run as usual, while
NTService::ServiceMain() stucks forever waiting for mysql's "main" thread
to finish.

Solution is to remain in SERVICE_START_PENDING status until after server
initialization  is fully complete and only then change the status to
SERVICE_RUNNING. In  SERVICE_START_PENDING we do not accept service control
requests, i.e it is not possible to stop service in that time.

sql/mysqld.cc:
  Set service status to running after all initialization is complete
sql/nt_servc.cc:
  New method SetRunning() to be called  by application
  to set service status to SERVICE_RUNNING when apllication
  has finished initialization.
sql/nt_servc.h:
  New method SetRunning() to be called  by application
  when initialization completes
2008-11-14 02:01:41 +01:00
Sergey Glukhov
ba453779b5 5.0-bugteam->5.1-bugteam automerge(bug#39541) 2008-11-13 17:09:22 +04:00
Sergey Glukhov
c049fc6bd6 Bug#39541 CHECK TABLE on information_schema myisam tables produces error
issue 'The storage engine for the table doesn't support check' note for I_S tables


mysql-test/r/mysqlcheck.result:
  test result
mysql-test/t/mysqlcheck.test:
  test case
sql/sql_table.cc:
  issue 'The storage engine for the table doesn't support check' note for I_S tables
2008-11-13 17:06:48 +04:00
Sergey Glukhov
fc27d0380a Bug#38909 CREATE_OPTIONS in information_schema produces wrong results
table->partition_info is unitialized when we open frm file only.
The fix is check share->partition_info_len which is set on
frm opening stage.


mysql-test/r/information_schema_part.result:
  test result
mysql-test/t/information_schema_part.test:
  test case
sql/sql_show.cc:
  table->partition_info is unitialized when we open frm file only.
  The fix is check share->partition_info_len which is set on
  frm opening stage.
2008-11-13 16:11:51 +04:00
Sergey Glukhov
53b3052352 Bug#39955 SELECT on INFORMATION_SCHEMA.GLOBAL_VARIABLES takes too long
VARIABLE_VALUE field is decreased to 1024 symbols.
(affected I_S tables: GLOBAL_VARIABLES, SESSION_VARIABLES,
 GLOBAL_STATUS, SESSION_STATUS).
The only variable which can be longer than 1024 is
init_connect. The variable will be truncated with warning.
Additional fix:
Added where condition filter which speed up queries which
have where condition with expressions which use VARIABLE_NAME
field.


mysql-test/r/information_schema.result:
  test result
mysql-test/r/show_check.result:
  result fix
mysql-test/suite/funcs_1/r/is_columns_is.result:
  result fix
mysql-test/t/information_schema.test:
  test case
sql/sql_show.cc:
  VARIABLE_VALUE field is decreased to 1024 symbols.
  (affected I_S tables: GLOBAL_VARIABLES, SESSION_VARIABLES,
   GLOBAL_STATUS, SESSION_STATUS).
  The only variable which can be longer than 1024 is
  init_connect. The variable will be truncated with warning.
  Additional fix:
  Added where condition filter which speed up queries which
  have where condition with expressions which use VARIABLE_NAME
  field.
2008-11-13 16:09:11 +04:00
Sergey Glukhov
0dff72726b Bug#35789 wrong datatypes for collation and charset columns in EVENTS, ROUTINES, TRIGGERS
changed 'charset', 'collation' field length from 64 to MY_CS_NAME_SIZE(32)
in tables:
SCHEMATA, TABLES, COLUMNS, CHARACTER_SETS,
COLLATIONS, COLLATION_CHARACTER_SET_APPLICABILITY


mysql-test/r/create.result:
  result fix
mysql-test/r/information_schema.result:
  result fix
mysql-test/r/show_check.result:
  result fix
mysql-test/suite/funcs_1/r/is_character_sets.result:
  result fix
mysql-test/suite/funcs_1/r/is_collation_character_set_applicability.result:
  result fix
mysql-test/suite/funcs_1/r/is_collations.result:
  result fix
mysql-test/suite/funcs_1/r/is_columns.result:
  result fix
mysql-test/suite/funcs_1/r/is_columns_is.result:
  result fix
mysql-test/suite/funcs_1/r/is_routines.result:
  result fix
mysql-test/suite/funcs_1/r/is_schemata.result:
  result fix
mysql-test/suite/funcs_1/r/is_tables.result:
  result fix
sql/sql_show.cc:
  changed 'charset', 'collation' field length from 64 to MY_CS_NAME_SIZE(32)
  in tables:
  SCHEMATA, TABLES, COLUMNS, CHARACTER_SETS,
  COLLATIONS, COLLATION_CHARACTER_SET_APPLICABILITY
  additional fix: ROUTINES.SQL_MODE is changed to be VARCHAR(addon for Bug#29153)
2008-11-13 13:50:20 +04:00
Andrei Elkin
ca2d184695 merging 5.1 -> 5.1 rpl. 3 of 4 conflicts are resolved similarly to 6.0->6.0-rpl merging.
mysql_upgrade results changed due to the error messesge of mysqlcheck has changed.
2008-11-12 19:51:47 +02:00
Mattias Jonsson
1c9df573c9 Bug#38784: Mysql server crash if table is altered with partition changes.
Occurred with EXTRA_DEBUG on windows.

Problem was insufficient length of a local variable that stored path names.

Solution was to use the correct length.

CMakeLists.txt:
  Bug#38784: Mysql server crash if table is altered with partition changes.
  
  Added support for EXTRA_DEBUG
sql/sql_partition.cc:
  Bug#38784: Mysql server crash if table is altered with partition changes.
  
  Changed from FN_LEN to FN_REFLEN since the variable was use for paths,
  not filenames without path.
win/configure.js:
  Bug#38784: Mysql server crash if table is altered with partition changes.
  
  Added support for EXTRA_DEBUG
2008-11-12 13:36:53 +01:00
Sergey Vojtovich
ab9ecae47b BUG#38842 - Fix for 25951 seems incorrect
With fix for bug 25951 index hints are ignored for fulltext
searches, as handling of fulltext indexes is different from
handling regular indexes. Meaning it is not possible to
implement true index hints support for fulltext indexes within
the scope of current fulltext architecture.

The problem is that prior to fix for bug 25951, some useful
index hints still could be given for boolean mode searches.

This patch implements special index hints support for fulltext
indexes with the following characteristics:
- all index hints are still ignored for NLQ mode searches -
  it cannot work without an index;
- for 5.1 and up index hints FOR ORDER BY and FOR GROUP BY are
  still ignored for fulltext indexes;
- boolean mode searches honor USE/FORCE/IGNORE INDEX hints;
- as opposed to index hints for regular indexes, index hints
  for fulltext BOOLEAN mode searches affect the usage of the
  index for the whole query.

mysql-test/r/fulltext.result:
  A test case for BUG#38842.
mysql-test/t/fulltext.test:
  A test case for BUG#38842.
sql/item_func.cc:
  For boolean mode searches, which can work without fulltext
  index, use keys_in_use_for_query bitmap instead of keys_in_use.
  
  The effect is that boolean mode searches now honor index hints.
2008-11-11 13:10:51 +04:00
Build Team
e85fe79430 Added "Sun Microsystems, Inc." to copyright headers on files modified
since Oct 1st
2008-11-10 21:21:49 +01:00
Mattias Jonsson
a5ec6953e1 Bug#40595: Non-matching rows not released with READ-COMMITTED
on tables with partitions

Problem was that the handler function try_semi_consistent_read
was not propagated to the innodb handler.

Solution was to implement that function in the partitioning
handler.

mysql-test/r/partition_innodb.result:
  Bug#40595: Non-matching rows not released with READ-COMMITTED
  on tables with partitions
  
  Updated test result.
mysql-test/t/partition_innodb.test:
  Bug#40595: Non-matching rows not released with READ-COMMITTED
  on tables with partitions
  
  Added test case for bug#40595.
  
  Note: the replace_regex is taking long time. I have not found
  any better regex (it takes time using 'sed' too).
sql/ha_partition.cc:
  Bug#40595: Non-matching rows not released with READ-COMMITTED
  on tables with partitions
  
  Added function to the partitioning handler for handling
  semi consistent reads (unlock_row was already implemented,
  and this is needed for unlock_row to work properly in innodb).
  It uses pruning for optimizing the call.
sql/ha_partition.h:
  Bug#40595: Non-matching rows not released with READ-COMMITTED
  on tables with partitions
  
  Added function to the partitioning handler for handling
  semi consistent reads (unlock_row was already implemented,
  and this is needed for unlock_row to work properly in innodb).
2008-11-10 21:13:24 +01:00
Kristofer Pettersson
66f8501d96 Automerge 2008-11-07 14:52:43 +01:00
Kristofer Pettersson
e88487cc27 Bug#38883 thd_security_context is not thread safe, crashes?
Innodb monitor could cause a server crash because of invalid access to a
shared variable in a concurrent environment.
                  
This patch adds a guard to protect against crashes but not against
inconsistent values because of performance reasons.

sql/sql_class.cc:
  * Attempt snapshot of static memory pointer proc_info to avoid null pointers.
2008-11-07 13:12:56 +01:00
Georgi Kodinov
6cae4c33d0 merged 5.1-bugteam -> merge-5.1-bugteam 2008-11-06 16:24:59 +02:00
Georgi Kodinov
05dbb26dfc merged 5.1 main -> 5.1-bugteam 2008-11-06 16:18:25 +02:00
Mattias Jonsson
e337639daa post push fix, removing dbug_print due to compiler warning 2008-11-06 13:47:41 +01:00
Mattias Jonsson
559efbf14e merge 2008-11-06 07:29:07 +01:00
Mattias Jonsson
8a544f2a73 merge 2008-11-05 21:13:54 +01:00
Mattias Jonsson
7c5d066b39 merge 2008-11-05 20:44:19 +01:00
Evgeny Potemkin
3c49cb0795 Bug#37870: Usage of uninitialized value caused failed assertion.
The convert_constant_item function converts a constant to integer using
field for condition like 'field = a_constant'. In some cases the
convert_constant_item is called for a subquery when outer select is already
being executed, so convert_constant_item saves field's value to prevent its
corruption. For EXPLAIN and at the prepare phase field's value isn't
initialized yet, thus when convert_constant_item tries to restore saved
value it fails assertion.

Now the convert_constant_item doesn't save/restore field's value if it's
haven't been read yet. Outer constant values are always saved.

mysql-test/r/explain.result:
  Added a test case for the bug#37870.
mysql-test/t/explain.test:
  Added a test case for the bug#37870.
sql/item_cmpfunc.cc:
  Bug#37870: Usage of uninitialized value caused failed assertion.
  Now the convert_constant_item doesn't save/restore field's value if it's
  haven't been read yet. Outer constant values are always saved.
2008-11-05 18:40:23 +03:00
Mattias Jonsson
74f678d88a merge 2008-11-05 15:58:35 +01:00
Mattias Jonsson
bcd88c9f9e Bug#40494: MYSQL server crashes on range access with partitioning and
order by

Problem was that the first index read was unordered,
and the next was ordered, resulting in use of
uninitialized data.

Solution was to use the correct variable to see if
the 'next' call should be ordered or not.

mysql-test/r/partition.result:
  Bug#40494: MYSQL server crashes on range access with
  partitioning and order by
  
  Added test case for the bug.
mysql-test/t/partition.test:
  Bug#40494: MYSQL server crashes on range access with
  partitioning and order by
  
  Added test case for the bug.
sql/ha_partition.cc:
  Bug#40494: MYSQL server crashes on range access with
  partitioning and order by
  
  Used the wrong variable to decide to continue with
  ordered or unordered scan.
2008-11-05 15:53:28 +01:00
Joerg Bruehe
12ad7f3b9d Merge 5.1-build -> main, to be used in 5.1.30 2008-11-04 13:44:19 +01:00
Mattias Jonsson
c8ee385d89 merge 2008-11-04 12:33:55 +01:00
Kristofer Pettersson
2b3fa95537 Automerge 2008-11-04 11:46:05 +01:00
Tatiana A. Nurnberg
3b50efc34b Bug#39117 "plugin_load" option not documented
correct text describing the --plugin-load option to mysqld

sql/mysqld.cc:
  correct text describing the --plugin-load option to mysqld
2008-11-04 11:00:26 +01:00
Mattias Jonsson
460407d30b merge 2008-11-04 09:47:01 +01:00
Mattias Jonsson
747099e3fe merge 2008-11-04 09:36:56 +01:00
Mattias Jonsson
8dd07d32c9 merge 2008-11-04 08:55:43 +01:00
Mattias Jonsson
bb1ad9ce08 Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
The partitioning clause is only a very long single line, which is very
hard to interpret for a human. This patch breaks the partitioning
syntax into one line for the partitioning type, and one line per
partition/subpartition.

mysql-test/r/information_schema_part.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition_archive.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition_datatype.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition_mgm.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition_mgm_err.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition_not_windows.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition_range.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/r/partition_symlink.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/ndb/r/ndb_partition_key.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/ndb/r/ndb_partition_range.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/inc/partition_directory.inc:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Changed partitioning clause format for verifying the new output format.
mysql-test/suite/parts/r/ndb_dd_backuprestore.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/part_supported_sql_func_ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter1_1_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter1_1_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter1_2_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter1_2_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter2_1_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter2_1_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter2_2_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter2_2_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter3_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter3_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter4_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_alter4_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_basic_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_basic_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_basic_symlink_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_basic_symlink_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_bit_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_bit_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_bit_ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_char_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_char_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_datetime_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_datetime_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_decimal_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_decimal_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_engine_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_engine_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_engine_ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_float_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_float_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_int_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_int_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_int_ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc0_archive.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc0_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc0_memory.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc0_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc0_ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc1_archive.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc1_memory.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc1_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc1_ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc2_archive.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc2_memory.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_mgm_lc2_ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_special_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_special_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_syntax_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/partition_syntax_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/parts/r/rpl_partition.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl/r/rpl_extraCol_innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl/r/rpl_extraCol_myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl/r/rpl_row_basic_8partition.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/suite/rpl_ndb/r/rpl_ndb_myisam2ndb.result:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Updated test result due to the new partitioning clause output format.
mysql-test/t/partition.test:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Added small tests for for the new partitioning clause output format.
mysql-test/t/partition_mgm.test:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Added small tests for for the new partitioning clause output format.
sql/sql_partition.cc:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Changed formatting of the partitioning clause from single line into
  multiple indented lines
sql/sql_show.cc:
  Bug#14326: No formatting of partitioning clause in SHOW CREATE TABLE output
  
  Changed formatting of the partitioning clause from single line into
  multiple indented lines
2008-11-04 08:43:21 +01:00
Mats Kindahl
c780c2a24c Merging with 5.1-5.1.29-rc 2008-11-03 18:50:49 +01:00
Kristofer Pettersson
e7efb6e512 Auto merge 2008-11-03 14:22:17 +01:00
Kristofer Pettersson
5ef4fb2417 Bug#29507 TRUNCATE shows to many rows effected
TRUNCATE TABLE for InnoDB tables returned a count showing an approximation
of the number of rows affected to gain efficiency.
Now the statement always returns 0 rows affected for clarity.

sql/sql_delete.cc:
  * Set row count to 0 if auto increment was reset which can happen
  if TRUNCATE TABLE was issued.
2008-11-03 14:08:42 +01:00
Mats Kindahl
c3a5b59676 Bug #40360: Binlog related errors with binlog off
When statement-based replication is used, and the
transaction isolation level is READ-COMMITTED or stricter,
InnoDB will print an error because statement-based
replication might lead to inconsistency between master
and slave databases. However, when the binary log is not
engaged, this is not an issue and an error should
not be printed.

This patch makes thd_binlog_format() return BINLOG_FORMAT_
UNSPEC when the binary log is not engaged for the given
thread.

mysql-test/t/innodb_mysql.test:
  Adding test that no error message is printed from inside
  InnoDB when the binary log is turned off.
2008-11-03 12:14:48 +01:00
Georgi Kodinov
0d4aeaf6e3 merged 5.0 bug 33811 -> 5.1 bug 33811 working tree 2008-11-03 12:40:58 +02:00
Georgi Kodinov
6af9982569 merged 5.0-bugteam -> bug 33811-5.0-bugteam working tree 2008-11-03 11:50:32 +02:00
Ramil Kalimullin
84356ab0ad Merge 2008-10-31 14:02:06 +04:00
Mattias Jonsson
ea0fab9baf post-push fix for build warnings 2008-10-30 09:25:25 +01:00
Mattias Jonsson
58d2372b15 merge 2008-10-29 23:01:41 +01:00
Mats Kindahl
e030732861 Merging with 5.1-5.1.29-rc 2008-10-29 21:43:15 +01:00
Mattias Jonsson
fc74c4d9e5 merge 2008-10-29 21:30:04 +01:00
Mattias Jonsson
b72d1507db Bug#39084: Getting intermittent errors with statement-based binary logging
Problem was that partitioning cached the table flags.
These flags could change due to TRANSACTION LEVEL changes.
Solution was to remove the cache and always return the table flags
from the first partition (if the handler was initialized).

mysql-test/r/partition_innodb_stmt.result:
  Bug#39084: Getting intermittent errors with statement-based binary logging
  
  New test result file.
mysql-test/t/partition_innodb_stmt.test:
  Bug#39084: Getting intermittent errors with statement-based binary logging
  
  New test file.
sql/ha_partition.cc:
  Bug#39084: Getting intermittent errors with statement-based binary logging
  
  Removed m_table_flags, and added m_handler_status.
  Added checks that all partitions have the same
  table flags.
  Moved some variable initializations.
  Updated some comments.
  Fixed typo initialise -> initialize
  Changed HA_EXTTA_NO_READCHECK to do nothing, since it
  is only used in ha_open, which is called for every
  partition in ::open anyway.
sql/ha_partition.h:
  Bug#39084: Getting intermittent errors with statement-based binary logging
  
  Removed m_table_flags, and added m_handler_status.
  Always return the first partitions table flags, instead of using
  cached table flags.
  Added define of enabled/disabled partitioning table flags
  Fixed type initialise -> initialize
  Updated some comments.
sql/handler.cc:
  Bug#39084: Getting intermittent errors with statement-based binary logging
  
  Fixed type initialise -> initialize.
sql/handler.h:
  Bug#39084: Getting intermittent errors with statement-based binary logging
  
  Added comment to understand where the cached value is set.
2008-10-29 21:20:04 +01:00
Evgeny Potemkin
6e0c62fd6c Merged fix for the bug#37870. 2008-10-27 19:36:27 +03:00
Evgeny Potemkin
545e4c58b2 Corrected fix for the bug#37870. 2008-10-27 19:19:26 +03:00
Sergey Glukhov
caa73f2218 automerge 2008-10-27 17:11:44 +04:00
Evgeny Potemkin
fbb6efeb51 Merged fix for the bug#37870. 2008-10-27 15:04:51 +03:00
Sergey Glukhov
903c4dcf3b 5.0-bugteam->5.1-bugteam merge(bug#39040) 2008-10-27 15:58:51 +04:00
Sergey Glukhov
380f1a8440 Bug#39040 valgrind errors/crash when creating views with binlog logging enabled
A string buffers which were included in the 'view' data structure
were allocated on the stack, causing an invalid pointer when used
after the function returned.
The fix: use copy of values for view->md5 & view->queries


mysql-test/r/view.result:
  test result
mysql-test/t/view.test:
  test case
sql/sql_view.cc:
  A string buffers which were included in the 'view' data structure
  were allocated on the stack, causing an invalid pointer when used
  after the function returned.
  The fix: use copy of values for view->md5 & view->queries
2008-10-27 14:22:38 +04:00
Evgeny Potemkin
e27e560783 Bug#37870: Usage of uninitialized value caused failed assertion.
The convert_constant_item function converts a constant to integer using
field for condition like 'field = a_constant'. When the convert_constant_item
is called for a subquery the outer select is already being executed, so
convert_constant_item saves field's value to prevent its corruption.
For EXPLAIN field's value isn't initialized thus when convert_constant_item
tries to restore saved value it fails assertion.
      
Now the convert_constant_item doesn't save/restore field's value
for EXPLAIN.


mysql-test/r/explain.result:
  Added a test case for the bug#37870.
mysql-test/t/explain.test:
  Added a test case for the bug#37870.
sql/item_cmpfunc.cc:
  Bug#37870: Usage of uninitialized value caused failed assertion.
  Now the convert_constant_item doesn't save/restore field's value
  for EXPLAIN.
2008-10-27 12:26:32 +03:00
Guilhem Bichot
f2d8af59f6 Backport of fix made in 6.0-maria in revision guilhem@mysql.com-20081020202418-yay1h55w9ffagp42
sql/sql_class.cc:
  Backport of fix made in 6.0-maria in revision guilhem@mysql.com-20081020202418-yay1h55w9ffagp42
  (this undoes a change made in WL 3064 (the deadlock detector patch) which asserted in
  "./mtr --embedded innodb_mysql" in 6.0-maria)
2008-10-24 23:39:19 +02:00
Davi Arnaut
d4438c99ff Merge from mysql-5.1-5.1.29-rc into mysql-5.1-bugteam 2008-10-24 11:58:48 -02:00
Davi Arnaut
463c837c3a Merge from mysql-5.0-bugteam into mysql-5.1-bugteam
mysql-test/r/partition_not_windows.result:
  Update warning number due to new errors appearing earlier
  in the list.
mysql-test/r/partition_symlink.result:
  Update warning number due to new errors appearing earlier
  in the list.
mysql-test/r/symlink.result:
  Update warning number due to new errors appearing earlier
  in the list.
2008-10-24 10:50:59 -02:00
Ramil Kalimullin
256f41edfe Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
Problem: mysqld doesn't detect that enum data must be reinserted performing
'ALTER TABLE' in some cases.

Fix: reinsert data altering an enum field if enum values are changed.


mysql-test/r/alter_table.result:
  Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
    - test result.
mysql-test/t/alter_table.test:
  Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
    - test case.
sql/field.cc:
  Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
    - Field_enum::is_equal() introduced, which is called to detect that a field
  is changing by 'ALTER TABLE'.
sql/field.h:
  Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
    - Field_enum::is_equal() introduced, which is called to detect that a field
  is changing by 'ALTER TABLE'.
2008-10-24 13:00:03 +05:00
Sergey Petrunia
d5202ddd31 Merge 2008-10-24 06:37:29 +04:00
Sergey Petrunia
844797c492 BUG#38072: Wrong result: HAVING not observed in a query with aggregate
- Make send_row_on_empty_set() return FALSE when simplify_cond() has found out
  that HAVING is always FALSE
re-committing to put the fix into 5.0 and 5.1

mysql-test/r/group_by.result:
  BUG#38072: Wrong result: HAVING not observed in a query with aggregate
  - Testcase
mysql-test/t/group_by.test:
  BUG#38072: Wrong result: HAVING not observed in a query with aggregate
  - Testcase
sql/sql_select.h:
  BUG#38072: Wrong result: HAVING not observed in a query with aggregate
  - Make send_row_on_empty_set() return FALSE when simplify_cond() has found out
    that HAVING is always FALSE
2008-10-24 06:16:22 +04:00
Davi Arnaut
03300dc1a4 Merge from mysql-5.1-5.1.29-rc into mysql-5.1-bugteam 2008-10-23 19:03:26 -02:00
Mattias Jonsson
620d955e3a Bug#40176: update as first partitioning statement
breaks auto increment

The auto_increment value was not initialized if
the first statement after opening a table was
an 'UPDATE'.

solution was to check initialize if it was not,
before trying to increase it in update.

mysql-test/suite/parts/inc/partition_auto_increment.inc:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  Added tests for verifying the bug and show some more
  auto_increment flaws
mysql-test/suite/parts/r/partition_auto_increment_archive.result:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_memory.result:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  Updated test results, due to added tests
mysql-test/suite/parts/r/partition_auto_increment_ndb.result:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  Updated test results, due to added tests
sql/ha_partition.cc:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  make sure that the auto_increment value is initialized
  before updating it.
  
  (missed initializing in mysql_update_row).
sql/ha_partition.h:
  Bug#40176: update as first partitioning statement
  breaks auto increment
  
  Assert that it is initialized, before updating
  the auto_increment value
2008-10-23 22:14:07 +02:00
Vladislav Vaintroub
2559cd1ce5 merge 2008-10-23 22:05:47 +02:00
Mats Kindahl
32c161f3ea Merging 5.1 main into 5.1-rpl 2008-10-23 21:27:09 +02:00
Vladislav Vaintroub
0d220ba7ca merge fix for Bug40280 from 5.0 2008-10-23 17:59:22 +02:00
Georgi Kodinov
6d47da9916 merged 5.1-main to 5.1-5.1.29-rc 2008-10-23 16:39:21 +03:00
Vladislav Vaintroub
49ff055736 Bug#40280: Message compiler(mc.exe) needed to compile MySQL on windows.
Visual Studio 2008 Express edition does not include message compiler mc.exe
It is not possible to build MySQL server if only VC2008 Express is installed,
because we use mc.exe to generate event log messages.

This patch removes the mc.exe dependency. Generated files message.h, 
message.rc and MSG00001.bin  are checked into source code repository.
Instructions on how to add or change messages are added to messages.mc
2008-10-23 15:28:53 +02:00
Davi Arnaut
d7263d2a70 Merge Bug#28323 to mysql-5.1.29-rc 2008-10-21 18:28:01 -02:00
Davi Arnaut
41dd7b6b92 Bug#28323: Server crashed in xid cache operations
The problem was that the server did not robustly handle a
unilateral roll back issued by the Resource Manager (RM)
due to a resource deadlock within the transaction branch.
By not acknowledging the roll back, the server (TM) would
eventually corrupt the XA transaction state and crash.

The solution is to mark the transaction as rollback-only
if the RM indicates that it rolled back its branch of the
transaction.

mysql-test/r/xa.result:
  Add test case result for Bug#28323
mysql-test/t/xa.test:
  Add test case for Bug#28323
sql/handler.cc:
  Reset XID only at the end of the global transaction.
sql/share/errmsg.txt:
  Add new error codes.
sql/sql_class.h:
  Remember the error reported by the Resource Manager.
sql/sql_parse.cc:
  Rollback the transaction if the Resource Manager reported
  a error and rolled back its branch of the transaction.
2008-10-21 16:07:31 -02:00
Davi Arnaut
9ad8d64439 Bug#28323: Server crashed in xid cache operations
The problem was that the server did not robustly handle a
unilateral roll back issued by the Resource Manager (RM)
due to a resource deadlock within the transaction branch.
By not acknowledging the roll back, the server (TM) would
eventually corrupt the XA transaction state and crash.

The solution is to mark the transaction as rollback-only
if the RM indicates that it rolled back its branch of the
transaction.

mysql-test/r/xa.result:
  Add test case result for Bug#28323
mysql-test/t/xa.test:
  Add test case for Bug#28323
sql/handler.cc:
  Reset XID only at the end of the global transaction.
sql/share/errmsg.txt:
  Add new error codes.
sql/sql_class.h:
  Remember the error reported by the Resource Manager.
sql/sql_parse.cc:
  Rollback the transaction if the Resource Manager reported
  a error and rolled back its branch of the transaction.
2008-10-21 15:45:43 -02:00
Kristofer Pettersson
e291aab7da Bug#39451 Debug builds broken with Sun Studio compiler
Debug builds of MySQL 5.1, 6.0 with Sun Studio 12 broke because of
use of gcc specific feature.
            
The fix is to replace __FUNCTION__ with the corresponding character string
2008-10-21 14:18:38 +02:00
Georgi Kodinov
f698f0b32e merge 5.1-bugteam -> bug 38693-5.1-bugteam 2008-10-21 11:00:08 +03:00
Georgi Kodinov
3c02669069 merged 5.0-bugteam -> 5.1-bugteam 2008-10-21 10:55:03 +03:00
Kristofer Pettersson
8ab6a30095 Auto merge 2008-10-21 09:00:42 +02:00
Mats Kindahl
2019f17276 Bug #40004 Replication failure with no PK + no indexes
In certain situations, a scan of the table will return the error
code HA_ERR_RECORD_DELETED, and this error code is not 
correctly caught in the Rows_log_event::find_row() function, which
causes an error to be returned for this case.

This patch fixes the problem by adding code to either ignore the
record and continuing with the next one, the the event of a table
scan, or change the error code to HA_ERR_KEY_NOT_FOUND, in the event
that a key lookup is attempted.
2008-10-20 20:50:08 +02:00
Georgi Kodinov
d501f48757 merge 5.0-bugteam -> bug 38693-5.0-bugteam 2008-10-20 16:26:07 +03:00
Kristofer Pettersson
195db07ff3 Auto commit 2008-10-20 13:39:33 +02:00
Georgi Kodinov
697b2839db Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN
fails after the first time
  
Two separate problems : 
  1. When flattening joins the linked list used for name resolution 
  (next_name_resolution_table) was not updated.
  Fixed by updating the pointers when extending the table list
  
  2. The items created by expanding a * (star) as a column reference
  were marked as fixed, but no cached table was assigned to them 
  (unlike what Item_field::fix_fields does).
  Fixed by assigning a cached table (so the re-preparation is done
  faster).
  
Note that the fix for #2 hides the fix for #1 in most cases
(except when a table reference cannot be cached).

mysql-test/r/sp.result:
  Bug #33811: test case
mysql-test/t/sp.test:
  Bug #33811: test case
sql/sql_base.cc:
  Bug #33811: cache the table for Item_fields created by expanding '*'
sql/sql_select.cc:
  Bug #33811: maintain a correct name resolution chain when
  flattening joins.
2008-10-17 17:55:06 +03:00
Ramil Kalimullin
bba814d0b9 Fix for bug #40053: 'check table .. for upgrade' doesn't detect
collation change made in 5.1.24-rc

Problem: 'CHECK TABLE ... FOR UPGRADE' did not check for 
incompatible collation changes made in MySQL 5.1.24-rc.

Fix: add the check.


sql/handler.cc:
    - check for incompatible collation changes made in 5.1.24-rc:
  bug #27877:
    utf8_general_ci
    ucs2_general_ci
2008-10-17 17:45:17 +05:00
Georgi Kodinov
e7a6e86f78 Bug #38637: COUNT DISTINCT prevents NULL testing in HAVING clause
IS NULL was not checking the correct row in a HAVING context.
At the first row of a new group (where the HAVING clause is evaluated)
the column and SELECT list references in the HAVING clause should 
refer to the last row of the previous group and not to the current one. 
This was not done for IS NULL, because it was using Item::is_null() doesn't
have a  Item_is_null_result() counterpart to access the data from the 
last row of the previous group. Note that all the Item::val_xxx() functions 
(e.g. Item::val_int()) have their _result counterparts (e.g. Item::val_int_result()).

Fixed by implementing a is_null_result() (similarly to int_result()) and
calling this instead of is_null() column and SELECT list references inside
the HAVING clause.

mysql-test/r/having.result:
  Bug #38637: test case
mysql-test/t/having.test:
  Bug #38637: test case
sql/item.cc:
  Bug #38637: implement Item::is_null_result() and call it
  from Item_ref and Item_field as appropriate.
sql/item.h:
  Bug #38637: implement Item::is_null_result() and call it
  from Item_ref and Item_field as appropriate.
sql/item_func.cc:
  Bug #38637: implement Item::is_null_result() and call it
  from Item_ref and Item_field as appropriate.
sql/item_func.h:
  Bug #38637: implement Item::is_null_result() and call it
  from Item_ref and Item_field as appropriate.
2008-10-17 13:55:16 +03:00
Gleb Shchepa
39d165dd74 merge 5.0-bugteam --> 5.1-bugteam (bug 39844) 2008-10-16 23:04:31 +05:00
Gleb Shchepa
b591793496 Bug #39844: Query Crash Mysql Server 5.0.67
Server crashed during a sort order optimization
of a dependent subquery:

SELECT
    (SELECT t1.a FROM t1, t2
      WHERE t1.a = t2.b AND t2.a = t3.c
      ORDER BY t1.a)
  FROM t3;


Bitmap of tables, that the reference to outer table
column uses, in addition to the regular table bit
has the OUTER_REF_TABLE_BIT bit set.
The only_eq_ref_tables function traverses this map
bit by bit simultaneously with join->map2table list.
Obviously join->map2table never contains an entry
for the OUTER_REF_TABLE_BIT pseudo-table, so the
server crashed there.


The only_eq_ref_tables function has been modified
to traverse regular table bits only like the
update_depend_map function (resetting of the
OUTER_REF_TABLE_BIT there is enough, but
resetting of the whole set of PSEUDO_TABLE_BITS
is used there for sure).


mysql-test/r/order_by.result:
  Added test case for bug #39844.
mysql-test/t/order_by.test:
  Added test case for bug #39844.
sql/sql_select.cc:
  Bug #39844: Query Crash Mysql Server 5.0.67
  
  The only_eq_ref_tables function has been modified
  to traverse regular table bits only like the
  update_depend_map function (resetting of the
  OUTER_REF_TABLE_BIT there is enough, but
  resetting of the whole set of PSEUDO_TABLE_BITS
  is used there for sure).
2008-10-16 21:37:17 +05:00
Davi Arnaut
6525348368 Merge mysql-5.0-bugteam into mysql-5.1-bugteam. 2008-10-15 22:50:56 -03:00
Davi Arnaut
3ad228d7fb Bug#37075: offset of limit clause might be truncated on 32-bits server w/o big tables
The problem is that the offset argument of the limit clause
might be truncated on a 32-bits server built without big
tables support. The truncation was happening because the
original 64-bits long argument was being cast to a 32-bits
(ha_rows) offset counter.

The solution is to check if the conversing resulted in value
truncation and if so, the offset is set to the maximum possible
value that can fit on the type.

mysql-test/r/limit.result:
  Add test case result for Bug#37075
mysql-test/t/limit.test:
  Add test case for Bug#37075
sql/sql_lex.cc:
  Check for truncation of the offset value. If value was
  truncated, set to the maximum possible value.
2008-10-15 18:34:51 -03:00
Georgi Kodinov
747351836c Bug #38693: leaked memory with blobs!
If delayed insert fails to upgrade the lock it was not
freeing the temporary memory storage used to keep
newly constructed blob values in memory.
Fixed by iterating over the remaining rows in the delayed
insert rowset and freeing the blob storage for each row.

No test suite because it involves concurrent delayed inserts 
on a table and cannot easily be made deterministic. 

Added a correct valgrind suppression for Fedora 9.

mysql-test/valgrind.supp:
  Added a vagrind suppression for Fedora 9
sql/sql_insert.cc:
  Bug #38693: free the blobs temp storage on error.
2008-10-15 16:55:52 +03:00
Kristofer Pettersson
7fa3897e8a automerge 2008-10-15 12:06:44 +02:00
Kristofer Pettersson
d0b8dd4555 automerge 2008-10-15 09:55:15 +02:00
Davi Arnaut
017307f216 Bug#38823: Invalid memory access when a SP statement does wildcard expansion
The problem is that field names constructed due to wild-card
expansion done inside a stored procedure could point to freed
memory if the expansion was performed after the first call to
the stored procedure.

The problem was solved by patch for Bug#38691. The solution
was to allocate the database, table and field names in the
in the statement memory instead of table memory.

mysql-test/r/sp.result:
  Add test case result for Bug#38823
mysql-test/t/sp.test:
  Add test case for Bug#38823
sql/item.cc:
  Remark that this also impacts wildcard expansion inside SPs.
2008-10-14 11:04:36 -03:00
Georgi Kodinov
8bb2eb38f5 merged 5.1-main -> 5.1-bugteam 2008-10-13 13:22:36 +03:00
Michael Widenius
058916ae02 Fix for bug#39226 Maria: crash with FLUSH TABLES WITH READ LOCK after LOCK TABLES
- The problem was that we didn't inform the handler that we are going to close tables that are locked and may have (at least in Maria) be part of an active transaction.
Fix for Bug#39227 Maria: crash with ALTER TABLE PARTITION
Fix for Bug #39987 main.partition_not_windows fails under debug build
Fixed some compiler errors & warnings found by pushbuild

include/my_base.h:
  Added HA_EXTRA_PREPARE_FOR_FORCED_CLOSE for signaling the handler that the file will be forced closed
include/my_global.h:
  Removed 'register' from 'swap_variables' as this gives a warnings when the variables are structs. Compilers should also now be smart enough to figure out this themselves
mysql-test/r/subselect_debug.result:
  Reset value of the debug variable;  Without setting this the subselect_innodb test will fail when run after this one
mysql-test/suite/maria/r/maria.result:
  Merged test with myisam.test
  Added tests for new fixed bugs
mysql-test/suite/maria/t/maria.test:
  Merged test with myisam.test
  Added tests for new fixed bugs
mysql-test/t/subselect_debug.test:
  Reset value of the debug variable;  Without setting this the subselect_innodb test will fail when run after this one
mysys/my_uuid.c:
  Fixed compiler error on windows
sql/ha_partition.cc:
  Added support for the new extra flag: HA_EXTRA_PREPARE_FOR_FORCED_CLOSE (Bug #39226)
  Ensure that we call extra() for HA_EXTRA_PREPARE_FOR_DROP (Bug#39227)
sql/mysqld.cc:
  Fix for Bug #39987 main.partition_not_windows fails under debug build
  The problem was that when compiling for purify/valgrind realpath() is not used, which causes test_if_data_home_dir to fail when it shouldn't
sql/sql_base.cc:
  Call HA_EXTRA_PREPARE_FOR_FORCED_CLOSE for tables that are locked but we are going to force close without doing a commit
sql/sql_parse.cc:
  More DBUG_PRINT. Fixed comments
storage/maria/ma_extra.c:
  If HA_EXTRA_PREPARE_FOR_FORCED_CLOSE is called and the table is part of a transaction, remove the table from beeing part of a transaction.
  This is safe as this is only used as part of flush tables or when the table is not part of a transaction
storage/myisam/mi_open.c:
  Indentation fix
unittest/mysys/waiting_threads-t.c:
  Remove not needed 'volatile' to get rid of compiler warnings on windows
2008-10-12 13:09:52 +03:00
Michael Widenius
5d2a1425d7 (Mostly) automatic merge
Fixed also some failing tests after merge. The files that was touched outside of the merge has a more explicit comment


include/my_global.h:
  Remove 'register' from 'swap_variables' as this gives a warnings when the variables are structs. Compilers should also now be smart enough to figure out this themselves
mysql-test/t/subselect_debug.test:
  Reset value of the debug variable;  Without setting this the subselect_innodb test will fail when run after this one
sql/mysqld.cc:
  Fix for Bug #39987 main.partition_not_windows fails under debug build
  The problem was that when compiling for purify/valgrind realpath() is not used, which causes test_if_data_home_dir to fail when it shouldn't
unittest/mysys/waiting_threads-t.c:
  Remove not needed 'volatile' to get rid of compiler warnings on windows
2008-10-12 11:57:24 +03:00
unknown
d93fe58302 Aligned declaration and defintion of ha_change_partitions(), to avoid link
error using SunStudio 12.
2008-10-11 18:35:49 +02:00
Michael Widenius
56100f3a49 Merged 5.1 maria with 5.1 maria team tree. Automerge. 2008-10-11 11:27:03 +03:00
Build Team
7f34685963 Added "-rc" to the version
Removed use of __FUNCTION__
2008-10-11 01:12:39 +02:00
Mattias Jonsson
c6115db4c3 Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table

Problem was that partitioning specific commands was accepted
for non partitioned tables and treated like
ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE, after bug-20129 was fixed,
which changed the code path from mysql_alter_table to
mysql_admin_table.

Solution was to check if the table was partitioned before
trying to execute the admin command

mysql-test/r/partition_mgm_err.result:
  Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
  on non-partitioned table
  
  Updated test result
mysql-test/t/partition_mgm_err.test:
  Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
  on non-partitioned table
  
  Updated test case
sql/ha_partition.cc:
  Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
  on non-partitioned table
  
  Simplified the code by using ALTER_ADMIN_PARTITION for all
  commands that go through mysql_admin_tables and is set
  for partitioning specific commands that.
sql/ha_partition.h:
  Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
  on non-partitioned table
  
  Simplified the code by using ALTER_ADMIN_PARTITION for all
  commands that go through mysql_admin_tables and is set
  for partitioning specific commands that.
sql/sql_lex.h:
  Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
  on non-partitioned table
  
  Simplified the code by using ALTER_ADMIN_PARTITION for all
  commands that go through mysql_admin_tables and is set
  for partitioning specific commands that.
  
  Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
  added ALTER_ADMIN_PARTITION instead.
sql/sql_partition.cc:
  Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
  on non-partitioned table
  
  Simplified the code by using ALTER_ADMIN_PARTITION for all
  commands that go through mysql_admin_tables and is set
  for partitioning specific commands that.
  
  Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
  added ALTER_ADMIN_PARTITION instead.
sql/sql_table.cc:
  Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
  on non-partitioned table
  
  Give error and return if trying partitioning admin command
  on non partitioned table.
  
  Simplified the code by using ALTER_ADMIN_PARTITION for all
  commands that go through mysql_admin_tables and is set
  for partitioning specific commands that.
  
  Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
  added ALTER_ADMIN_PARTITION instead.
sql/sql_yacc.yy:
  Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
  on non-partitioned table
  
  Simplified the code by using ALTER_ADMIN_PARTITION for all
  commands that go through mysql_admin_tables and is set
  for partitioning specific commands that.
  
  Removed ALTER_ANALYZE/CHECK/OPTIMIZE/REPAIR_PARTITION and
  added ALTER_ADMIN_PARTITION instead.
2008-10-10 20:12:38 +02:00
Michael Widenius
57c1a63d49 Merge with 5.1-maria 2008-10-10 18:57:37 +03:00
Michael Widenius
f47e003e1b Merged 5.1 with maria 5.1 2008-10-10 18:28:41 +03:00
Georgi Kodinov
9b6347f0ab merged 5.0-main -> 5.0-bugteam 2008-10-10 17:27:16 +03:00
Michael Widenius
3bbba83407 Fix for bug#39226 Maria: crash with FLUSH TABLES WITH READ LOCK after LOCK TABLES
The problem was that we didn't inform the handler that we are going to close tables that are locked and may have (at least in Maria) be part of an active transaction.

Fix for Bug#39227 Maria: crash with ALTER TABLE PARTITION



include/my_base.h:
  Added HA_EXTRA_PREPARE_FOR_FORCED_CLOSE for signaling the handler that the file will be forced closed
mysql-test/r/maria.result:
  Test cases for bugs fixed
mysql-test/t/maria.test:
  Test cases for bugs fixed
sql/ha_partition.cc:
  Added support for the new extra flag: HA_EXTRA_PREPARE_FOR_FORCED_CLOSE (Bug #39226)
  Ensure that we call extra() for HA_EXTRA_PREPARE_FOR_DROP (Bug#39227)
sql/sql_base.cc:
  Call HA_EXTRA_PREPARE_FOR_FORCED_CLOSE for tables that are locked but we are going to force close without doing a commit
storage/maria/ma_extra.c:
  If HA_EXTRA_PREPARE_FOR_FORCED_CLOSE is called and the table is part of a transaction, remove the table from beeing part of a transaction. This is safe as this is only used as part of flush tables or when the table is not part of a transaction
2008-10-10 17:14:39 +03:00
Georgi Kodinov
b6704027d6 merged 5.1-bugteam -> bug 34773 tree 2008-10-10 16:07:53 +03:00
Gleb Shchepa
639ef9fa4c manual merge 5.0-bugteam --> 5.1-bugteam 2008-10-10 16:48:47 +05:00
Gleb Shchepa
3e96ed0c6c automerge 5.0-bugteam --> 5.1-bugteam 2008-10-10 16:44:10 +05:00
Kristofer Pettersson
1ad9b71193 Bug#39451 Debug builds broken with Sun Studio compiler
Debug builds of MySQL 5.1, 6.0 with Sun Studio 12 broke because of
use of gcc specific feature.
      
The fix is to replace __FUNCTION__ with the corresponding character
string
2008-10-10 13:00:27 +02:00
Gleb Shchepa
097b60bd06 Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
Select with a "NULL NOT IN" condition containing complex
subselect from the same table as in the outer select failed
with an assertion.


The failure was caused by a concatenation of circumstances:
1) an inner select was optimized by make_join_statistics to use
   the QUICK_RANGE_SELECT access method (that implies an index
   scan of the table);
2) a subselect was independent (constant) from the outer select;
3) a condition was pushed down into inner select.

During the evaluation of a constant IN expression an optimizer
temporary changed the access method from index scan to table
scan, but an engine handler was already initialized for index
access by make_join_statistics. That caused an assertion.


Unnecessary index initialization has been removed from
the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset
reinvokes this initialization).


mysql-test/r/subselect3.result:
  Added test case for bug #37894.
mysql-test/t/subselect3.test:
  Added test case for bug #37894.
sql/opt_range.cc:
  Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
  
  Unnecessary index initialization has been removed from
  the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset
  reinvokes this initialization).
2008-10-10 15:27:58 +05:00
Gleb Shchepa
8bfbcbd981 Bug #39283: Date returned as VARBINARY to client for queries
with COALESCE and JOIN

The server returned to a client the VARBINARY column type
instead of the DATE type for a result of the COALESCE,
IFNULL, IF, CASE, GREATEST or LEAST functions if that result
was filesorted in an anonymous temporary table during
the query execution.

For example:
  SELECT COALESCE(t1.date1, t2.date2) AS result
    FROM t1 JOIN t2 ON t1.id = t2.id ORDER BY result;


To create a column of various date/time types in a
temporary table the create_tmp_field_from_item() function
uses the Item::tmp_table_field_from_field_type() method
call. However, fields of the MYSQL_TYPE_NEWDATE type were
missed there, and the VARBINARY columns were created
by default.
Necessary condition has been added.


mysql-test/r/metadata.result:
  Added test case for bug #39283.
mysql-test/t/metadata.test:
  Added test case for bug #39283.
sql/sql_select.cc:
  Bug #39283: Date returned as VARBINARY to client for queries
              with COALESCE and JOIN
  
  To create a column of various date/time types in a
  temporary table the create_tmp_field_from_item() function
  uses the Item::tmp_table_field_from_field_type() method
  call. However, fields of the MYSQL_TYPE_NEWDATE type were
  missed there, and the VARBINARY columns were created
  by default.
  Necessary condition has been added.
2008-10-10 15:13:12 +05:00
Mattias Jonsson
d3ea743015 Bug#37721: ORDER BY when WHERE contains non-partitioned
index column

There was actually two problems
1) when clustered pk, order by non pk index should also
compare with pk as last resort to differ keys from each
other
2) bug in the index search handling in ha_partition (was
found when extending the test case

Solution to 1 was to include the pk in key compare if
clustered pk and search on other index.

Solution for 2 was to remove the optimization from
ordered scan to unordered scan if clustered pk.

mysql-test/r/partition_innodb.result:
  Bug#37721: ORDER BY when WHERE contains non-partitioned
  index column
  
  updated test result.
mysql-test/t/partition_innodb.test:
  Bug#37721: ORDER BY when WHERE contains non-partitioned
  index column
  
  Added test case for bug verification.
sql/ha_partition.cc:
  Bug#37721: ORDER BY when WHERE contains non-partitioned
  index column
  
  using m_curr_key_info with both given index and PK
  if clustered PK.
  Also including PK in read_set.
  Added debug prints for easier verification.
sql/ha_partition.h:
  Bug#37721: ORDER BY when WHERE contains non-partitioned
  index column
  
  Changed m_curr_key_info to a null terminated array
  with max 2 keys and a terminating null.
  For use with key_rec_cmp with both given index and PK.
sql/key.cc:
  Bug#37721: ORDER BY when WHERE contains non-partitioned
  index column
  
  added handling of a null terminated array of keys for
  use in compare.
2008-10-10 12:01:01 +02:00
Georgi Kodinov
feb051be81 Bug #32124 addendum #2
- fixed an unitialized memory read
 - fixed a compilation warning
 - added a suppression for FC9 x86_64

mysql-test/valgrind.supp:
  Bug #3214: added a suppression for FC9 x86_64
sql/item_func.cc:
  Bug #32124
   - fixed an unitialized memory read
   - fixed a compilation warning
2008-10-10 12:52:23 +03:00
Gleb Shchepa
0c20c0f12f manual merge 5.0-5.1.29-rc --> 5.1-5.1.29-rc 2008-10-09 20:57:41 +05:00
Gleb Shchepa
a83f5b18ef Bug#38499: flush tables and multitable table update with
derived table cause crash

When a multi-UPDATE command fails to lock some table, and
subsequently succeeds, the tables need to be reopened if
they were altered. But the reopening procedure failed for
derived tables.

Extra cleanup has been added.


mysql-test/r/lock_multi.result:
  Added test case for bug #38499.
mysql-test/t/lock_multi.test:
  Added test case for bug #38499.
sql/sql_union.cc:
  Bug#38499: flush tables and multitable table update with
             derived table cause crash
  
  Obsolete assertion has been removed.
sql/sql_update.cc:
  Bug#38499: flush tables and multitable table update with
             derived table cause crash
  
  Extra cleanup for derived tables has been added:
  1) unit.cleanup(),
  2) unit->reinit_exec_mechanism().
2008-10-09 20:24:31 +05:00
Georgi Kodinov
486a0d7e14 merged 5.1-bugteam -> 32124 2008-10-09 18:07:50 +03:00
Georgi Kodinov
9f31df646f Bug #32124 addendum
Fixed the handling of system variable retrieval
in prepared statements : added a cleanup method
that clears up the cache and restores the 
original scope of the variable (which is overwritten
at fix_fields()).

sql/item_func.cc:
  ug #32124: 
   - preserve the requested variable scope
   - clean up the cache and restore the variable
     scope for prepared statements.
sql/item_func.h:
  Bug #32124: preserve the requested variable scope
2008-10-09 18:03:23 +03:00
Sergey Glukhov
169a65aacd Bug#29153 SHOW and INFORMATION_SCHEMA commands increment Created_tmp_disk_tables
TRIGGERS.SQL_MODE, EVENTS.SQL_MODE, TRIGGERS.DEFINER:
field type is changed to VARCHAR.


mysql-test/r/information_schema.result:
  result fix
mysql-test/r/show_check.result:
  result fix
mysql-test/suite/funcs_1/r/is_columns_is.result:
  result fix
mysql-test/suite/funcs_1/r/is_events.result:
  result fix
mysql-test/suite/funcs_1/r/is_triggers.result:
  result fix
sql/sql_show.cc:
  TRIGGERS.SQL_MODE, EVENTS.SQL_MODE, TRIGGERS.DEFINER:
  field type is changed to VARCHAR.
2008-10-09 17:09:30 +05:00
Sergey Glukhov
1e4f12d65d Bug#39372 "Smart" ALTER TABLE not so smart after all.
The problem was that PACK_KEYS and MAX_ROWS clause in ALTER TABLE did not trigger
table reconstruction.
The fix is to rebuild a table if PACK_KEYS or MAX_ROWS are specified.


mysql-test/r/alter_table.result:
  test result
mysql-test/t/alter_table.test:
  test case
sql/sql_table.cc:
  The problem was that PACK_KEYS and MAX_ROWS clause in ALTER TABLE did not trigger
  table reconstruction.
  The fix is to rebuild a table if PACK_KEYS or MAX_ROWS are specified.
2008-10-09 15:49:13 +05:00
Georgi Kodinov
0bc7aa2516 WL4403: --general_log and --slow_query_log don't turn on the logging.
Fixed a compilation warning
2008-10-09 13:39:42 +03:00
Sergey Glukhov
56810c9d65 Bug#35068 Assertion fails when reading from i_s.tables and there is incorrect merge table
Hide "Table doesn't exist" errors if the table belongs to a merge table.


mysql-test/r/merge.result:
  result fix
mysql-test/t/merge.test:
  test case
sql/sql_base.cc:
  Hide "Table doesn't exist" errors if the table belongs to a merge table.
2008-10-09 13:55:16 +05:00
Sergey Glukhov
95b721e628 Bug#38918 selecting from information_schema.columns is disproportionately slow
The problem: table_open_method is not calculated properly if '*' is used in 'select'
The fix: added table_open_method calculation for such case


mysql-test/r/information_schema.result:
  test result
mysql-test/t/information_schema.test:
  test case
sql/sql_show.cc:
  The problem: table_open_method is not calculated properly if '*' is used in 'select'
  The fix: added table_open_method calculation for such case
2008-10-09 12:50:29 +05:00
Kristofer Pettersson
f985e78775 Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
When running Stored Routines the Status Variable "Questions" was wrongly
incremented. According to the manual it should contain the "number of
statements that clients have sent to the server"
              
Introduced a new status variable 'questions' to replace the query_id
variable which currently corresponds badly with the number of statements
sent by the client.
            
The new behavior is ment to be backward compatible with 4.0 and at the
same time work with new features in a similar way.
            
This is a backport from 6.0

mysql-test/r/status2.result:
  Added test case
mysql-test/t/status2.test:
  Added test case
sql/mysqld.cc:
  Introduced a new status variable 'questions' to replace the query_id
  variable which currently corresponds badly with the number of statements
  sent by the client.
sql/sql_class.h:
  Introduced a new status variable 'questions' to replace the query_id
  variable which currently corresponds badly with the number of statements
  sent by the client.
sql/sql_parse.cc:
  To be backward compatible with 4.0 and at the same time extend the 
  interpretation of the Question variable, it should be increased on
  all COM-commands but COM_STATISTICS, COM_PING, COM_STMT_PREPARE,
  COM_STMT_CLOSE and COM_STMT_RESET.
  Since COM_QUERY can process multiple statements, there has to be an
  extra increase there as well.
sql/sql_show.cc:
  Removed deprecated SHOW_QUESTION status code.
sql/structs.h:
  Removed deprecated SHOW_QUESTION status code.
2008-10-09 09:26:42 +02:00
Georgi Kodinov
c3296418e1 fixed a compile warning in 5.1-5.1.29-rc 2008-10-08 18:25:24 +03:00
Georgi Kodinov
b0d9eb1648 fixed a compilation problem in 5.1-5.1.29-rc 2008-10-08 18:04:36 +03:00
Ramil Kalimullin
a720bdf0ae Fix for bug#39585: innodb and myisam corruption after binary
upgrade from <=5.0.46 to >=5.0.48

Problem: 'check table .. for upgrade' doesn't detect 
incompatible collation changes made in 5.0.48.

Fix: check for incompatible collation changes.


sql/handler.cc:
  Fix for bug#39585: innodb and myisam corruption after binary 
  upgrade from <=5.0.46 to >=5.0.48
    - check for incompatible collation changes made in 5.0.48:
  bug #29461
    latin7_general_ci
    latin7_general_cs
    latin7_estonian_cs
    latin2_hungarian_ci
    koi8u_general_ci
    cp1251_ukrainian_ci
    cp1250_general_ci
  bug #29499, bug #27562
    ascii_general_ci
2008-10-08 18:52:57 +05:00
Georgi Kodinov
835cbfd348 merge 5.1-bugteam -> bug 32124 5.1 tree 2008-10-08 15:19:55 +03:00
Mats Kindahl
04c054048b Merging with 5.1-5.1.29-rc 2008-10-08 13:37:13 +02:00
Georgi Kodinov
6d54b0443a Bug #32124: crash if prepared statements refer to variables in the where clause
The code to get read the value of a system variable was extracting its value 
on PREPARE stage and was substituting the value (as a constant) into the parse tree.
Note that this must be a reversible transformation, i.e. it must be reversed before
each re-execution.
Unfortunately this cannot be reliably done using the current code, because there are
other non-reversible source tree transformations that can interfere with this
reversible transformation.
Fixed by not resolving the value at PREPARE, but at EXECUTE (as the rest of the 
functions operate). Added a cache of the value (so that it's constant throughout
the execution of the query). Note that the cache also caches NULL values.
Updated an obsolete related test suite (variables-big) and the code to test the 
result type of system variables (as per bug 74).

mysql-test/extra/rpl_tests/rpl_insert_id.test:
  Bug #32124: removed ambiguous testcase
mysql-test/r/innodb_data_home_dir_basic.result:
  Bug #32124: fixed wrong test case
mysql-test/r/innodb_flush_method_basic.result:
  Bug #32124: fixed wrong test case
mysql-test/r/ps_11bugs.result:
  Bug #32124: test case
mysql-test/r/ssl_capath_basic.result:
  Bug #32124: fixed wrong test case
mysql-test/r/ssl_cipher_basic.result:
  Bug #32124: fixed wrong test case
mysql-test/r/variables.result:
  Bug #32124: system vars are shown as such in EXPLAIN EXTENDED, not as constants.
mysql-test/suite/rpl/r/rpl_insert_id.result:
  Bug #32124: removed ambiguous testcase
mysql-test/t/ps_11bugs.test:
  Bug #32124: test case
sql/item.cc:
  Bug #32124: placed the code to convert string to longlong or double 
  to a function (so that it can be reused)
sql/item.h:
  Bug #32124: placed the code to convert string to longlong or double 
  to a function (so that it can be reused)
sql/item_func.cc:
  Bug #32124: moved the evaluation of system variables at runtime (val_xxx).
sql/item_func.h:
  Bug #32124: moved the evaluation of system variables at runtime (val_xxx).
sql/set_var.cc:
  Bug #32124: removed the code that calculated the system variable's value 
  at PREPARE
sql/set_var.h:
  Bug #32124: removed the code that calculated the system variable's value 
  at PREPARE
tests/mysql_client_test.c:
  Bug #32124 : removed the reading of the system variable, because its max
  length is depended on the system charset and client charset and can't be
  easily calculated.
2008-10-08 14:23:53 +03:00
Georgi Kodinov
e8448851e2 merged 5.1-5.1.29-rc -> 5.1-bugteam 2008-10-08 12:20:29 +03:00
Mats Kindahl
dcd050c550 Bug #34707: Row based replication: slave creates table within wrong database
The failure was caused by executing a CREATE-SELECT statement that creates a
table in another database than the current one. In row-based logging, the
CREATE statement was written to the binary log without the database, hence
creating the table in the wrong database, causing the following inserts to
fail since the table didn't exist in the given database.

Fixed the bug by adding a parameter to store_create_info() that will make
the function print the database name before the table name and used that
in the calls that write the CREATE statement to the binary log. The database
name is only printed if it is different than the currently selected database.

The output of SHOW CREATE TABLE has not changed and is still printed without
the database name.

mysql-test/suite/rpl/t/rpl_row_create_table.test:
  Added test to check that CREATE-SELECT into another database than the
  current one replicates.
sql/sql_insert.cc:
  Adding parameter to calls to store_create_info().
sql/sql_show.cc:
  Adding parameter to calls to store_create_info().
  
  Extending store_create_info() with parameter 'show_database' that will cause
  the database to be written before the table name.
sql/sql_show.h:
  Adding parameter to call to store_create_info() to tell if the database should be shown or not.
sql/sql_table.cc:
  Adding parameter to calls to store_create_info().
2008-10-08 11:15:00 +02:00
Georgi Kodinov
e7105c1ac0 merged 5.1-5.1.29-rc -> 5.1-bugteam 2008-10-08 11:46:25 +03:00
Georgi Kodinov
7b628ade5f merged 5.0-5.1.29-rc -> 5.0-bugteam 2008-10-08 11:36:24 +03:00
Mattias Jonsson
9e71cd43f0 Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table

This is a pre fix update that does the change to the handler api.

This is done since there are already changes in this version,
so the real fix does not need to change the api.

sql/handler.h:
  Bug#37453: Dropping/creating index on partitioned table with
  InnoDB Plugin locks table
  
  The check for which alter table flags a handler have is done through the
  handlerton, which will not work correctly for any partitioned table.
  It must be through the handler interface.
  
  To be able to fix this I have to add a virtual function to the handler class.
2008-10-08 09:46:30 +02:00
Marc Alff
9846ab0a70 Merge 5.1-bugteam -> local bugfix branch 2008-10-07 20:19:32 -06:00
Marc Alff
3d51451143 coding style 2008-10-07 16:14:58 -06:00
Gleb Shchepa
39996b44cc manual merge 5.0-5.1.29-rc --> 5.1-5.1.29-rc 2008-10-08 02:52:49 +05:00
Gleb Shchepa
f48b42e776 Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''

Concurrent execution of 1) multitable update with a
NATURAL/USING join and 2) a such query as "FLUSH TABLES
WITH READ LOCK" or "ALTER TABLE" of updating table led
to a server crash.


The mysql_multi_update_prepare() function call is optimized
to lock updating tables only, so it postpones locking to
the last, and if locking fails, it does cleanup of modified
syntax structures and repeats a query analysis.  However,
that cleanup procedure was incomplete for NATURAL/USING join
syntax data: 1) some Field_item items pointed into freed
table structures, and 2) the TABLE_LIST::join_columns fields
was not reset.

Major change:
  short-living Field *Natural_join_column::table_field has
  been replaced with long-living Item*.


mysql-test/r/lock_multi.result:
  Added test case for bug #38691.
mysql-test/t/lock_multi.test:
  Added test case for bug #38691.
sql/item.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  The Item_field constructor has been modified to allocate
  and copy original database/table/field names always (not
  during PS preparation/1st execution only), because
  an initialization of Item_field items with a pointer to
  short-living Field structures is a common practice.
sql/sql_base.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  1) Type adjustment for Natural_join_column::table_field
     (Field to Item_field);
  2) The setup_natural_join_row_types function has been
     updated to take into account new
     first_natural_join_processing flag to skip unnecessary
     reinitialization of Natural_join_column::join_columns
     during table reopening after lock_tables() failure
     (like the 'first_execution' flag for PS).
sql/sql_lex.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  Initialization of the new
  st_select_lex::first_natural_join_processing flag has
  been added.
sql/sql_lex.h:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  The st_select_lex::first_natural_join_processing flag
  has been added to skip unnecessary rebuilding of
  NATURAL/USING JOIN structures during table reopening
  after lock_tables failure.
sql/sql_update.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  Extra cleanup calls have been added to reset
  Natural_join_column::table_field items.
sql/table.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  Type adjustment for Natural_join_column::table_field
  (Field to Item_field).
sql/table.h:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  Type of the Natural_join_column::table_field field has
  been changed from Field that points into short-living
  TABLE memory to long-living Item_field that can be
  linked to (fixed) reopened table.
2008-10-08 02:34:00 +05:00
Kristofer Pettersson
32f151cdab Bug#38066 Events log 'note' level messages by default in the error log
The event scheduler logged start-, stop-execution messages in the error log
on lowest log-warning level which would lead to very large log files in 
a short time.
    
This patch changes this behavior so that no start-/stop-messages are logged.
Log messages stating successful execution are also removed.


sql/event_scheduler.cc:
  * Removed logging for start-/stop-events.
  * Removed log-messages stating successful execution of events.
2008-10-07 19:20:13 +02:00
Gleb Shchepa
5898c53c54 manual merge 5.0-5.1.29-rc --> 5.1-5.1.29-rc 2008-10-07 21:30:36 +05:00
Georgi Kodinov
5a3086221d merged 5.0-5.1.29-rc -> 5.0-bugteam 2008-10-07 18:24:25 +03:00
Georgi Kodinov
7831b221e0 merged 5.1-5.1.29-rc -> 5.1-bugteam 2008-10-07 18:19:32 +03:00
Ramil Kalimullin
b4c5cafeb0 Fix for bug#38269: pushbuild gives valgrind error in
ha_statistic_increment for rpl_temporary

Problem: in some cases master send a special event to reconnecting
slave to keep slave's temporary tables (see #17284) and they still 
have references to the "old" SQL slave thread and use them to access
thread's data.

Fix: set temporary tables thread references to the actual SQL slave
thread in such cases.


mysql-test/suite/rpl/t/disabled.def:
  Fix for bug#38269: pushbuild gives valgrind error in 
  ha_statistic_increment for rpl_temporary
    - rpl_temporary test enabled.
sql/log_event.cc:
  Fix for bug#38269: pushbuild gives valgrind error in 
  ha_statistic_increment for rpl_temporary
    - if we keep slave's temporary tables after reconnect,
  set their thread pointers (->in_use) to the current SQL thread.
2008-10-07 18:21:17 +05:00
Georgi Kodinov
27de09facf merged 5.1-5.1.29-rc -> bug 39812 2008-10-07 12:50:57 +03:00
Kristofer Pettersson
85ca983736 Bug#38692 concurrent inserts cause valgrind errors in Query_cache::invalidate
Concurrent inserts produce valgrind error messages.
The reason is that the query cache is invalidated after the target table object
is closed.

Since the delayed insert thread already takes care of invalidating the query
cache there is no need to try to synchronize an extra cache invalidation call.

The fix is to remove the query_cache_invalidate3 call altogether.

sql/sql_insert.cc:
  When end_delayed_insert is called, the table_list items will be invalidated
  by the concurrent insert thread. Further more there is no need to call
  query_cache_invalidate here since the delayed insert thread takes care of
  this already.
2008-10-07 11:48:27 +02:00
Tatiana A. Nurnberg
f1e7181d73 auto-merge 2008-10-07 11:22:56 +02:00
Tatiana A. Nurnberg
4e78bab458 auto-merge 2008-10-07 10:53:00 +02:00
Georgi Kodinov
648920ccee merged 5.1-5.1.29-rc -> bug 38912 2008-10-07 11:24:52 +03:00
Marc Alff
ff4fde18c4 Bug#36768 (partition_info::check_partition_info() reports mal formed
warnings)

Before this fix, several places in the code would raise a warning with an
error code 0, making it impossible for a stored procedure, a connector,
or a client application to trigger logic to handle the warning.
Also, the warning text was hard coded, and therefore not translated.

With this fix, new errors numbers have been created to represent these
warnings, and the warning text is coded in the errmsg.txt file.
2008-10-06 14:36:15 -06:00
Guilhem Bichot
ba3b4ccd59 merge 2008-10-06 19:11:02 +02:00
Tatiana A. Nurnberg
980f04e0c6 WL#4403 deprecate @log and @slow_log_queries variables
Adds --general-log-file, --slow-query-log-file command-
line options to match system variables of the same names.

Deprecates --log, --log-slow-queries command-line option
and log, log_slow_queries system-variables for v7.0; they
are superseded by general_log/general_log_file and
slow_query_log/slow_query_log_file, respectively.

mysql-test/r/log_basic.result:
  Change deprecated system variable "log" to
  general log.
mysql-test/r/log_bin_trust_routine_creators_basic.result:
  Change deprecation warning so it's more obvious we're referring
  to a variable.
mysql-test/r/log_state.result:
  Show that all log-related server variables that
  should throw deprecation warnings do, and the
  others don't.
mysql-test/r/warnings.result:
  Change deprecation warning so it's more obvious we're referring
  to a variable.
mysql-test/suite/rpl/r/rpl_sp.result:
  Change deprecation warning so it's more obvious we're referring
  to a variable.
mysql-test/t/log_basic.test:
  Change deprecated system variable "log" to
  general log.
mysql-test/t/log_state.test:
  Show that all log-related server variables that
  should throw deprecation warnings do, and the
  others don't.
sql/mysqld.cc:
  Add command-line options --general-log-file and
  --slow-query-log-file to match server options of
  the same name.
  
  Deprecated --log and --log-slow-queries command-line
  options; they are superseded by --general-log/
  --general-log-file and --slow-query-log/--slow-query-log-file,
  respectively
sql/set_var.cc:
  Deprecate system-variables log in favour of general_log,
  log_slow_queries in favour of slow_query_log for 7.0,
  both for value- and DEFAULT-setting.
2008-10-06 16:22:07 +02:00
Georgi Kodinov
89d2b8efb9 Bug#34773: query with explain extended and derived table / other table
crashes server

When creating temporary table that contains aggregate functions a 
non-reversible source transformation was performed to redirect aggregate
function arguments towards temporary table columns.
This caused EXPLAIN EXTENDED to fail because it was trying to resolve
references to the (freed) temporary table.
Fixed by preserving the original aggregate function arguments and
using them (instead of the transformed ones) for EXPLAIN EXTENDED.

mysql-test/r/explain.result:
  Bug#34773: test case
mysql-test/t/explain.test:
  Bug#34773: test case
sql/item.cc:
  Bug#34773: use accessor functions instead of public members
sql/item_sum.cc:
  Bug#34773: 
   - Encapsulate the arguments into Item_sum and
     provide accessor and mutator methods 
   - print the orginal arguments (if present)
     in EXPLAIN EXTENDED
   - preserve the original arguments list.
sql/item_sum.h:
  Bug#34773: 
   - Encapsulate the arguments into Item_sum and
     provide accessor and mutator methods 
   - print the orginal arguments (if present)
     in EXPLAIN EXTENDED
   - preserve the original arguments list.
sql/opt_range.cc:
  Bug#34773: use accessor functions instead of public members
sql/opt_sum.cc:
  Bug#34773: use accessor functions instead of public members
sql/sql_select.cc:
  Bug#34773: use accessor functions instead of public members
2008-10-06 17:17:25 +03:00
Guilhem Bichot
84c1fffabb Fix for BUG#31612
"Trigger fired multiple times leads to gaps in auto_increment sequence".
The bug was that if a trigger fired multiple times inside a top
statement (for example top-statement is a multi-row INSERT,
and trigger is ON INSERT), and that trigger inserted into an auto_increment
column, then gaps could be observed in the auto_increment sequence,
even if there were no other users of the database (no concurrency).
It was wrong usage of THD::auto_inc_intervals_in_cur_stmt_for_binlog.
Note that the fix changes "class handler", I'll tell the Storage Engine API team.

mysql-test/r/trigger-trans.result:
  result; before the bugfix, the sequence was 1,2,4,6,8,10,12...
mysql-test/t/trigger-trans.test:
  test for BUG#31612
sql/handler.cc:
  See revision comment of handler.h.
  As THD::auto_inc_intervals_in_cur_stmt_for_binlog is cumulative
  over all trigger invokations by the top statement, the
  second invokation of the trigger arrived in handler::update_auto_increment()
  with already one interval in
  THD::auto_inc_intervals_in_cur_stmt_for_binlog. The method thus
  believed it had already reserved one interval for that invokation,
  thus reserved a twice larger interval (heuristic when we don't know
  how large the interval should be: we grow by powers of two). InnoDB
  thus increased its internal per-table auto_increment counter by 2
  while only one row was to be inserted. Hence a gap in the sequence.
  The fix is to use the new handler::auto_inc_intervals_count.
  Note that the trigger's statement knows how many rows it is going
  to insert, but provides estimation_rows_to_insert == 0 (see comments
  in sql_insert.cc why triggers don't call handler::ha_start_bulk_insert()).
  * removing white space at end of line
  * we don't need to maintain THD::auto_inc_intervals_in_cur_stmt_for_binlog
  if no binlogging or if row-based binlogging. Using auto_inc_intervals_count in
  the heuristic makes the heuristic independent of binary logging, which is good.
sql/handler.h:
  THD::auto_inc_intervals_in_cur_stmt_for_binlog served
   - for binlogging
   - as a heuristic when we have no estimation of how many records the
     statement will insert.
  But the first goal needs to be cumulative over all statements which
  form a binlog event, while the second one needs to be attached to each
  statement. THD::auto_inc_intervals_in_cur_stmt_for_binlog is cumulative,
  leading to BUG#31612. So we introduce handler::auto_inc_intervals_count
  for the second goal. See the revision comment of handler.cc.
  A smaller issue was that, even when the binlog event was only one
  statement (no triggers, no stored functions),
  THD::auto_inc_intervals_in_cur_stmt.nb_elements() could be lower than
  the number of reserved intervals (fooling the heuristic), because its
  append() method collapses two contiguous intervals in one.
  Note that as auto_inc_intervals_count is in class 'handler' and not
  in class 'THD', it does not need to be handled in
  THD::reset|restore_sub_statement_state().
sql/log.cc:
  Comment is wrong: if auto_increment is second, in handler::update_auto_increment()
  'append' is false and so auto_inc_intervals_in_cur_stmt_for_binlog
  is empty, we do not come here.
sql/sql_class.h:
  comment
2008-10-06 16:06:59 +02:00
Alexey Botchkov
449fe80fe6 keep compiler happy 2008-10-06 18:40:53 +05:00
Alexey Botchkov
afbb52c43c Bug#38005 Partitions: error with insert select.
MyISAM blocks index usage for bulk insert into zero-records tables.
See ha_myisam::start_bulk_insert() lines from
...
    if (file->state->records == 0 ...
...

That causes problems for partition engine when some partitions have records some not
as the engine uses same access method for all partitions.

Now partition engine doesn't call index_first/index_last
for empty tables.

per-file comments:
  mysql-test/r/partition.result
        Bug#38005 Partitions: error with insert select.
        test result

  mysql-test/t/partition.test
        Bug#38005 Partitions: error with insert select.
        test case

  sql/ha_partition.cc
        Bug#38005 Partitions: error with insert select.
        ha_engine::index_first and
        ha_engine::index_last not called for empty tables.
2008-10-06 18:14:20 +05:00
Alexey Botchkov
a66e58daee Bug#38083 Error-causing row inserted into partitioned table despite error 2008-10-06 17:22:38 +05:00
Tatiana A. Nurnberg
07953513ed WL#4403 deprecate @log and @slow_log_queries variables
Adds --general_log_file, --slow_query_log_file command-
line options to match system variables of the same names.

Deprecates --log, --log-slow-queries command-line options
and log, log_slow_queries system-variables for v7.0; they
are superseded by general_log/general_log_file and
slow_query_log/slow_query_log_file, respectively.

mysql-test/r/log_basic.result:
  Change deprecated system variable "log" to
  general log.
mysql-test/r/log_state.result:
  Show that all log-related server variables that
  should throw deprecation warnings do, and the
  others don't.
mysql-test/t/log_basic.test:
  Change deprecated system variable "log" to
  general log.
mysql-test/t/log_state.test:
  Show that all log-related server variables that
  should throw deprecation warnings do, and the
  others don't.
sql/mysqld.cc:
  Add command-line options --general_log_file and
  --slow_query_log_file to match server options of
  the same name.
  
  Deprecated --log and --log-slow-queries command-line
  options; they are superseded by --general-log/
  --general-log-file and --slow-query-log/--slow-query-log-file,
  respectively
sql/set_var.cc:
  Deprecate system-variables log in favour of general_log,
  log_slow_queries in favour of slow_query_log for 7.0,
  both for value- and DEFAULT-setting.
2008-10-06 11:29:42 +02:00
Mats Kindahl
bcaf5e0cf5 Merging 5.1 main into 5.1-rpl. 2008-10-06 10:27:36 +02:00
Alexey Botchkov
87a77eecac Bug#38083 Error-causing row inserted into partitioned table despite error
problems are located in the sql_partition.cc where functions calculation
    partition_id don't expect error returned from item->val_int().
    Fixed by adding checks to these functions.
    Note  - it tries to fix more problems than just the reported bug.
      
per-file comments:
modified:
  mysql-test/r/partition.result
    Bug#38083 Error-causing row inserted into partitioned table despite error
        test result
  mysql-test/t/partition.test
    Bug#38083 Error-causing row inserted into partitioned table despite error
        test case
  sql/opt_range.cc
    Bug#38083 Error-causing row inserted into partitioned table despite error
        get_part_id() call fixed
  sql/partition_info.h
    Bug#38083 Error-causing row inserted into partitioned table despite error
        get_subpart_id_func interface changed. 
  sql/sql_partition.cc
    Bug#38083 Error-causing row inserted into partitioned table despite error
        various functions calculationg partition_id and subpart_id didn't expect
            an error returned from item->val_int().  Error checks added.
2008-10-06 11:05:34 +05:00
Mattias Jonsson
65811a336d Bug#37453: Dropping/creating index on partitioned table with
InnoDB Plugin locks table

The fast/on-line add/drop index handler calls was not implemented
whithin the partitioning.

This implements it in the partitioning handler.

Since this is only used by the not included InnoDB plugin, there
is no test case. (Have tested it manually with the plugin, and
it does not allow unique indexes not including partitioning
function, or removal of pk, which in innodb generates a new pk,
which is not in the partitioning function.)

NOTE: This introduces a new handler method, and because of that
changes the storage engine api. (One cannot use a handlerton to
see the capabilities of a table's handler if it is partitioned.
So I added a wrapper function in the handler that defaults to
the handlerton function, which the partitioning handler overrides.

sql/ha_partition.cc:
  Bug#37453: Dropping/creating index on partitioned table with
  InnoDB Plugin locks table
  
  Added support for fast/on-line add/drop index.
  Implemented alter_table_flags as bit-or of the partitioned
  hton and the first partitions alter_table_flags.
  
  It is only to forward the calls for the other functions:
  check_if_incompatible_data
  add_index
  prepare_drop_index
  final_drop_index
  
  to all parts handler
sql/ha_partition.h:
  Bug#37453: Dropping/creating index on partitioned table with
  InnoDB Plugin locks table
  
  Added support for fast/on-line add/drop index.
sql/handler.h:
  Bug#37453: Dropping/creating index on partitioned table with
  InnoDB Plugin locks table
  
  Added the function on handler level, defaulting to use
  the handlerton function, but a handler can override it.
  Needed for partitioned tables.
  
  NOTE: Change of storage engine api.
sql/sql_partition.cc:
  Bug#37453: Dropping/creating index on partitioned table with
  InnoDB Plugin locks table
  
  Using the new handler function, instead of the handlerton
  function. This works better with the partitioning handler.
sql/sql_table.cc:
  Bug#37453: Dropping/creating index on partitioned table with
  InnoDB Plugin locks table
  
  Using the new handler function, instead of the handlerton
  function. This works better with the partitioning handler.
  Also using new process info for 'manage keys' (kind of fix
  for bug-37550).
2008-10-05 00:40:30 +02:00
Mattias Jonsson
eb656b2164 merge 2008-10-03 14:38:16 +02:00
Georgi Kodinov
19256b96e8 Bug #39812: Make statement replication default for 5.1 (to match 5.0)
Make STMT replication default for 5.1.
Add a default of MIXED into the config files
Fix the tests that needed MIXED replication mode.

mysql-test/include/mix1.inc:
  Bug #39812: Fix the tests that needed MIXED replication mode.
mysql-test/r/innodb-semi-consistent.result:
  Bug #39812: Fix the tests that needed MIXED replication mode.
mysql-test/r/innodb.result:
  Bug #39812: Fix the tests that needed MIXED replication mode.
mysql-test/r/innodb_mysql.result:
  Bug #39812: Fix the tests that needed MIXED replication mode.
mysql-test/r/tx_isolation_func.result:
  Bug #39812: Fix the tests that needed MIXED replication mode.
mysql-test/t/innodb-semi-consistent.test:
  Bug #39812: Fix the tests that needed MIXED replication mode.
mysql-test/t/innodb.test:
  Bug #39812: Fix the tests that needed MIXED replication mode.
mysql-test/t/tx_isolation_func.test:
  Bug #39812: Fix the tests that needed MIXED replication mode.
sql/mysqld.cc:
  Bug #39812: Make STMT replication default for 5.1.
support-files/my-huge.cnf.sh:
  Bug #39812: Add a default of MIXED into the config files
support-files/my-innodb-heavy-4G.cnf.sh:
  Bug #39812: Add a default of MIXED into the config files
support-files/my-large.cnf.sh:
  Bug #39812: Add a default of MIXED into the config files
support-files/my-medium.cnf.sh:
  Bug #39812: Add a default of MIXED into the config files
support-files/my-small.cnf.sh:
  Bug #39812: Add a default of MIXED into the config files
2008-10-03 15:24:19 +03:00
Davi Arnaut
b0e03c1311 Wrap function used for debugging with the DBUG_OFF condition.
Function uses a variable only available under debug mode.
2008-10-03 08:16:58 -03:00
Georgi Kodinov
2ab558dec6 Bug #38370: The test ndb.ndb_index_ordered fails with the community features on
The problem was caused by a wrong merge. Fixed by enabling the correct ndb variables
initialization.

mysql-test/suite/ndb/t/disabled.def:
  Bug #38370: remove disabled test case
sql/mysqld.cc:
  Bug #38370: corrected a wrong merge to have all the NDB variables intiialized
  correctly
2008-10-03 13:10:09 +03:00
Georgi Kodinov
e7763d5d98 merged 5.1.29-rc 2008-10-03 12:54:53 +03:00
Mattias Jonsson
51cb9ac0e1 post push fix for bug#38804 (back port of bug#33479)
Removes the regression bug#38751.

sql/ha_partition.cc:
  post push fix for bug#38804 (back port of bug#33479)
  Removes the regression bug#38751.
  
  archive relies on a ha_archive::info call to flush data before
  the copy takes place in alter table.
  
  This ensures that all partitions gets a info call, without having
  to always forward info(HA_STATUS_AUTO) to all partitions.
2008-10-03 11:30:54 +02:00
Mats Kindahl
f2a7af7b5f Merging with 5.1-5.1.29-rc. 2008-10-03 09:36:22 +02:00
Davi Arnaut
6cf143a2af Merge from main branch. 2008-10-02 16:23:40 -03:00
Davi Arnaut
5b1afb9b9a Remove usage of the _db_strict_keyword_ in favor of the more reliable
DBUG_EXECUTE_IF macro. The usage of the former caused breakage in other
trees as it got removed from the dbug library.

sql/sql_base.cc:
  Rework code to remove unreliable usage of _db_script_keyword_.
2008-10-02 16:13:42 -03:00
Georgi Kodinov
a18639b634 Bug #37348: Crash in or immediately after JOIN::make_sum_func_list
The optimizer pulls up aggregate functions which should be aggregated in
an outer select. At some point it may substitute such a function for a field
in the temporary table. The setup_copy_fields function doesn't take this
into account and may overrun the copy_field buffer.
      
Fixed by filtering out the fields referenced through the specialized
reference for aggregates (Item_aggregate_ref).
Added an assertion to make sure bugs that cause similar discrepancy 
don't go undetected.

mysql-test/r/func_group.result:
  Bug #37348: test case
mysql-test/t/func_group.test:
  Bug #37348: test case
sql/item.cc:
  Bug #37348: Added a way to distinguish Item_aggregate_ref from the other types of refs
sql/item.h:
  Bug #37348: Added a way to distinguish Item_aggregate_ref from the other types of refs
sql/sql_select.cc:
  Bug #37348: 
   - Don't consider copying field references
      seen through Item_aggregate_ref
   - check for discrepancies between the number of expected 
     fields that need copying and the actual fields copied.
2008-10-02 17:44:49 +03:00
Sergey Glukhov
46087eaf25 5.0->5.1 bugteam merge
mysql-test/r/create.result:
  automerge
mysql-test/t/create.test:
  automerge
sql/mysql_priv.h:
  manual merge
sql/sql_parse.cc:
  manual merge
sql/sql_yacc.yy:
  manual merge
2008-10-02 17:53:08 +05:00
Sergey Glukhov
d51e2c0760 Bug#35924 DEFINER should be stored 'quoted' in I_S
The '@' symbol can not be used in the host name according to rfc952.
The fix:
added function check_host_name(LEX_STRING *str)
which checks that all symbols in host name string are valid and
host name length is not more than max host name length
(just moved check_string_length() function from the parser into check_host_name()).


mysql-test/r/create.result:
  test result
mysql-test/t/create.test:
  test case
sql/mysql_priv.h:
  added function check_host_name(LEX_STRING *str)
sql/sql_parse.cc:
  added function check_host_name(LEX_STRING *str)
  which checks that all symbols in host name string are valid and
  host name length is not more than max host name length(HOSTNAME_LENGTH).
sql/sql_yacc.yy:
  using newly added function check_host_name()
2008-10-02 16:57:52 +05:00
Sergey Glukhov
aff5670aca automerge 2008-10-02 16:22:24 +05:00
Sergey Glukhov
4735aaea70 automerge 2008-10-02 15:08:15 +05:00
Sergey Glukhov
7e60f71001 Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS
The problem:
I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL
privileges for a view. It leads to discrepancy between SHOW CREATE VIEW
and I_S.VIEWS.
The fix:
added appropriate check.


mysql-test/r/information_schema_db.result:
  test result
mysql-test/t/information_schema_db.test:
  test case
sql/sql_show.cc:
  The problem:
  I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL
  privileges for a view. It leads to discrepancy between SHOW CREATE VIEW
  and I_S.VIEWS.
  The fix:
  added appropriate check.
2008-10-02 14:37:07 +05:00
Mats Kindahl
8d9cf89e96 Bug #38360: BLACKHOLE replication with RBR is broken
The Blackhole engine did not support row-based replication
since the delete_row(), update_row(), and the index and range
searching functions were not implemented.

This patch adds row-based replication support for the
Blackhole engine by implementing the two functions mentioned
above, and making the engine pretend that it has found the
correct row to delete or update when executed from the slave
SQL thread by implementing index and range searching functions.

It is necessary to only pretend this for the SQL thread, since
a SELECT executed on the Blackhole engine will otherwise never
return EOF, causing a livelock.


mysql-test/extra/binlog_tests/blackhole.test:
  Blackhole now handles row-based replication.
mysql-test/extra/rpl_tests/rpl_blackhole.test:
  Test helper file for testing that blackhole actually
  writes something to the binary log on the slave.
mysql-test/suite/binlog/t/binlog_multi_engine.test:
  Replication now handles row-based replcation.
mysql-test/suite/rpl/t/rpl_blackhole.test:
  Test that Blackhole works with primary key, index, or none.
sql/log_event.cc:
  Correcting code to only touch filler bits and leave
  all other bits alone. It is necessary since there is
  no guarantee that the engine will be able to fill in
  the bits correctly (e.g., the blackhole engine).
storage/blackhole/ha_blackhole.cc:
  Adding definitions for update_row() and delete_row() to return OK
  when executed from the slave SQL thread with thd->query == NULL
  (indicating that row-based replication events are being processed).
  
  Changing rnd_next(), index_read(), index_read_idx(), and
  index_read_last() to return OK when executed from the slave SQL
  thread (faking that the row has been found so that processing
  proceeds to update/delete the row).
storage/blackhole/ha_blackhole.h:
  Enabling row capabilities for engine.
  Defining write_row(), update_row(), and delete_row().
  Making write_row() private (as it should be).
2008-10-02 11:02:38 +02:00
Ramil Kalimullin
1ce81aac15 merge 2008-10-02 13:10:06 +05:00
Ramil Kalimullin
6037e8ec49 Merge 2008-10-02 10:56:07 +05:00
Sergei Golubchik
cf4aa88993 merged 2008-10-01 23:20:07 +02:00
Ingo Struewing
907cce4e4c merge 2008-10-01 19:25:37 +02:00
Georgi Kodinov
7adf7154f7 merge of bug #37943 5.0-bugteam -> 5.1-bugteam 2008-10-01 19:49:59 +03:00
Georgi Kodinov
eb3c08069d Bug#37943: Reproducible mysqld crash/sigsegv in sel_trees_can_be_ored
When analyzing the possible index use cases the server was re-using an internal structure.
This is wrong, as this internal structure gets updated during the analysis.
Fixed by making a copy of the internal structure for every place it needs to be used.
Also stopped the generation of empty SEL_TREE structures that unnecessary 
complicate the analysis.

mysql-test/r/index_merge.result:
  Bug#37943: test case
mysql-test/t/index_merge.test:
  Bug#37943: test case
sql/opt_range.cc:
  Bug#37943: 
   - Make copy constructors for SEL_TREE and sub-structures and use them when OR-ing trees.
   - don't generate empty SEL_TREEs. Return NULL instead.
2008-10-01 18:50:55 +03:00
Georgi Kodinov
71e061db68 merged 5.1-5.1.29 -> 5.1-bugteam 2008-10-01 17:48:38 +03:00
Mattias Jonsson
20cf5c16b9 merge 2008-10-01 15:21:55 +02:00
Davi Arnaut
a8ab9ce2d4 Bug#35164: Large number of invalid pthread_attr_setschedparam calls
Bug#37536: Thread scheduling causes performance degradation at low thread count

Deprecated --skip-thread-priority startup option as newer versions of
the server won't change the thread priorities by default.

Giving threads different priorities might yield marginal improvements
in some platforms (where it actually works) but on the other hand it
might cause significant degradation depending on the thread count and
number of processors. Meddling with the thread priorities is a not a
safe bet as it is very dependent on the behavior of the cpu scheduler
and system where MySQL is being run.

From MySQL 6.0 and up the default behavior is that of not modifying
the threads priorities.

sql/mysqld.cc:
  Deprecate --skip-thread-priority
2008-10-01 09:24:35 -03:00
Mattias Jonsson
3a2727f74f pre push fix for bug#38804
sql/ha_partition.cc:
  pre push fix for bug#38804
  Found a missing 'if' for releasing the mutex
2008-10-01 12:40:05 +02:00
Ingo Struewing
78a4a9e410 merge 2008-10-01 12:27:57 +02:00
Ingo Struewing
2ed99fbe1c Bug#37958 - test main.plugin crash on Mac OS X when selecting from EXAMPLE engine.
This patch contains fixes for two problems:

1. As originally reported, the server crashed on Mac OS X when trying to access
   an EXAMPLE table after the EXAMPLE plugin was installed.

   It turned out that the dynamically loaded EXAMPLE plugin called the
   function hash_earch() from a Mac OS X system library, instead of
   hash_earch() from MySQL's mysys library. Makefile.am in storage/example
   does not include libmysys. So the Mac OS X linker arranged the hash_search()
   function to be linked to the system library when the shared object is
   loaded.

   One possible solution would be to include libmysys into the linkage of
   dynamic plugins. But then we must have a libmysys.so, which must be
   used by the server too. This could have a minimal performance impact,
   but foremost the change seems to bee too risky at the current state of
   MySQL 5.1.

   The selected solution is to rename MySQL's hash_search() to my_hash_search()
   like it has been done before with hash_insert() and hash_reset().

   Since this is the third time, we need to rename a hash_*() function,
   I did renamed all hash_*() functions to my_hash_*().

   To avoid changing a zillion calls to these functions, and announcing
   this to hundreds of developers, I added defines that map the old names
   to the new names.

   This change is in hash.h and hash.c.

2. The other problem was improper implementation of the handlerton-to-plugin
   mapping. We use a fixed-size array to hold a plugin reference for each
   handlerton. On every install of a handler plugin, we allocated a new slot
   of the array. On uninstall we did not free it. After some uninstall/install
   cycles the array overflowed. We did not check for overflow.

   One fix is to check for overflow to stop the crashes.

   Another fix is to free the array slot at uninstall and search for a free slot
   at plugin install.

   This change is in handler.cc.



include/hash.h:
  Bug#37958 - test main.plugin crash on Mac OS X when selecting from EXAMPLE engine.
  Renamed hash_*() functions to my_hash_*().
  Added defines that map old names to new names.
mysys/hash.c:
  Bug#37958 - test main.plugin crash on Mac OS X when selecting from EXAMPLE engine.
  Renamed hash_*() functions to my_hash_*().
sql/handler.cc:
  Bug#37958 - test main.plugin crash on Mac OS X when selecting from EXAMPLE engine.
  Protect against a failing ha_initialize_handlerton() in ha_finalize_handlerton().
  Free hton2plugin slot on uninstall of a handler plugin.
  Reuse freed slost of the hton2plugin array.
  Protect against array overrun.
2008-10-01 12:21:15 +02:00
Mattias Jonsson
22e0319620 merge 2008-10-01 12:14:55 +02:00
Georgi Kodinov
5b1b7320b1 fixed a win32 warning caused by the fix for bug #35981 2008-10-01 13:12:08 +03:00
Ramil Kalimullin
d3e317d16b Fix for bug#39182: Binary log producing incompatible character set query
from stored procedure. 

Problem: we replace all references to local variables in stored procedures     
with NAME_CONST(name, value) logging to the binary log. However, if the
value's collation differs we might get an 'illegal mix of collation'           
error as we don't pass the collation to the function.

Fix: pass the value's collation to NAME_CONST().

Note: actually we should pass to NAME_CONST() the value's derivation as well.
It's impossible without the parser modifying. Now we always set the 
derivation to DERIVATION_IMPLICIT, the same as local variables have.


mysql-test/r/binlog.result:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - test result.
mysql-test/r/ctype_cp932_binlog.result:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - results adjusted.
mysql-test/r/rpl_sp.result:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - results adjusted.
mysql-test/t/binlog.test:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - test case.
sql/item.cc:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - allow NAME_CONST() to get _charset'foo' COLLATE 'bar' strings
  (see Item_func_set_collation).
sql/sp_head.cc:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure. 
    - pass the value's collation to NAME_CONST().
2008-10-01 14:48:47 +05:00
Georgi Kodinov
63a3ce6ef0 merged 5.1-5.1.29-rc -> 5.1-bugteam 2008-10-01 12:47:25 +03:00
Georgi Kodinov
dca2c113c6 merged 5.0-5.1.29-rc into 5.0-bugteam 2008-10-01 12:41:13 +03:00
Davi Arnaut
6816cf6a65 Bug#34306: Can't make copy of log tables when server binary log is enabled
Post-merge bug fix: lock_type is a enumeration type and not a bit mask.

sql/sql_cache.cc:
  Check for lock type explicitly. Also err on the safe side and
  invalidate the query cache for any write lock.
2008-09-30 10:47:01 -03:00
Gleb Shchepa
0d24398697 manual merge 5.0-bugteam --> 5.1-bugteam 2008-09-30 18:16:11 +05:00
Gleb Shchepa
3c9d4ea821 Fixed bug #17823: 'arc' directories inside database directories.
Server created "arc" directories inside database directories and
maintained there useless copies of .frm files.

Creation and renaming procedures of those copies as well as
creation of "arc" directories has been discontinued.
Removal procedure has been kept untouched to be able to
cleanup existent database directories by the DROP DATABASE
query. Also view renaming procedure has been updated to remove
these directories.


sql/parse_file.cc:
  Fixed bug #17823: 'arc' directories inside database directories.
  View/table creation and renaming procedures maintained
  backup copies of .frm files. Those copies are unused yet,
  so this feature was incomplete and unnecessary.
  
  1. Unwanted code has been hidden by FRM_ARCHIVE ifdefs
  (the FRM_ARCHIVE macro is not defined).
  
  2. Renaming procedure has been modified to remove obsolete
  "arc" directories.
sql/parse_file.h:
  Fixed bug #17823: 'arc' directories inside database directories.
  The "thd" parameter has been added to the rename_in_schema_file()
  function.
sql/sql_db.cc:
  Fixed bug #17823: 'arc' directories inside database directories.
  Scope of the mysql_rm_arc_files() function has been changed to
  global for use from the parse_file.cc file.
sql/sql_view.cc:
  Fixed bug #17823: 'arc' directories inside database directories.
  Added the "thd" argument to rename_in_schema_file() calls.
2008-09-30 17:50:28 +05:00
Alexey Botchkov
b8734a1ce2 merging 2008-09-30 10:41:30 +05:00
Davi Arnaut
2714b57bd3 Merge from parent branch. 2008-09-29 14:42:36 -03:00
Alexey Botchkov
ce64a16b75 Bug#37949 Crash if argument to SP is a subquery that returns more than one row
JOIN for the subselect wasn't cleaned if we came upon an error
     during sub_select() execution. That leads to the assertion failure
     in close_thread_tables()

     part of the 6.0 code backported

per-file comments:
  mysql-test/r/sp-error.result
Bug#37949 Crash if argument to SP is a subquery that returns more than one row 
    test result

  mysql-test/t/sp-error.test
Bug#37949 Crash if argument to SP is a subquery that returns more than one row 
    test case

  sql/sp_head.cc
Bug#37949 Crash if argument to SP is a subquery that returns more than one row 
    lex->unit.cleanup() call added if not substatement
2008-09-29 19:11:34 +05:00
Davi Arnaut
0406d409ea Bug#34306: Can't make copy of log tables when server binary log is enabled
The problem is that when statement-based replication was enabled,
statements such as INSERT INTO .. SELECT FROM .. and CREATE TABLE
.. SELECT FROM need to grab a read lock on the source table that
does not permit concurrent inserts, which would in turn be denied
if the source table is a log table because log tables can't be
locked exclusively.

The solution is to not take such a lock when the source table is
a log table as it is unsafe to replicate log tables under statement
based replication. Furthermore, the read lock that does not permits
concurrent inserts is now only taken if statement-based replication
is enabled and if the source table is not a log table.

include/thr_lock.h:
  Introduce yet another lock type that my get upgraded depending
  on the binary log format. This is not a optimal solution but
  can be easily improved later.
mysql-test/r/log_tables.result:
  Add test case result for Bug#34306
mysql-test/suite/binlog/r/binlog_stm_row.result:
  Add test case result for Bug#34306
mysql-test/suite/binlog/t/binlog_stm_row.test:
  Add test case for Bug#34306
mysql-test/t/log_tables.test:
  Add test case for Bug#34306
sql/lock.cc:
  Assert that TL_READ_DEFAULT is not a real lock type.
sql/mysql_priv.h:
  Export new function.
sql/mysqld.cc:
  Remove using_update_log.
sql/sql_base.cc:
  Introduce function that returns the appropriate read lock type
  depending on how the statement is going to be replicated. It will
  only take a TL_READ_NO_INSERT log if the binary is enabled and the
  binary log format is statement-based and the table is not a log table.
sql/sql_parse.cc:
  Remove using_update_log.
sql/sql_update.cc:
  Use new function to choose read lock type.
sql/sql_yacc.yy:
  The lock type is now decided at open_tables time. This old behavior was
  actually misleading as the binary log format can be dynamically switched
  and this would not change for statements that have already been parsed
  when the binary log format is changed (ie: prepared statements).
2008-09-29 10:53:40 -03:00
He Zhenxing
08399602a6 Auto Merge 2008-09-29 13:36:42 +08:00
He Zhenxing
bd35cfe22e BUG#38734 rpl_server_id2 sync_with_master failed
Rotate event is automatically generated and written when rotating binary
log or relay log. Rotate events for relay logs are usually ignored by slave
SQL thread becuase they have the same server id as that of the slave.
However, if --replicate-same-server-id is enabled, rotate event
for relay log would be treated as if it's a rotate event from master, and
would be executed by slave to update the rli->group_master_log_name and
rli->group_master_log_pos to a wrong value and cause the MASTER_POS_WAIT
function to fail and return NULL.

This patch fixed this problem by setting a flag bit (LOG_EVENT_RELAY_LOG_F)
in the event to tell the SQL thread to ignore these Rotate events generated
for relay logs.

This patch also added another binlog event flag bit (LOG_EVENT_ARTIFICIAL_F)
to distinquish faked events, the method used before this was by checking if
log_pos was zero.


sql/log.h:
  Add a member to MYSQL_BIN_LOG to distinguish binary log from relay log.
sql/log_event.cc:
  Change artificial_event member to LOG_EVENT_ARTIFICIAL_F flag
  
  If LOG_EVENT_RELAY_LOG_F is set in the event flags for a rotate event, ignore it when updating position
  
  Refactored the code in Rotate_log_event::do_update_pos
sql/log_event.h:
  Add LOG_EVENT_RELAY_LOG_F flag to Log_event flags
  Add RELAY_LOG flag to Rotate_log_event flags
sql/sql_repl.cc:
  Set LOG_EVENT_ARTIFICIAL_F for fake rotate events
2008-09-28 15:34:25 +08:00
Michael Widenius
2a9d33f07d Fixed for Bug #39248 Maria: INSERT ON DUPLICATE KEY UPDATE gives error if using a view
The bug was that prepared statements didn't downgrade TL_WRITE_CONCURRENT properly

mysql-test/r/maria.result:
  Added test case
mysql-test/t/maria.test:
  Added test case
sql/mysql_priv.h:
  Make upgrade_lock_type() global
sql/sql_base.cc:
  Fixed indentation
sql/sql_insert.cc:
  Make upgrade_lock_type() global
sql/sql_prepare.cc:
  Call upgrade_lock_type_for_insert() to get right lock to use
sql/sql_view.cc:
  Indentation fix
2008-09-26 16:49:51 +03:00
He Zhenxing
a2841cf1c1 BUG#35843 Slow replication slave when using partitioned myisam table
In order to improve the performance when replicating to partitioned
myisam tables with row-based format, the number of rows of current 
rows log event is estimated and used to setup storage engine for bulk
inserts.
2008-09-26 17:39:47 +08:00
Kristofer Pettersson
153e8e7c07 Merge 5.0-bugteam -> 5.1-bugteam 2008-09-20 16:52:34 +02:00
Kristofer Pettersson
119c5aaeba Automerge 2008-09-20 16:45:39 +02:00
Kristofer Pettersson
f0352e346a Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar
A stored procedure involving substrings could crash the server on certain
platforms because of invalid memory reads.
          
During storing the new blob-field value, the cached value's address range
overlapped that of the new field value. This caused problems when the 
cached value storage was reallocated to provide access for a new 
characater set representation. The patch checks the address ranges, and if
they overlap, the new field value is copied to a new storage before it is
converted to the new character set.


mysql-test/r/sp.result:
  Added result set
mysql-test/t/sp.test:
  Added test case
sql/field.cc:
  The source and destination address ranges of a character conversion must not overlap or the 'from' address will be invalidated as the temporary value-
  object is re-allocated to fit the new character set.
sql/field.h:
  Added comments
2008-09-20 10:51:03 +02:00
Mattias Jonsson
9fcdc6baea merge (update of local branch before push) 2008-09-20 09:53:23 +03:00
Georgi Kodinov
7be42c8619 merge of bug 39353 5.0-5.1.29-rc -> 5.1-5.1.29-rc 2008-09-19 15:34:37 +03:00
Mattias Jonsson
3e1d88d188 Bug#30573: Ordered range scan over partitioned tables returns some rows twice
and
Bug#33555: Group By Query does not correctly aggregate partitions

Backport of bug-33257 which is the same bug.

read_range_*() calls was not passed to the partition handlers,
but was translated to index_read/next family calls.
Resulting in duplicates rows and wrong aggregations.

mysql-test/r/partition_range.result:
  Bug#30573: Ordered range scan over partitioned tables returns some rows twice
  
  Updated result file
mysql-test/t/partition_range.test:
  Bug#30573: Ordered range scan over partitioned tables returns some rows twice
  
  Re-enabled the test
sql/ha_partition.cc:
  Bug#30573: Ordered range scan over partitioned tables returns some rows twice
  
  backport of bug-33257, correct handling of read_range_* calls,
  without converting them to index_read/next calls
sql/ha_partition.h:
  Bug#30573: Ordered range scan over partitioned tables returns some rows twice
  
  backport of bug-33257, correct handling of read_range_* calls,
  without converting them to index_read/next calls
2008-09-18 22:49:34 +03:00
Georgi Kodinov
71fe190172 Bug #39353: Multiple conditions on timestamp column crashes server
The fix for bug 31887 was incomplete : it assumes that all the 
field types returned by the IS_NUM macro are descendants of 
Item_num and tries to zero-fill the values before doing constant
substitution with such fields when they are compared to constant string
values.
The only exception to this is Field_timestamp : it's in the IS_NUM
macro, but is not a descendant of Field_num.
Fixed by excluding timestamp fields (Field_timestamp) when zero-filling
when converting the constant to compare with to a string.
Note that this will not exclude the timestamp columns from const 
propagation.

mysql-test/r/compare.result:
  Bug #39353: test case
mysql-test/t/compare.test:
  Bug #39353: test case
sql/item.cc:
  Bug #39353: don't zero-fill timestamp fields when const propagating
  to a string : they'll be converted to a string in a date/time format
  and not as an integer.
2008-09-18 15:55:36 +03:00
Gleb Shchepa
14ce62ffbb Post-push fix for bug #26020: User-Defined Variables are not consistence with columns data types.
--ps-protocol problem has been fixed.


sql/item_func.cc:
  Added update of Item_func_set_user_var::entry->update_query_id
  for every PS execution.
2008-09-18 17:24:09 +05:00
Gleb Shchepa
e9cb71fc3a Bug#26020: User-Defined Variables are not consistent with
columns data types

The "SELECT @lastId, @lastId := Id FROM t" query returns
different result sets depending on the type of the Id column
(INT or BIGINT).

Note: this fix doesn't cover the case when a select query
references an user variable and stored function that
updates a value of that variable, in this case a result
is indeterminate.


The server uses incorrect assumption about a constantness of
an user variable value as a select list item: 

The server caches a last query number where that variable
was changed and compares this number with a current query
number. If these numbers are different, the server guesses,
that the variable is not updating in the current query, so
a respective select list item is a constant. However, in some
common cases the server updates cached query number too late.


The server has been modified to memorize user variable
assignments during the parse phase to take them into account
on the next (query preparation) phase independently of the
order of user variable references/assignments in a select
item list.


mysql-test/r/user_var.result:
  Added test case for bug #26020.
mysql-test/t/user_var.test:
  Added test case for bug #26020.
sql/item_func.cc:
  An update of entry and update_query_id variables has been
  moved from Item_func_set_user_var::fix_fields() to a separate
  method, Item_func_set_user_var::set_entry().
sql/item_func.h:
  1. The Item_func_set_user_var::set_entry() method has been
  added to update Item_func_set_user_var::entry.
  
  2. The Item_func_set_user_var::entry_thd field has beend
  added to update Item_func_set_user_var::entry only when
  needed.
sql/sql_base.cc:
  Fix: setup_fiedls() calls Item_func_set_user_var::set_entry()
  for all items from the thd->lex->set_var_list before the first
  call of ::fix_fields().
sql/sql_lex.cc:
  The lex_start function has been modified to reset
  the st_lex::set_var_list list.
sql/sql_lex.h:
  New st_lex::set_var_list field has been added to
  memorize all user variable assignments in the current
  select query.
sql/sql_yacc.yy:
  The variable_aux rule has been modified to memorize
  in-query user variable assignments in the
  st_lex::set_var_list list.
2008-09-18 13:38:44 +05:00