Commit graph

11328 commits

Author SHA1 Message Date
unknown
071e55af0d Merge mysql.com:/home/hf/work/30286/my41-30286
into  mysql.com:/home/hf/work/30286/my50-30286


mysql-test/t/gis.test:
  Auto merged
sql/gstream.cc:
  Auto merged
mysql-test/r/gis.result:
  SCCS merged
2007-10-05 16:33:08 +05:00
unknown
77d786b5a0 Merge mysql.com:/home/hf/work/30955/my41-30955
into  mysql.com:/home/hf/work/30286/my41-30286
2007-10-05 16:32:05 +05:00
unknown
c14e8c80dd Merge bk@192.168.21.1:mysql-4.1-opt
into  mysql.com:/home/hf/work/30286/my41-30286
2007-10-05 15:48:42 +05:00
unknown
794ed298cf Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/30286/my50-30286
2007-10-05 15:47:55 +05:00
unknown
8e37481553 Merge mysql.com:/home/hf/work/30286/my41-30286
into  mysql.com:/home/hf/work/30286/my50-30286


myisam/rt_index.c:
  Auto merged
myisam/rt_mbr.c:
  Auto merged
mysql-test/t/gis-rtree.test:
  Auto merged
mysql-test/r/gis-rtree.result:
  merging
2007-10-05 15:41:56 +05:00
unknown
6d54b5771b Bug #30286 spatial index cause corruption and server crash!
As the result of DOUBLE claculations can be bigger
than DBL_MAX constant we use in code, we shouldn't use this constatn
as a biggest possible value.
Particularly the rtree_pick_key function set 'min_area= DBL_MAX' relying
that any rtree_area_increase result will be less so we return valid
key. Though in rtree_area_increase function we calculate the area
of the rectangle, so the result can be 'inf' if the rectangle is
huge enough, which is bigger than DBL_MAX.

Code of the rtree_pick_key modified so we always return a valid key.


myisam/rt_index.c:
  Bug #30286 spatial index cause corruption and server crash!
  
  always set the best_key with the first key we get, so we always return
  somthing valid.
myisam/rt_mbr.c:
  Bug #30286 spatial index cause corruption and server crash!
  
  function comment extended
mysql-test/r/gis-rtree.result:
  Bug #30286 spatial index cause corruption and server crash!
  test result
mysql-test/t/gis-rtree.test:
  Bug #30286 spatial index cause corruption and server crash!
  test case
2007-10-05 15:40:32 +05:00
unknown
2e8ca84e89 Bug #31253: crash comparing datetime to double
convert(<invalid time>, datetime) in WHERE caused crash as function
returned (void*)NULL, but did not flag SQL NULL. It does now.


mysql-test/r/type_datetime.result:
  show that convert() to datetime in a WHERE-clause will no longer crash
  the server on invalid input.
mysql-test/t/type_datetime.test:
  show that convert() to datetime in a WHERE-clause will no longer crash
  the server on invalid input.
sql/item.cc:
  When failing to process time values, do not just return (void*)NULL,
  but flag SQL NULL as well so no caller will try to process the 0x0L.
  This makes behaviour for Item::Item::val_decimal_from_date() and
  Item::Item::val_decimal_from_time() identical.
2007-10-05 12:08:38 +02:00
unknown
28232df2ae Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  sin.intern.azundris.com:/home/tnurnberg/31227/50-31227
2007-10-05 10:04:45 +02:00
unknown
1b3d25d561 Bug#31227: memory overrun with decimal (6,6) and zerofill and group_concat
Reserve the space for the leading 0 (before the decimal point) in DECIMAL(a,a) ZEROFILL.


mysql-test/r/type_decimal.result:
  show that we allocate a large enough buffer for output of DECIMAL(a,a) [ZEROFILL].
mysql-test/t/type_decimal.test:
  show that we allocate a large enough buffer for output of DECIMAL(a,a) [ZEROFILL].
  without patch for bug#31227, valgrind will complain here; so will a
  debug build.
sql/my_decimal.cc:
  Reserve the space for the leading 0 (before the decimal point) in DECIMAL(a,a) ZEROFILL.
  Doxygenise preamble of my_decimal2string().
2007-10-05 09:38:57 +02:00
unknown
554d405d73 test fix(to satisfy WIN)
mysql-test/r/information_schema.result:
  result fix
2007-10-05 12:29:02 +05:00
unknown
4f14c13a1c Fix for BUG#31035: select from function, group by result crasher.
This actually, fix for the patch for bug-27354. The problem with
the patch was that Item_func_sp::used_tables() was updated, but
Item_func_sp::const_item() was not. So, for Item_func_sp, we had
the following inconsistency:
  - used_tables() returned RAND_TABLE, which means that the item
    can produce "random" results;
  - but const_item() returned TRUE, which means that the item is
    a constant one.

The fix is to change Item_func_sp::const_item() behaviour: it must
return TRUE (an item is a constant one) only if a stored function
is deterministic and each of its arguments (if any) is a constant
item.


mysql-test/r/sp.result:
  Update result file.
mysql-test/t/sp.test:
  Add test cases for BUG-31035, BUG-31191, BUG-31226
sql/item_func.cc:
  Make Item::const_item() be consistent with Item::used_tables().
2007-10-04 17:19:14 +04:00
unknown
4ae273e395 Bug#30079 A check for "hidden" I_S tables is flawed
added check for hidden I_S tables for 'show columns|keys' commands


mysql-test/r/information_schema.result:
  test result
mysql-test/t/information_schema.test:
  test case
sql/sql_parse.cc:
  added check for hidden I_S tables for 'show columns|keys' commands
2007-10-04 16:20:56 +05:00
unknown
4d0ef0cc85 Backport of the 5.0 patch to 4.1
Bug#28878: InnoDB tables with UTF8 character set and indexes cause  wrong result for DML
When making key reference buffers over CHAR fields whitespace (0x20) must be used to fill in the remaining space in the field's buffer. This is what Field_string::store() does. Fixed Field_string::get_key_image() to do the same.


mysql-test/r/innodb_mysql.result:
  Bug#28878: test case
mysql-test/t/innodb_mysql.test:
  Bug#28878: test case
sql/field.cc:
  Bug#28878: Fill with space instead of binary zeros.
2007-10-04 14:22:35 +04:00
unknown
d0d6fb96a6 ndb - bug#29390: if ScanFilter is too large, abort or optionally discard it
mysql-test/r/ndb_condition_pushdown.result:
  if ScanFilter is too large, abort or optionaly discard it
mysql-test/t/ndb_condition_pushdown.test:
  if ScanFilter is too large, abort or optionaly discard it
ndb/include/kernel/signaldata/ScanTab.hpp:
  if ScanFilter is too large, abort or optionaly discard it
ndb/include/ndbapi/Ndb.hpp:
  if ScanFilter is too large, abort or optionaly discard it
ndb/include/ndbapi/NdbScanFilter.hpp:
  if ScanFilter is too large, abort or optionaly discard it
ndb/include/ndbapi/ndbapi_limits.h:
  if ScanFilter is too large, abort or optionaly discard it
ndb/src/ndbapi/NdbScanFilter.cpp:
  if ScanFilter is too large, abort or optionaly discard it
ndb/src/ndbapi/NdbScanOperation.cpp:
  if ScanFilter is too large, abort or optionaly discard it
ndb/src/ndbapi/ndberror.c:
  if ScanFilter is too large, abort or optionaly discard it
sql/ha_ndbcluster_cond.cc:
  if ScanFilter is too large, abort or optionaly discard it
2007-10-04 11:32:49 +02:00
unknown
227bf9ad66 Merge polly.(none):/home/kaa/src/maint/bug5731/my50-bug5731
into  polly.(none):/home/kaa/src/maint/mysql-5.0-maint
2007-10-04 13:29:37 +04:00
unknown
ae2956f79a Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/data0/mhansson/bug30942/my50-bug30942
2007-10-04 11:06:01 +02:00
unknown
78348d4ed1 Issue a warning if a user sets an option or a variable to a value that is greater than a defined maximum for the option/variable.
This is for bug #29446 "Specifying a myisam_sort_buffer > 4GB on 64 bit machines not possible". Support for myisam_sort_buffer_size > 4 GB on 64-bit Windows will be looked at later in 5.2.


mysql-test/r/variables.result:
  Fixed the test.
mysql-test/t/variables.test:
  Fixed the test.
mysys/my_getopt.c:
  Print a warning to the error log if a user sets an option to a value greater than the option's maximum value.
sql/set_var.cc:
  Issue an SQL warning if a user assignes a value greater than the variable's maximum value.
2007-10-04 12:34:00 +04:00
unknown
f8f021fd6b Bug #30942: select str_to_date from derived table returns varying results
The function str_to_date has a field to say whether it's invoked constant 
arguments. But this member was not initialized, causing the function to
think that it could use a cache of the format type when said cache was in 
fact not initialized.
Fixed by initializing the field to false.


mysql-test/r/type_date.result:
  Bug#30942: Test result
mysql-test/t/type_date.test:
  Bug#30942: Test case
sql/item_timefunc.h:
  Bug#30942: Initialized const_item to false
2007-10-04 09:15:26 +02:00
unknown
ae3d4bfc0e Bug #30955 geomfromtext() crasher.
end-of-line check missed in Gis_read_stream::get_next_word,
what can lead to crashes (expecially with NULL strings).

End-of-line check added


sql/gstream.cc:
  Bug #30955 geomfromtext() crasher
mysql-test/r/gis.result:
  Bug #30955 geomfromtext() crasher.
  
  test result
mysql-test/t/gis.test:
  Bug #30955 geomfromtext() crasher.
  
  test case
2007-10-03 13:35:35 +05:00
unknown
a408f34866 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-31077
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-10-03 11:37:29 +05:00
unknown
b802af43cb mysqldump.test, mysqldump.result:
Bug #31077: post-commit fix.


mysql-test/t/mysqldump.test:
  Bug #31077: post-commit fix.
mysql-test/r/mysqldump.result:
  Bug #31077: post-commit fix.
2007-10-03 11:36:42 +05:00
unknown
df4e28e75b Merge gleb.loc:/home/uchum/work/bk/5.0-opt-31077
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-10-03 02:51:17 +05:00
unknown
853e4da88f mysqldump.c, mysqldump.test, mysqldump.result:
Bug #31077: post-commit fix.


client/mysqldump.c:
  Bug #31077: post-commit fix.
mysql-test/t/mysqldump.test:
  Bug #31077: post-commit fix.
mysql-test/r/mysqldump.result:
  Bug #31077: post-commit fix.
2007-10-03 02:50:38 +05:00
unknown
2071d63dc7 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-31077
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-10-02 22:31:51 +05:00
unknown
6400c7a238 Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/data0/mhansson/bug30832/my50-bug30832
2007-10-02 14:36:07 +02:00
unknown
832616f177 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/work/31095-bug-5.0-opt-mysql
2007-10-02 12:36:06 +00:00
unknown
c19a8c0631 Bug#25817 UPDATE IGNORE doesn't check write_set when checking unique indexes: Added checks 2007-10-02 13:36:13 +02:00
unknown
1a4df8a24d Bug#31095: Unexpected NULL constant caused server crash.
The Item_func_rollup_const class is used for wrapping constants to avoid
wrong result for ROLLUP queries with DISTINCT and a constant in the select
list. This class is also used to wrap up a NULL constant but its null_value
wasn't set accordingly. This led to a server crash.

Now the null_value of an object of the Item_func_rollup_const class is set
by its fix_length_and_dec member function.


mysql-test/t/olap.test:
  Added a test case for the bug#31095: Unexpected NULL constant caused server crash.
mysql-test/r/olap.result:
  Added a test case for the bug#31095: Unexpected NULL constant caused server crash.
sql/item_func.h:
  Bug#31095: Unexpected NULL constant caused server crash. 
  Now the null_value of an object of the Item_func_rollup_const class is set
  by its fix_length_and_dec member function.
2007-10-01 20:03:50 +00:00
unknown
02bb72c735 Fixed bug #31077.
mysqldump adds the "-- Dump completed on YYYY-MM-DD hh:mm:ss" string
to the end of output if the --comments switch is on.
The only way to suppress this line is to use --skip-comments/--compact
switch.

New switch has been added to the mysqldump client command line:
--dump-date.

For the compatibility with previous releases, by default the --dump-date
is on.
The --dump-date switch forces mysqldump to add date to the
"-- Dump completed on ..." string at the end of output.
The --skip-dump-date switch supresses the output of date string
and uses short form of that commentary: "-- Dump completed".
--skip-comments or --compact switches disable the whole commentary
as usual.


client/client_priv.h:
  Fixed bug #31077.
  New OPT_DUMP_DATE option has been added to implement
  the mysqldump client --dump-date switch.
client/mysqldump.c:
  Fixed bug #31077.
  The opt_dump_date variable has been added to imlements
  the mysqldump cliemt --dump-date switch.
  By default this switch is on (for compatibility with previous
  releases).
  The --dump-date switch forces mysqldump to add date to the
  "-- Dump completed on ..." string at the end of output.
  The --skip-dump-date switch supresses the output of date string
  and uses short form of that commentary: "-- Dump completed".
  --skip-comments or --compact switches disable the whole commentary
  as usual.
mysql-test/t/mysqldump.test:
  Added test case for bug #31077.
mysql-test/r/mysqldump.result:
  Added test case for bug #31077.
2007-10-01 20:35:51 +05:00
unknown
0ad23eb8a5 removed undeterministic test result from the fux for bug 30587 2007-10-01 12:51:59 +03:00
unknown
c6a4e65a40 view_grant.result, view_grant.test:
Corrected test case for the bug#29908.


mysql-test/t/view_grant.test:
  Corrected test case for the bug#29908.
mysql-test/r/view_grant.result:
  Corrected test case for the bug#29908.
2007-09-29 01:07:29 +00:00
unknown
582388e6d2 Bug #30832: Assertion + crash with select name_const('test', now());
The NAME_CONST function is required to work correctly with constants only.
When executed with functions that return types other than those returned by
Item::field_type (string, int, decimal, or real), the result gets cast to
one of those types. This cannot happen for constants.
Fixed by only allowing constants as arguments to NAME_CONST.


mysql-test/r/func_misc.result:
  Bug#30832: Test result
mysql-test/t/func_misc.test:
  Bug#30832: Test case
sql/item.h:
  Bug#30832: The fix
2007-09-28 18:05:23 +02:00
unknown
4c14efa696 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B30587-5.0-opt


sql/item_func.cc:
  Auto merged
2007-09-28 16:57:36 +03:00
unknown
bebcb22183 Bug #30587: mysql crashes when trying to group by TIME div NUMBER
When calculating the result length of an integer DIV function 
the number of decimals was used without checking the result type
first. Thus an uninitialized number of decimals was used for some 
types. This caused an excessive amount of memory to be allocated 
for the field's buffer and crashed the server.

 
Fixed by using the number of decimals only for data types that 
can have decimals and thus have valid decimals number.


mysql-test/r/func_math.result:
  Bug #30587: test case
mysql-test/t/func_math.test:
  Bug #30587: test case
sql/item_func.cc:
  Bug #30587: Don't use decimals on a type that doesn't have them.
2007-09-28 16:46:05 +03:00
unknown
d992598ac8 Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2007-09-28 09:13:21 +02:00
unknown
464a9255ab Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  sunlight.local:/local_work/29908-bug-5.0-opt-mysql


sql/sql_view.cc:
  Auto merged
2007-09-27 23:45:39 +04:00
unknown
500d856faf Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B30468-5.0-opt


sql/sql_base.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
2007-09-27 12:17:16 +03:00
unknown
66f13d9120 Bug #30468: column level privileges not respected when joining tables
When expanding a * in a USING/NATURAL join the check for table access
for both tables in the join was done using the grant information of the
first one.
Fixed by getting the grant information for the current table while 
iterating through the columns of the join.


mysql-test/r/grant2.result:
  Bug #30468: test case
mysql-test/t/grant2.test:
  Bug #30468: test case
sql/sql_acl.cc:
  Bug #30468: correctly check column grants
sql/sql_acl.h:
  Bug #30468: correctly check column grants
sql/sql_base.cc:
  Bug #30468: correctly check column grants
sql/sql_insert.cc:
  Bug #30468: correctly check column grants
2007-09-27 12:15:19 +03:00
unknown
ca448acc25 Bug #28702: VIEWs defined with USE/FORCE KEY ignore that request
When storing the VIEW the CREATE VIEW command is reconstructed 
from the parse tree. While constructing the command string
the index hints specified should also be printed.
Fixed by adding code to print the index hints when printing a 
table in the FROM clause.


mysql-test/r/view.result:
  Bug #28702: test case
mysql-test/t/view.test:
  Bug #28702: test case
sql/sql_select.cc:
  Bug #28702: preserve index hints in a VIEW definition.
sql/table.h:
  Bug #28702: preserve index hints in a VIEW definition.
2007-09-24 15:34:10 +03:00
unknown
bc09b357fa Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  sita.local:/Users/tsmith/m/bk/maint/50
2007-09-24 13:22:39 +02:00
unknown
562deff31c Add test for named pipes on windows
Improve test for  shm on windows


mysql-test/include/windows.inc:
  improve "skip message" and don't require a result file
mysql-test/r/shm.result:
  Update result after adding more tests
mysql-test/t/shm-master.opt:
  Add $MTR_BUILD_THREAD to get a unique shared memory base name
mysql-test/t/shm.test:
  Run a bunch of more test to check shm
mysql-test/r/named_pipe.result:
  New BitKeeper file ``mysql-test/r/named_pipe.result''
mysql-test/t/named_pipe-master.opt:
  New BitKeeper file ``mysql-test/t/named_pipe-master.opt''
mysql-test/t/named_pipe.test:
  New BitKeeper file ``mysql-test/t/named_pipe.test''
2007-09-24 12:42:44 +02:00
unknown
139b563ec4 Merge sita.local:/Users/tsmith/m/bk/50
into  sita.local:/Users/tsmith/m/bk/maint/50


client/mysql.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
mysql-test/Makefile.am:
  Auto merged
sql/sql_select.cc:
  Auto merged
2007-09-24 11:33:27 +02:00
unknown
5d59c1e81b Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  macbook.local:/Users/kgeorge/mysql/autopush/B28701-merged-5.0-opt
2007-09-22 14:48:14 +02:00
unknown
cfbb6fc632 Bug#30843 Bad Test addition to t/archive.test
mysql-test/r/archive.result:
  Don't care about the "after insert delayed" record when since
  we can't guarantee the order it's been inserted
mysql-test/t/archive.test:
  Don't care about the "after insert delayed" record when since
  we can't guarantee the order it's been inserted
2007-09-22 12:17:14 +02:00
unknown
18397a5dc3 Merge macbook.local:/Users/kgeorge/mysql/work/B28701-5.0-opt
into  macbook.local:/Users/kgeorge/mysql/work/B28701-merged-5.0-opt


sql/sql_view.cc:
  Auto merged
mysql-test/r/view.result:
  merge with 5.0-opt
mysql-test/t/view.test:
  merge with 5.0-opt
2007-09-22 11:42:01 +02:00
unknown
17df0d648c Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  sunlight.local:/local_work/27216-bug-5.0-opt-mysql


sql/sql_insert.cc:
  Auto merged
2007-09-22 13:10:44 +04:00
unknown
ebaa05efa7 Bug#27216: functions with parameters of different date types may return wrong
type of the result.

There are several functions that accept parameters of different types.
The result field type of such functions was determined based on
the aggregated result type of its arguments. As the DATE and the DATETIME
types are represented by the STRING type, the result field type
of the affected functions was always STRING for DATE/DATETIME arguments.
The affected functions are COALESCE, IF, IFNULL, CASE, LEAST/GREATEST, CASE.

Now the affected functions aggregate the field types of their arguments rather
than their result types and return the result of aggregation as their result
field type.
The cached_field_type member variable is added to the number of classes to
hold the aggregated result field type.
The str_to_date() function's result field type now defaults to the
MYSQL_TYPE_DATETIME.
The agg_field_type() function is added. It aggregates field types with help
of the Field::field_type_merge() function.
The create_table_from_items() function now uses the 
item->tmp_table_field_from_field_type() function to get the proper field
when the item is a function with a STRING result type.


libmysql/libmysql.c:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  The client library now accepts the NEWDATE type as a string.
sql/item_cmpfunc.cc:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  Now the fix_length_and_dec functions of the
  Item_func_ifnull,Item_func_if, Item_func_case, Item_func_coalesce
  classes are use agg_field_type function to find out the type of their 
  result field.
sql/item_cmpfunc.h:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  The cached_field type is added to the Item_func_case, Item_func_if and
  Item_func_coalesce classes.
  The field_type function is added to the Item_func_ifnull, Item_func_if,
  Item_func_coalesce, Item_func_case classes.
sql/item_func.cc:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  The Item_func_min_max::fix_length_and_dec function now uses the agg_field_type
  function to find out the correct type of the result field.
sql/item_func.h:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  The cached_field_type variable is added to the Item_func_min_max class.
sql/item_timefunc.cc:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  The result of the str_to_date function now defaults to the
  DATETIME type.
sql/mysql_priv.h:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  The prototype of the agg_field_type function is added.
sql/protocol.cc:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  The Protocol_simple::store function is now used to store fields of NEWDATE type.
sql/sql_insert.cc:
  Bug#27216: functions with parameters of different date types may return wrong
  type of the result.
  The create_table_from_items function now uses the
  tmp_table_field_from_field_type function to get field for items with the
  STRING result type.
mysql-test/r/date_formats.result:
  A test case result corrected after fixing bug#27216.
mysql-test/r/type_datetime.result:
  Added a test case for the bug#27216: functions with parameters of different
  date types may return wrong type of the result.
mysql-test/t/type_datetime.test:
  Added a test case for the bug#27216: functions with parameters of different
  date types may return wrong type of the result.
2007-09-22 11:49:27 +04:00
unknown
89c7db5655 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  shellback.(none):/home/msvensson/mysql/mysql-5.0-maint
2007-09-21 16:39:05 +02:00
unknown
f7f1095908 Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
led to creating corrupted index.

While execution of the  CREATE .. SELECT SQL_BUFFER_RESULT statement the 
engine->start_bulk_insert function was called twice. On the first call
On the first call MyISAM disabled all non-unique indexes and on the second
call it decides to not re-enable them because all indexes was disabled.
Due to this no indexes was actually created during CREATE TABLE thus
producing crashed table.

Now the select_inset class has is_bulk_insert_mode flag which prevents
calling the start_bulk_insert function twice.
The flag is set in the select_create::prepare, select_insert::prepare2
functions and the select_insert class constructor.
The flag is reset in the select_insert::send_eof function.


mysql-test/t/insert_select.test:
  A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the
  CREATE .. KEY(..) .. SELECT led to creating corrupted index.
mysql-test/r/insert_select.result:
  A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the 
  CREATE .. KEY(..) .. SELECT led to creating corrupted index.
sql/sql_class.h:
  Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
  led to creating corrupted index.
  The is_bulk_insert_mode flag is added to the select_insert class.
sql/sql_insert.cc:
  Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
  led to creating corrupted index.
  The is_bulk_insert_mode is set in the select_create::prepare, select_insert::prepare2
  functions and the select_insert class constructor.
  The flag is reset in the select_insert::send_eof function.
2007-09-21 12:09:00 +04:00
unknown
8a42112692 Bug#30843 Bad Test addition to t/archive.test
- Add extra insert


mysql-test/r/archive.result:
  Add an extra insert to guarantee that the delayed
  insert shows up in the table
mysql-test/t/archive.test:
  Add an extra insert to guarantee that the delayed
  insert shows up in the table
2007-09-21 09:48:30 +02:00
unknown
eeeeec8edc Bug#19828: Case sensitivity in hostname leads to inconsistent behavior
clean up SHOW GRANTS so it will show host-names with case as entered.
make REVOKE and friends case-sensitive to make things more intuitive.
Patch by Martin Friebe.


mysql-test/r/grant.result:
  Bug#19828: Case sensitivity in hostname leads to inconsistent behavior
  
  clean up after test so random order of tests is possible
mysql-test/r/grant3.result:
  Bug#19828: Case sensitivity in hostname leads to inconsistent behavior
  
  Show that REVOKE, SHOW GRANTS etc. are now consistently case-sensitive.
mysql-test/t/grant.test:
  Bug#19828: Case sensitivity in hostname leads to inconsistent behavior
  
  clean up after test so random order of tests is possible
mysql-test/t/grant3.test:
  Bug#19828: Case sensitivity in hostname leads to inconsistent behavior
  
  Show that REVOKE, SHOW GRANTS etc. are now consistently case-sensitive.
2007-09-20 18:10:35 +02:00
unknown
1cb6dc2b37 Bug#29908: A user can gain additional access through the ALTER VIEW.
Non-definer of a view was allowed to alter that view. Due to this the alterer
can elevate his access rights to access rights of the view definer and thus
modify data which he wasn't allowed to modify. A view defined with
SQL SECURITY INVOKER can't be used directly for access rights elevation.
But a user can first alter the view SQL code and then alter the view to 
SQL SECURITY DEFINER and thus elevate his access rights. Due to this
altering a view with SQL SECURITY INVOKER is also prohibited.

Now the mysql_create_view function allows ALTER VIEW only to the view
definer or a super user. 


mysql-test/t/view_grant.test:
  Added a test case for the bug#29908: A user can gain additional access through the
  ALTER VIEW.
  A test case was adjusted after fixfing bug#29908.
mysql-test/r/view_grant.result:
  Added a test case for the bug#29908: A user can gain additional access through the
  ALTER VIEW.
sql/sql_view.cc:
  Bug#29908: A user can gain additional access through the ALTER VIEW.
  Now the mysql_create_view function allows ALTER VIEW only to the view
  definer or a super user.
2007-09-20 18:05:09 +04:00
unknown
fac190a28b Bug#27747 database metadata doesn't return sufficient column default info
added get_field_default_value() function which obtains default value from the field
(used in store_create_info() & get_schema_column_record() functions)


mysql-test/r/alter_table.result:
  result fix
mysql-test/r/create.result:
  result fix
mysql-test/r/ctype_collate.result:
  result fix
mysql-test/r/ctype_recoding.result:
  result fix
mysql-test/r/default.result:
  result fix
mysql-test/r/gis.result:
  result fix
mysql-test/r/grant.result:
  result fix
mysql-test/r/information_schema.result:
  result fix
mysql-test/r/key.result:
  result fix
mysql-test/r/mysql.result:
  result fix
mysql-test/r/ps_1general.result:
  result fix
mysql-test/r/show_check.result:
  result fix
mysql-test/r/sp.result:
  result fix
mysql-test/r/type_enum.result:
  result fix
mysql-test/r/type_ranges.result:
  result fix
mysql-test/t/information_schema.test:
  test case
2007-09-20 13:54:46 +05:00
unknown
ffdc5b9302 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-09-19 13:50:38 +05:00
unknown
692b686dae select.test:
Post-fix for bug#27695.


mysql-test/t/select.test:
  Post-fix for bug#27695.
2007-09-15 07:04:32 +02:00
unknown
f58cbe3d84 Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  devsrv-b.mysql.com:/data0/gshchepa/mysql-5.0-opt
2007-09-14 21:15:43 +02:00
unknown
4d8ec62d1a Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B31001-5.0-opt
2007-09-14 19:04:47 +03:00
unknown
ad496be063 Bug #31001: ORDER BY DESC in InnoDB not working
The optimizer sets index traversal in reverse order only if there are 
 used key parts that are not compared to a constant.
However using the primary key as an ORDER BY suffix rendered the check
incomplete : going in reverse order must still be used even if 
all the parts of the secondary key are compared to a constant.

Fixed by relaxing the check and set reverse traversal even when all
the secondary index keyparts are compared to a const.
Also account for the case when all the primary keys are compared to a
constant.


mysql-test/r/innodb_mysql.result:
  Bug #31001: test case
mysql-test/t/innodb_mysql.test:
  Bug #31001: test case
sql/sql_select.cc:
  Bug #31001: 
   - account for the case when all the primary key parts are compared
     to a constant
   - force test_if_skip_sort_order to go backwards over the key even 
     when the number of keyparts used is the same as the number of 
     keyparts equal to a constant. (because of the primary key 
     suffix).
2007-09-14 17:43:14 +03:00
unknown
2ab4e3d117 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/psergey/mysql-5.0-bug30324
2007-09-14 15:00:10 +04:00
unknown
466747d570 BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
- The bug was caused by COUNT(DISTINCT ...) code using Unique object in 
  a way that assumed that BIT(N) column occupies a contiguous space in
  temp_table->record[0] buffer. 
- The fix is to make COUNT(DISTINCT ...) code instruct create_tmp_table to
  create temporary table with column of type BIGINT, not BIT(N).


mysql-test/r/type_bit.result:
  BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
  - Testcase
mysql-test/t/type_bit.test:
  BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
  - Testcase
sql/item_sum.cc:
  BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
  - Make COUNT(DISTINCT ...) code instruct create_tmp_table to create 
    temporary table with BIGINT, not BIT(N) column.
2007-09-14 14:53:13 +04:00
unknown
820a2b8c51 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
2007-09-14 11:08:55 +02:00
unknown
efc137d7e2 Merge stella.local:/home/mydev/mysql-5.0-amain
into  stella.local:/home/mydev/mysql-5.0-axmrg
2007-09-14 10:55:48 +02:00
unknown
22a387da5e Merge stella.local:/home/mydev/mysql-5.0-ateam
into  stella.local:/home/mydev/mysql-5.0-axmrg
2007-09-14 10:54:56 +02:00
unknown
b9f9aa65b5 Merge gshchepa@bk-internal.mysql.com:/users/gshchepa/mysql-5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.0-opt-27695
2007-09-14 13:11:50 +05:00
unknown
734c8a96be Merge stella.local:/home/mydev/mysql-4.1-amain
into  stella.local:/home/mydev/mysql-4.1-axmrg
2007-09-14 10:10:29 +02:00
unknown
037a0f7677 Fixed bug #27695.
Declaring an all space column name in the SELECT FROM DUAL or in a view
leads to misleading warning message:
"Leading spaces are removed from name ' '".

The Item::set_name method has been modified to raise warnings like
"Name ' ' has become ''" in case of the truncation of an all
space identifier to an empty string identifier instead of the
"Leading spaces are removed from name ' '" warning message.


sql/item.cc:
  Fixed bug #27695.
  The Item::set_name method has been modified to raise warnings like
  "Name ' ' has become ''" in case of the truncation of an all
  space identifier to an empty string identifier instead of the
  "Leading spaces are removed from name ' '" warning message.
sql/share/errmsg.txt:
  Fixed bug #27695.
mysql-test/t/select.test:
  Added test case for bug #27695.
mysql-test/r/select.result:
  Added test case for bug #27695.
2007-09-13 18:41:50 +05:00
unknown
4775828416 Merge mysql.com:/home/svoj/devel/mysql/BUG30590/mysql-4.1-engines
into  mysql.com:/home/svoj/devel/mysql/BUG30590/mysql-5.0-engines


heap/hp_delete.c:
  Auto merged
heap/hp_rfirst.c:
  Auto merged
heap/hp_rnext.c:
  Auto merged
mysql-test/r/heap_btree.result:
  Auto merged
mysql-test/t/heap_btree.test:
  Manual merge.
2007-09-13 16:42:23 +05:00
unknown
cf5762b402 BUG#30590 - delete from memory table with composite btree primary key
DELETE query against memory table with btree index may remove
not all matching rows. This happens only when DELETE uses
index read method to find matching rows. E.g. for queries
like DELETE FROM t1 WHERE a=1.

Fixed by reverting fix for BUG9719 and applying proper solution.


heap/hp_delete.c:
  Reverted fix for BUG9719 as it makes queries like
  DELETE FROM t1 WHERE a=1 to remove not all matching
  rows (assuming this is memory table and there is btree
  key over `a`).
  
  This happens because we calculate info->lastkey_len in
  heap_rkey(). When we enter heap_rnext(), info->lastkey_len
  is 0 (set by hp_rb_delete_key()). We need to preserve
  info->lastkey_len in this situation, otherwise
  tree_search_key() will always return smallest value in
  a tree.
heap/hp_rfirst.c:
  If we're performing index_first on a table that was taken from
  table cache, info->lastkey_len is initialized to previous query.
  Thus we set info->lastkey_len to proper value for subsequent
  heap_rnext() calls.
  This is needed for DELETE queries only, otherwise this variable is
  not used.
  Note that the same workaround may be needed for heap_rlast(), but
  for now heap_rlast() is never used for DELETE queries.
heap/hp_rnext.c:
  An optimization for DELETE queries that use index_first()/index_next().
  Use faster tree_search_edge() instead of tree_search_key().
mysql-test/r/heap_btree.result:
  A test case for BUG#30590.
mysql-test/t/heap_btree.test:
  A test case for BUG#30590.
2007-09-13 15:39:16 +05:00
unknown
2978fcc3e9 Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt


sql/sql_yacc.yy:
  Auto merged
mysql-test/r/sp.result:
  SCCS merged
mysql-test/t/sp.test:
  SCCS merged
2007-09-12 23:41:35 +05:00
unknown
345891d76b Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge


mysql-test/Makefile.am:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
2007-09-12 14:01:51 +02:00
unknown
5f183053df Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge


sql/ha_ndbcluster.cc:
  Auto merged
2007-09-12 07:34:42 +02:00
unknown
4e5c03961a Post-merge fixes 2007-09-11 02:41:42 +04:00
unknown
9d466ad479 Merge mysql.com:/home/psergey/mysql-4.1-bug30385
into  mysql.com:/home/psergey/mysql-5.0-bug30385


sql/opt_range.cc:
  Auto merged
mysql-test/r/delete.result:
  Manual merge
mysql-test/t/delete.test:
  Manual merge
2007-09-11 02:24:08 +04:00
unknown
732f05a642 BUG#30385: Server crash when deleting with ORDER BY and LIMIT
in get_index_for_order(), don't walk over the end of the index key parts
when matching index description and needed ordering.


mysql-test/r/delete.result:
  BUG#30385: Testcase
mysql-test/t/delete.test:
  BUG#30385: Testcase
2007-09-10 16:26:51 +04:00
unknown
76e37a32b8 Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
2007-09-06 22:27:13 +05:00
unknown
b371ee8a40 Merge damien-katzs-computer.local:/Users/dkatz/mysql50
into  damien-katzs-computer.local:/Users/dkatz/50_udf_const


sql/item_func.cc:
  Auto merged
2007-09-05 15:15:48 -04:00
unknown
0a28cac0b6 Bug #29804 UDF parameters don't contain correct string length
Previously, UDF *_init functions were passed constant strings with erroneous lengths.
The length came from the containing variable's size, not the length of the value itself.
  
Now the *_init functions get the constant as a null terminated string with the correct
length supplied too.


mysql-test/r/udf.result:
  Test case to check constants passed UDFs.
mysql-test/t/udf.test:
  Test case to check constants passed UDFs.
sql/item_func.cc:
  UDF _init functions are now passed the length of the constants, rather than the max
  length of the var containing the constant.
sql/udf_example.c:
  Added check_const_len functions. The check_const_len_init functions checks that the
  lengths of constants are correctly passed.
sql/udf_example.def:
  Add new example functions to windows dll export list.
2007-09-05 15:06:10 -04:00
unknown
3a94137ce0 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-rt-merge


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/mysql.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
2007-09-04 14:38:26 -06:00
unknown
403ed43b1d Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/data0/mhansson/my50-bug30234-push


sql/sql_yacc.yy:
  Auto merged
2007-09-03 12:44:17 +02:00
unknown
f0d4beee79 Bug #30234: Unexpected behavior using DELETE with AS and USING
DELETE FROM ... USING ... statements with the following type of 
ambiguous aliasing gave unexpected results:
DELETE FROM t1 AS alias USING t1, t2 AS alias WHERE t1.a = alias.a;
This query would leave table t1 intact but delete rows from t2.
Fixed by changing DELETE FROM ... USING syntax so that only alias 
references (as opposed to alias declarations) may be used in FROM.


mysql-test/r/delete.result:
  Bug#30234: Test Result
mysql-test/t/delete.test:
  Bug#30234: Test Case
sql/sql_yacc.yy:
  Bug#30234:
  - Added parser rule table_alias_ref_list that contains a list of table 
    aliases only.
  - Added parser rule table_alias_ref that sets the TL_OPTION_ALIAS in 
    order to turn off semantic checking that applies only for table names.
2007-09-03 11:55:35 +02:00
unknown
ee0b7d895d Bug#29408 Cannot find view in columns table if the selection contains a function
Use view db name as thread default database, in order to ensure
that the view is parsed and prepared correctly.


mysql-test/r/sp.result:
  test result
mysql-test/t/sp.test:
  test case
sql/sql_parse.cc:
  copy thd->db_length to table_list->db_length
sql/sql_view.cc:
  Use view db name as thread default database, in order to ensure
  that the view is parsed and prepared correctly.
2007-09-03 12:22:56 +05:00
unknown
b25b8cbc72 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-30126
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-08-31 17:05:37 +05:00
unknown
ff149b713c Fixed bug #30126.
When dumping database from a 4.x server, the mysqldump client
inserted a delimiter sign inside special commentaries of the form:
  /*!... CREATE DATABASE IF NOT EXISTS ... ;*/
During restoration that dump file was splitten by delimiter signs on
the client side, and the rest of some commentary strings was prepended
to following statements.

The 4x_server_emul test case option has been added for use with the
DBUG_EXECUTE_IF debugging macro. This option affects debug server
builds only to emulate particular behavior of a 4.x server for
the mysqldump client testing. Non-debugging builds are not affected.


mysql-test/r/mysqldump-compat.result:
  Added test case for bug #30126.
mysql-test/t/mysqldump-compat.opt:
  Added test case for bug #30126.
mysql-test/t/mysqldump-compat.test:
  Added test case for bug #30126.
sql/sql_parse.cc:
  Fixed bug #30126.
  The mysqldump client uses the "SHOW CREATE DATABASE" query to
  obtain the "CREATE DATABASE" statement from that database.
  The 4.x server doesn't recognise that query, and mysqldump
  forms the "CREATE DATABASE" statement from scratch.
  That statement was formed incorrectly.
  
  To enforce the mysqldump client to create that statement from
  scratch, debugging code has been added to the mysql_execute_command
  function: in tcase of the --loose-debug=d,4x_server_emul option,
  the server returns parse error to client to emulate old behaviour.
  
  The 4x_server_emul test case option has been added for use with the
  DBUG_EXECUTE_IF debugging macro. This option affects debug server
  builds only to emulate particular behavior of a 4.x server for
  the mysqldump client testing. Non-debugging builds are not affected.
client/mysqldump.c:
  Fixed bug #30126.
  The init_dumping_tables function has been modified to output semicolon
  outside of commentaries.
2007-08-31 16:59:07 +05:00
unknown
3f9be28c41 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime


sql/item_cmpfunc.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
2007-08-30 17:23:40 -06:00
unknown
672c421b13 Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-28779-b
2007-08-30 10:38:20 -06:00
unknown
aef135da66 Use double quotes instead of single ones which make the test fail on Windows. This is for bug #30164.
mysql-test/t/mysql.test:
  Use double quotes instead of single ones which make the test fail on Windows.
2007-08-30 17:21:43 +04:00
unknown
bb986a24e7 Bug #30164: Using client side macro inside server side comments generates broken queries
Problem:
  
In cases when a client-side macro appears inside a server-side comment, the add_line() function in mysql.cc discarded all characters until the next delimiter to remove macro arguments from the query string. This resulted in broken queries being sent to the server when the next delimiter character appeared past the comment's boundaries, because the comment closing sequence ('*/') was discarded.
  
Fix:
  
If a client-side macro appears inside a server-side comment, discard all characters in the comment after the macro (that is, until the end of the comment rather than the next delimiter).
This is a minimal fix to allow only simple cases used by the mysqlbinlog utility. Limitations that are worth documenting:
  
- Nested server-side and/or client-side comments are not supported by mysql.cc
- Using client-side macros in multi-line server-side comments is not supported
- All characters after a client-side macro in a server-side comment will be omitted from the query string (and thus, will not be sent to server).


client/mysql.cc:
  If a client-side macro appears inside a server-side comment, discard all characters in the comment after the macro.
mysql-test/r/mysql.result:
  Added a test case for bug #30164.
mysql-test/t/mysql.test:
  Added a test case for bug #30164.
2007-08-30 12:53:24 +04:00
unknown
b0f899e977 Bug#28779 (mysql_query() allows execution of statements with unbalanced
comments)

Before this fix, the server would accept queries that contained comments,
even when the comments were not properly closed with a '*' '/' marker.

For example,
  select 1 /* + 2 <EOF>
would be accepted as
  select 1 /* + 2 */ <EOF>
and executed as
  select 1

With this fix, the server now rejects queries with unclosed comments
as syntax errors.
Both regular comments ('/' '*') and special comments ('/' '*' '!') must be
closed with '*' '/' to be parsed correctly.


mysql-test/r/comments.result:
  Unbalanced comments are a syntax error.
mysql-test/t/comments.test:
  Unbalanced comments are a syntax error.
sql/sql_lex.cc:
  Unbalanced comments are a syntax error.
2007-08-29 14:50:32 -06:00
unknown
2e4963c5b6 Remove unportable use of "system rm" 2007-08-29 14:44:23 +02:00
unknown
3d5440505c Test case for Bug#13675: DATETIME/DATE type in store proc param
seems to be converted as varbinary.

The bug has been already fixed. This CS just adds a test case for it.


mysql-test/r/sp.result:
  Update result file.
mysql-test/t/sp.test:
  Test case for BUG#13675.
2007-08-29 14:57:59 +04:00
unknown
cf37bc45fc Remove unportable use of "system rm" 2007-08-29 12:47:00 +02:00
unknown
643b2163e6 Remove unportable "system rm" 2007-08-29 12:44:43 +02:00
unknown
2675c95217 Remove unportable use of "exec chmod" 2007-08-29 11:53:15 +02:00
unknown
bd1f34d932 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B30377-5.0-opt


sql/sql_select.cc:
  Auto merged
2007-08-29 12:47:24 +03:00
unknown
bdf19dc73b Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/bugx/my50-bugx


mysql-test/t/innodb_mysql.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/innodb_mysql.result:
  SCCS merged
2007-08-29 10:49:19 +02:00
unknown
901ead6cb5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  moksha.local:/Users/davi/mysql/push/mysql-5.0-runtime
2007-08-28 18:47:08 -03:00
unknown
e0e44ad66e Bug#30625 (Performance, reduce depth for expressions)
This is a performance bug, affecting in particular the bison generated code
for the parser.

Prior to this fix, the grammar used a long chain of reduces to parse an
expression, like:
  bit_expr -> bit_term
  bit_term -> bit_factor
  bit_factor -> value_expr
  value_expr -> term
  term -> factor
etc

This chain of reduces cause the internal state automaton in the generated
parser to execute more state transitions and more reduces, so that the
generated MySQLParse() function would spend a lot of time looping to execute
all the grammar reductions.

With this patch, the grammar has been reorganized so that rules are more
"flat", limiting the depth of reduces needed to parse <expr>.

Tests have been written to enforce that relative priorities and properties
of operators have not changed while changing the grammar.

See the bug report for performance data.


mysql-test/r/parser_precedence.result:
  Improved test coverage for operator precedence
mysql-test/t/parser_precedence.test:
  Improved test coverage for operator precedence
sql/sql_yacc.yy:
  Simplified the grammar to improve performances
2007-08-28 11:16:03 -06:00
unknown
310afbd4a9 Bug #30377: EXPLAIN loses last_query_cost when used with UNION
Currently the Last_query_cost session status variable shows
only the cost of a single flat subselect. For complex queries
(with subselects or unions etc) Last_query_cost is not valid
as it was showing the cost for the last optimized subselect.
Fixed by reseting to zero Last_query_cost when the complete
cost of the query cannot be determined.
Last_query_cost will be non-zero only for single flat queries.


mysql-test/r/status.result:
  Bug #30377: test case
mysql-test/t/status.test:
  Bug #30377: test case
sql/sql_lex.h:
  Bug #30377: helper function
sql/sql_select.cc:
  Bug #30377: don't assign cost if not on single level statement
2007-08-28 18:51:03 +03:00
unknown
5f524dadcd Remove unportable constructs in loaddata.test 2007-08-28 16:44:31 +02:00
unknown
484069cf00 Merge pilot.(none):/data/msvensson/mysql/bug28812/my50-bug28812
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint
2007-08-28 11:35:22 +02:00
unknown
b8c3ba1f84 Merge pilot.(none):/data/msvensson/mysql/yassl_import/my50-yassl_import
into  pilot.(none):/data/msvensson/mysql/bug28812/my50-bug28812
2007-08-28 11:35:05 +02:00
unknown
9c3a03a239 Bug#28812 rpl_ssl fails due to assert in extra/yassl/src/socket_wrapper.cpp:117
- Merge sslaccept and sslconnect.
 - Atomically "reset" vio to VIO_TYPE_SSL when the SSL connection has
   succeeded, this avoids having to revert anything and thus protects
   against "close_active_vio" in the middle.
 - Add some variance to the testcase


mysql-test/t/rpl_ssl.test:
  Add some variance by running two selects before stopping the slave
  Check that number of records in t1 are equal on master and slave
vio/viossl.c:
  Rewrite sslconnect and sslaccept to automically "reset" the vio
  to VIO_TYPE_SSL. Also use the fd from 'SSL_get_fd' to avoid
  setting vio->sd to -1, that previously occured when "close_active_vio"
  was called during connect/accept.
  
  Merge the two function since they were exactly the same except for one line.
  
  Update the DBUG printouts to be generic(i.e use peer instead of client/server).
2007-08-28 11:34:43 +02:00
unknown
d54f42c16c Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50


sql/sql_show.cc:
  Auto merged
2007-08-27 18:19:55 -06:00
unknown
2368664681 Bug #30596 GROUP BY optimization gives wrong result order
The optimization that uses a unique index to remove GROUP BY, did not 
ensure that the index was actually used, thus violating the ORDER BY
that is impled by GROUP BY.
Fixed by replacing GROUP BY with ORDER BY if the GROUP BY clause contains
a unique index. In case GROUP BY ... ORDER BY null is used, GROUP BY is
simply removed.


BitKeeper/etc/ignore:
  Added support-files/mysqld_multi.server tests/bug25714 cscope.in.out cscope.out cscope.po.out to the ignore list
mysql-test/r/distinct.result:
  Bug#30596: Changed test case. 
  Prior to Bug#16458, These queries use temp table and filesort. The
  bug was that they used a temp table. However, that patch removed
  filesort also, in which case we can no longer gurantee correct ordering.
mysql-test/r/group_by.result:
  Bug#30596: Correct result
mysql-test/r/innodb_mysql.result:
  Bug#30596: Test case for innodb. Here, as opposed to for MyISAM, row 
  lookup is done using index whenever the index covers the group list.
mysql-test/t/group_by.test:
  Bug#30596: Test case
mysql-test/t/innodb_mysql.test:
  Bug#30596: Test case
sql/sql_select.cc:
  Bug#30596: The fix, replacing GROUP BY with ORDER BY unless 
  ORDER BY [NULL|<constant>]
2007-08-27 17:33:41 +02:00
unknown
34ded62908 Bug#30632 HANDLER read failure causes hang
If, after the tables are locked, one of the conditions to read from a
HANDLER table is not met, the handler code wrongly jumps to a error path
that won't unlock the tables.

The user-visible effect is that after a error in a handler read command,
all subsequent handler operations on the same table will hang.

The fix is simply to correct the code to jump to the (same) error path that
unlocks the tables.


mysql-test/r/handler.result:
  Bug#30632 test case result
mysql-test/t/handler.test:
  Bug#30632 test case
sql/sql_handler.cc:
  Always unlock the internal and external table level locks if any of the conditions
  (including errors) to read from a HANDLER table are not met.
2007-08-27 10:37:12 -03:00
unknown
369a5f1cdc Bug#25164 create table a as select * from A hangs
The problem from a user's perspective: user creates table A, and then tries
to CREATE TABLE a SELECT from A - and this causes a deadlock error, a hang,
or fails with a debug assert, but only if the storage engine is InnoDB.

The origin of the problem: InnoDB uses case-insensitive collation
(system_charset_info) when looking up the internal table share, thus returning
the same share for 'a' and 'A'.

Cause of the user-visible behavior: since the same share is returned to SQL
locking subsystem, it assumes that the same table is first locked (within the
same session) for WRITE, and then for READ, and returns a deadlock error.
However, the code is wrong in not properly cleaning up upon an error, leaving
external locks in place, which leads to assertion failures and hangs.

Fix that has been implemented: the SQL layer should properly propagate the
deadlock error, cleaning up and freeing all resources.

Further work towards a more complete solution: InnoDB should not use case
insensitive collation for table share hash if table names on disk honor the case.


mysql-test/r/innodb-deadlock.result:
  Bug#25164 test case result
mysql-test/t/innodb-deadlock.test:
  Bug#25164 test case. The CREATE TABLE may fail depending on the character set
  of the system and filesystem, but it should never hang.
sql/lock.cc:
  Unlock the storage engine "external" table level locks, if the MySQL thr_lock
  locking subsystem detects a deadlock error.
2007-08-27 10:13:54 -03:00
unknown
e19f49ae5e Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/30245-bug-5.0-opt-mysql


sql/sql_select.cc:
  Auto merged
2007-08-24 22:11:23 +00:00
unknown
294a43ec5e Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into  bk-internal.mysql.com:/users/gshchepa/mysql-5.0-opt


sql/sql_base.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
2007-08-23 21:28:33 +02:00
unknown
0ff829bb71 Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-marvel
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0.48


sql/sql_base.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
2007-08-23 17:43:47 +02:00
unknown
d4e34c80d6 Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-30237


sql/sql_yacc.yy:
  Auto merged
2007-08-22 11:06:42 -06:00
unknown
fb1be0f1e5 Bug#30237 (Performance regression in boolean expressions)
This is a performance bug, related to the parsing or 'OR' and 'AND' boolean
expressions.

Let N be the number of expressions involved in a OR (respectively AND).

When N=1

For example, "select 1" involve only 1 term: there is no OR operator.

In 4.0 and 4.1, parsing expressions not involving OR had no overhead.
In 5.0, parsing adds some overhead, with Select->expr_list.

With this patch, the overhead introduced in 5.0 has been removed,
so that performances for N=1 should be identical to the 4.0 performances,
which are optimal (there is no code executed at all)

The overhead in 5.0 was in fact affecting significantly some operations.
For example, loading 1 Million rows into a table with INSERTs,
for a table that has 100 columns, leads to parsing 100 Millions of
expressions, which means that the overhead related to Select->expr_list
is executed 100 Million times ...

Considering that N=1 is by far the most probable expression,
this case should be optimal.

When N=2

For example, "select a OR b" involves 2 terms in the OR operator.

In 4.0 and 4.1, parsing expressions involving 2 terms created 1 Item_cond_or
node, which is the expected result.
In 5.0, parsing these expression also produced 1 node, but with some extra
overhead related to Select->expr_list : creating 1 list in Select->expr_list
and another in Item_cond::list is inefficient.

With this patch, the overhead introduced in 5.0 has been removed
so that performances for N=2 should be identical to the 4.0 performances.
Note that the memory allocation uses the new (thd->mem_root) syntax
directly.
The cost of "is_cond_or" is estimated to be neglectable: the real problem
of the performance degradation comes from unneeded memory allocations.

When N>=3

For example, "select a OR b OR c ...", which involves 3 or more terms.

In 4.0 and 4.1, the parser had no significant cost overhead, but produced
an Item tree which is difficult to evaluate / optimize during runtime.
In 5.0, the parser produces a better Item tree, using the Item_cond
constructor that accepts a list of children directly, but at an extra cost
related to Select->expr_list.

With this patch, the code is implemented to take the best of the two
implementations:
- there is no overhead with Select->expr_list
- the Item tree generated is optimized and flattened.

This is achieved by adding children nodes into the Item tree directly,
with Item_cond::add(), which avoids the need for temporary lists and memory
allocation

Note that this patch also provide an extra optimization, that the previous
code in 5.0 did not provide: expressions are flattened in the Item tree,
based on what the expression already parsed is, and not based on the order
in which rules are reduced.

For example : "(a OR b) OR c", "a OR (b OR c)" would both be represented
with 2 Item_cond_or nodes before this patch, and with 1 node only with this
patch. The logic used is based on the mathematical properties of the OR
operator (it's associative), and produces a simpler tree.


sql/item_cmpfunc.h:
  Improved performances for parsing boolean expressions
sql/sql_yacc.yy:
  Improved performances for parsing boolean expressions
mysql-test/r/parser_precedence.result:
  Added test cases to cover boolean operator precedence
mysql-test/t/parser_precedence.test:
  Added test cases to cover boolean operator precedence
2007-08-22 11:05:35 -06:00
unknown
abc02d7e47 Merge adventure.(none):/home/thek/Development/cpp/bug30269/my50-bug30269
into  adventure.(none):/home/thek/Development/cpp/mysql-5.0-runtime


mysql-test/r/query_cache.result:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
2007-08-21 17:47:06 +02:00
unknown
521529be29 Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-08-21 17:57:48 +05:00
unknown
3a5a0ea392 Bug#30269 Query cache eats memory
Although the query cache doesn't support retrieval of statements containing
column level access control, it was still possible to cache such statements
thus wasting memory.
  
This patch extends the access control check on the target tables to avoid
caching a statement with column level restrictions. 

Views are excepted and can be cached but only retrieved by super user account.


mysql-test/t/query_cache_with_views.test:
  Rename: mysql-test/t/view_query_cache.test -> mysql-test/t/query_cache_with_views.test
mysql-test/r/query_cache_with_views.result:
  Rename: mysql-test/r/view_query_cache.result -> mysql-test/r/query_cache_with_views.result
mysql-test/r/query_cache.result:
  Modified test case to allow caching of views
mysql-test/t/query_cache.test:
  Modified test case to allow caching of views
sql/sql_cache.cc:
  Allow caching of views
2007-08-21 13:43:09 +02:00
unknown
a9322f2e57 Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt


sql/sql_base.cc:
  Auto merged
2007-08-21 16:31:30 +05:00
unknown
63a95f331a Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-08-21 16:14:46 +05:00
unknown
3c52b2b3a8 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-rt-merge


sql/sql_base.cc:
  Auto merged
sql/sql_handler.cc:
  Auto merged
2007-08-20 10:45:16 -06:00
unknown
77115cddc9 Merge bk-internal:/home/bk/mysql-5.0-maint
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint
2007-08-20 13:48:27 +02:00
unknown
e878be4cc9 Merge pilot.(none):/data/msvensson/mysql/work/my50-work
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint


mysql-test/mysql-test-run.pl:
  Auto merged
2007-08-20 13:46:57 +02:00
unknown
d48e35b983 Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-08-20 11:25:45 +05:00
unknown
29ee5ed0a0 Bug#27629 Possible security flaw in INFORMATION_SCHEMA and SHOW statements
added SUPER_ACL check for I_S.TRIGGERS


mysql-test/r/information_schema.result:
  result fix
mysql-test/r/information_schema_db.result:
  result fix
mysql-test/t/information_schema.test:
  test case
sql/sql_show.cc:
  added SUPER_ACL check for I_S.TRIGGERS
2007-08-20 11:23:08 +05:00
unknown
c68c271a5f Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50
2007-08-18 00:35:41 -06:00
unknown
3ff2699500 Merge adventure.(none):/home/thek/Development/cpp/bug30269/my50-bug30269
into  adventure.(none):/home/thek/Development/cpp/mysql-5.0-runtime


mysql-test/r/query_cache.result:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
2007-08-17 17:27:41 +02:00
unknown
bd80048fdb Bug #30269 Query cache eats memory
Although the query cache doesn't support retrieval of statements containing
column level access control, it was still possible to cache such statements
thus wasting memory.

This patch extends the access control check on the target tables to avoid
caching a statement with column level restrictions. 


mysql-test/r/query_cache.result:
  Added test
mysql-test/t/query_cache.test:
  Added test
sql/sql_cache.cc:
  The function check_table_access leaves the artifact
  grant.want_privileges= 1, if a statement refers to tables with column level
  privileges. To avoid the statement from being stored into the query cache,
  it is enough to check this flag and set 'safe_to_cache_query' to zero.
sql/sql_cache.h:
  - Removed 'static' attribute or class methods
  - Added THD parameter to process_and_count_tables
2007-08-17 16:55:20 +02:00
unknown
d280a06e36 Bug#30245: A wrong type of a BIT field is reported when grouped by it.
HEAP tables can't index BIT fields. Due to this when grouping by such fields is
needed they are converted to a fields of the LONG type when temporary table
is being created. But a side effect of this is that a wrong type of BIT
fields is returned to a client.

Now the JOIN::prepare and the create_distinct_group functions are create
additional hidden copy of BIT fields to preserve original fields untouched.
New hidden fields are used for grouping instead.


mysql-test/t/type_bit.test:
  Added a test case for the bug#30245: A wrong type of a BIT field is reported when grouped by it.
mysql-test/r/type_bit.result:
  Added a test case for the bug#30245: A wrong type of a BIT field is reported when grouped by it.
sql/sql_select.cc:
  Bug#30245: A wrong type of a BIT field is reported when grouped by it.
  Now the JOIN::prepare and the create_distinct_group functions are create
  additional hidden copy of BIT fields to preserve original fields untouched.
  New hidden fields are used for grouping instead.
2007-08-17 18:30:41 +04:00
unknown
92abaeee0c Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug30396
2007-08-16 21:04:28 -07:00
unknown
f4a163c3a5 Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/data0/mhansson/my50-bug28570


sql/opt_range.cc:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Bug#28570: Manual Merge
mysql-test/t/innodb_mysql.test:
  Bug#28570: Manual Merge
2007-08-16 14:13:07 +02:00
unknown
7ea03f33bd Merge dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.0/mysql-5.0-ndb
into  dev3-240.dev.cn.tlan:/home/justin.he/mysql/mysql-5.0/mysql-5.0-ndb-bj.merge


sql/ha_ndbcluster.cc:
  Auto merged
2007-08-16 11:06:41 +08:00
unknown
0739c70ecd Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50
2007-08-15 15:48:03 -06:00
unknown
c6f10a562d Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
2007-08-15 21:26:47 +02:00
unknown
a8f8e5483e Fixed bug #30396.
The bug caused memory corruption for some queries with top OR level
in the WHERE condition if they contained equality predicates and 
other sargable predicates in disjunctive parts of the condition.

The corruption happened because the upper bound of the memory
allocated for KEY_FIELD and SARGABLE_PARAM internal structures
containing info about potential lookup keys was calculated incorrectly
in some cases. In particular it was calculated incorrectly when the
WHERE condition was an OR formula with disjuncts being AND formulas
including equalities and other sargable predicates.


mysql-test/r/select.result:
  Added a test case for bug #30396.
mysql-test/t/select.test:
  Added a test case for bug #30396.
sql/item_cmpfunc.h:
  Removed max_members from the COND_EQUAL class as not useful anymore.
sql/sql_base.cc:
  Added the max_equal_elems field to the st_select_lex structure.
sql/sql_lex.cc:
  Added the max_equal_elems field to the st_select_lex structure.
sql/sql_lex.h:
  Added the max_equal_elems field to the st_select_lex structure.
  The field contains the maximal number of elements in multiple equalities
  built for the query conditions.
sql/sql_select.cc:
  Fixed bug #30396.
  The bug caused memory corruption for some queries with top OR level
  in the WHERE condition if they contained equality predicates and 
  other sargable predicates in disjunctive parts of the condition.
  
  The corruption happened because the upper bound of the memory
  allocated for KEY_FIELD and SARGABLE_PARAM internal structures
  containing info about potential lookup keys was calculated incorrectly
  in some cases. In particular it was calculated incorrectly when the
  WHERE condition was an OR formula with disjuncts being AND formulas
  including equalities and other sargable predicates.
   
  The max_equal_elems field to the st_select_lex structure is used now
  to calculate the above mentioned upper bound. The field contains the
  maximal number of elements in multiple equalities built for the query
  conditions.
2007-08-15 10:24:18 -07:00
unknown
9b460fb47c Merge lzhou@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb-bj
into  dev3-63.(none):/home/zhl/mysql/mysql-5.0/bug29674
2007-08-15 16:28:27 +00:00
unknown
9c1ffac09a Bug#25856 (HANDLER table OPEN in one connection lock DROP TABLE in another one)
mysql_ha_open calls mysql_ha_close on the error path (unsupported) to close the (opened) table before inserting it into the tables hash list handler_tables_hash) but mysql_ha_close only closes tables which are on the hash list, causing the table to be left open and locked.

This change moves the table close logic into a separate function that is always called on the error path of mysql_ha_open or on a normal handler close (mysql_ha_close).


mysql-test/r/handler.result:
  Bug#25856 test result
mysql-test/t/handler.test:
  Bug#25856 test case
sql/sql_handler.cc:
  Move the table close logic into a separate function that is always called on the error path of mysql_ha_open or on a normal handler close
2007-08-15 12:13:34 -03:00
unknown
01f8130aa6 bug#28570: handler::index_read() is called with different find_flag when
ORDER BY is used

The range analysis module did not correctly signal to the 
handler that a range represents a ref (EQ_RANGE flag). This causes 
non-range queries like 
SELECT ... FROM ... WHERE keypart_1=const, ..., keypart_n=const 
ORDER BY ... FOR UPDATE
to wait for a lock unneccesarily if another running transaction uses
SELECT ... FOR UPDATE on the same table.

Fixed by setting EQ_RANGE for all range accesses that represent 
an equality predicate. 


mysql-test/r/innodb_mysql.result:
  bug#28570: Test Result
mysql-test/t/innodb_mysql.test:
  bug#28570: Test Case
sql/handler.cc:
  bug#28570: Updated comment
sql/opt_range.cc:
  bug#28570: Removed the criterion that key has to be unique (HA_NOSAME) in 
  order for the EQ_RANGE flag to be set. It is sufficient that the range 
  represent a ref access.
2007-08-15 09:23:44 +02:00
unknown
b76fd3ed3b Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb


sql/ha_ndbcluster.cc:
  Auto merged
2007-08-14 15:34:04 +02:00
unknown
6656d39c72 Backport Magnus' fix from 5.1
ChangeSet@1.2575, 2007-08-07 19:16:06+02:00, msvensson@pilot.(none) +2 -0
  Bug#26793 mysqld crashes when doing specific query on information_schema
   - Drop the newly created user user1@localhost
   - Cleanup testcase


mysql-test/r/ndb_bug26793.result:
    mysql-test/r/ndb_bug26793.result@1.3, 2007-08-07 19:16:04+02:00, msvensson@pilot.(none)
  +1 -6
      Update test result
mysql-test/t/ndb_bug26793.test:
    mysql-test/t/ndb_bug26793.test@1.3, 2007-08-07 19:16:04+02:00, msvensson@pilot.(none) +8
  -11
      - Remove the drop/restore of anonymous users - there are no such users
      by default anymore(if there were, they would probably be in mysql.user)
      - Switch back to default connection before cleanup 
      - Drop user1@localhost as part of cleanup
2007-08-14 15:07:17 +10:00
unknown
db53902678 Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50
2007-08-13 12:46:02 -06:00
unknown
a40202e696 bug#30337 DELETE ... WHERE PK IN (..) and AFTER DELETE trigger crashes API node: Added testcase 2007-08-13 15:59:08 +02:00
unknown
65fa527a27 Improve error messages
Write test results to var/log
Add test for "source" and variable expansion


client/mysqltest.c:
  Improve error messages
  Write .reject file to the location specified by --logdir
mysql-test/mysql-test-run.pl:
  Pass logdir to mysqltest, to get test results written to var/log
mysql-test/r/mysqltest.result:
  Update test results
mysql-test/t/mysqltest.test:
  Add test for "source" and variable expansion
  Update test after writing result in var/log
2007-08-13 15:46:11 +02:00
unknown
c2f6f8b6aa Merge bk-internal:/home/bk/mysql-5.0-maint
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint


mysql-test/mysql-test-run.pl:
  Auto merged
2007-08-13 11:29:58 +02:00
unknown
5c5233cd2b Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-08-11 01:32:04 +05:00
unknown
ff985f0690 Merge 192.168.0.7:mysql/mysql-5.0-maint
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint


client/mysqltest.c:
  Auto merged
mysql-test/t/mysqltest.test:
  Auto merged
2007-08-08 18:03:56 +02:00
unknown
ddbf9fdc1c Don't require a space between "if" and "(". This should
also fix "while" and "connect"
It's now possible to write "if("


client/mysqltest.c:
  Don't require a space between for example "if" and "(". This should
  also fix "while" and "connect"
mysql-test/t/mysqltest.test:
  Remove space between if and ( to check it works
2007-08-08 18:03:44 +02:00
unknown
365b21b307 Merge 192.168.0.7:mysql/mysql-5.0-maint
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint


client/mysqltest.c:
  Auto merged
mysql-test/t/mysqltest.test:
  Auto merged
mysql-test/r/mysqltest.result:
  SCCS merged
2007-08-08 16:47:35 +02:00
unknown
5501f528f5 Remove extra newline added to files created by write_file and append_file
client/mysqltest.c:
  - Remove the extra newline first in the file produced by
    write_file and append_file
  - Add check for too many arguments passed to 'check_command_args'
mysql-test/r/mysqltest.result:
  Update test result
mysql-test/t/mysqltest.test:
  Add test to check that no extra newline is created
2007-08-08 16:44:01 +02:00
unknown
e6701d746d Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.(none):/opt/local/work/mysql-5.0-runtime


mysql-test/r/federated.result:
  Auto merged
mysql-test/t/federated.test:
  Auto merged
sql/item.cc:
  Auto merged
2007-08-08 11:34:35 +04:00
unknown
4c23e5f373 BUG#29674 Restore/backup are endian compatible in 5.0
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Twiddle the "replicaCount" and "fragCount" variable when restore data from different endian.
ndb/src/ndbapi/NdbDictionaryImpl.hpp:
  Add byte order variable
ndb/tools/restore/Restore.cpp:
  Twiddle blob, datatime,timestamp when do restore in different endian.
mysql-test/r/ndb_restore_different_endian_data.result:
  Test case result for restore data from different endian
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1-0.1.Data:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1-0.2.Data:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.1.ctl:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.1.log:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.2.ctl:
  Test case data
mysql-test/std_data/ndb_backup50_data_be/BACKUP-1.2.log:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1-0.1.Data:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1-0.2.Data:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.1.ctl:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.1.log:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.2.ctl:
  Test case data
mysql-test/std_data/ndb_backup50_data_le/BACKUP-1.2.log:
  Test case data
mysql-test/t/ndb_restore_different_endian_data.test:
  Test case for restore data from different endian
2007-08-07 18:07:57 +00:00
unknown
c6e8889946 Reversing additional change suggested by Serg
under terms of bug#28875 for better performance.
The change appeared to require more changes in item_cmpfunc.cc,
which is dangerous in 5.0.
    
Conversion between a latin1 column and an ascii string constant
stopped to work.


mysql-test/r/ctype_recoding.result:
  Adding test case.
mysql-test/t/ctype_recoding.test:
  Adding test case.
2007-08-07 19:25:45 +05:00
unknown
db73e34fb8 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint


strings/ctype-extra.c:
  Auto merged
2007-08-07 06:53:40 -04:00
unknown
81536446cd Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug27562/my50-bug27562
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
2007-08-07 06:52:34 -04:00
unknown
26e4ea620b Merge 192.168.0.7:mysql/mysql-5.0-maint
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint


client/mysqltest.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/mysqltest.result:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/t/mysqltest.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
2007-08-07 11:58:00 +02:00
unknown
04e8c93c20 Bug#20037 mysqltest requires cygwin on windows(part 1, new mysqltest commands)
- Update comments
 - Make "write_file" fail if file already exist
 - Remove temporary files created by test cases


client/mysqltest.c:
  Improve function comments
  Make write_file fail if file already exist
mysql-test/r/mysqltest.result:
  Update test result after adding new test and updating description
  of argumements to chmod
mysql-test/t/bootstrap.test:
  Remove temporary file created by testcase
mysql-test/t/mysql.test:
  Remove temporary file created by testcase
mysql-test/t/mysqladmin.test:
  Remove temporary file created by testcase
mysql-test/t/mysqltest.test:
  Remove temporary file created by testcase 
  Add test to show that "write_file" fails if file already exist
mysql-test/t/sp-destruct.test:
  Remove temporary file created by testcase
2007-08-07 11:40:03 +02:00
unknown
cfd34fe232 Bug#27562: ascii.xml invalid?
Two character mappings were way off (backtick and tilde were "E"
and "Y"!), and three others were slightly rotated.  The first 
would cause collisions, and the latter was probably benign.

Now, assign the character mappings exactly to their normal values.


sql/share/charsets/ascii.xml:
  Change the character mapping for 
   "`" to "`" (was "E") and 
   "[" to "[" (was "\") and 
   "\" to "\" (was "]") and
   "]" to "]" (was "[") and 
   "~" to "~" (was "Y").
strings/ctype-extra.c:
  Generated from charsets directory.
mysql-test/r/ctype_ascii.result:
  Add new test file.
  
  Test all combinations of printable letter comparisons for 
  similarity.
mysql-test/t/ctype_ascii.test:
  Add new test file.
  
  Test all combinations of printable letter comparisons for 
  similarity.
2007-08-07 05:35:20 -04:00
unknown
2d49f43750 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B29536-5.0-opt
2007-08-06 06:37:05 -07:00
unknown
1f83b35181 Bug #29536: timestamp inconsistent in replication around 1970
MySQL replicates the time zone only when operations that involve
it are performed. This is controlled by a flag. But this flag
is set only on successful operation.
The flag must be set also when there is an error that involves
a timezone (so the master would replicate the error to the slaves). 

Fixed by moving the setting of the flag before the operation
(so it apples to errors as well).


mysql-test/r/rpl_timezone.result:
  Bug #29536: test case
mysql-test/t/rpl_timezone.test:
  Bug #29536: test case
sql/field.cc:
  Bug #29536: move setting of the flag before the operation
  (so it apples to errors as well).
sql/time.cc:
  Bug #29536: move setting of the flag before the operation
  (so it apples to errors as well).
2007-08-06 04:57:28 -07:00
unknown
050256c2d7 Remove NOT_YET code
Update comments
Add more tests for "let from query"


client/mysqltest.c:
  Remove NOT_YET code
  Update comments
mysql-test/r/mysqltest.result:
  Add more tests for "let from query"
mysql-test/t/mysqltest.test:
  Add more tests for "let from query"
2007-08-06 11:20:36 +02:00
unknown
1d139a6565 Removed a query from the test case for bug 39219 that displayed in valgrind
a problem for BIT type values different from the one reported for the bug.
2007-08-06 01:01:22 -07:00
unknown
b75ff08194 Merge bk-internal:/home/bk/mysql-5.0-maint
into  shellback.(none):/home/msvensson/mysql/mysql-5.0-maint


mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
2007-08-06 09:41:24 +02:00
unknown
e106b09ad3 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug30219
2007-08-05 14:21:36 -07:00
unknown
4e6e122061 Fix bug #30219.
This bug manifested itself for queries with grouping by columns of
the BIT type. It led to wrong comparisons of bit-field values and
wrong result sets.
Bit-field values never cannot be compared as binary values. Yet
the class Field_bit had an implementation of the cmp method that
compared bit-fields values as binary values. 
Also the get_image and set_image methods of the base class Field 
cannot be used for objects of the Field_bit class. 
Now these methods are declared as virtual and specific implementations
of the methods are provided for the class Field_bit.


mysql-test/r/type_bit.result:
  Added a test case for bug #30219.
mysql-test/t/type_bit.test:
  Added a test case for bug #30219.
sql/field.h:
  Fix bug #30219.
  This bug manifested itself for queries with grouping by columns of
  the BIT type. It led to wrong comparisons of bit-field values and
  wrong result sets.
  Bit-field values never cannot be compared as binary values. Yet
  the class Field_bit had an implementation of the cmp method that
  compared bit-fields values as binary values.
  Also the get_image and set_image methods of the base class Field
  cannot be used for objects of the Field_bit class. 
  Now these methods are declared as virtual and specific implementations
  of these methods are provided for the class Field_bit.
2007-08-05 14:16:49 -07:00
unknown
983cda8d36 Merge olga.mysql.com:/home/igor/mysql-5.0
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-merge


sql/mysqld.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
2007-08-04 20:53:26 -07:00
unknown
6c1edb11d4 Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-2team


mysql-test/r/func_time.result:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2007-08-03 18:59:16 +02:00
unknown
942cb3e1d1 Merge 192.168.0.7:mysql/mysql-5.0-maint
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint


mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/lib/mtr_report.pl:
  SCCS merged
2007-08-03 13:15:03 +02:00
unknown
71c3c0cfd5 Bug #25228: rpl_relayspace.test fails on powermacg5, vm-win2003-32-a
A test case was waiting for a fixed number of seconds for a specific 
state of the slave IO thread to take place.
Fixed by waiting in a loop for that specific thread state instead 
(or timeout).


mysql-test/t/rpl_relayspace.test:
  Bug #25228: fixed test case
2007-08-03 14:14:33 +03:00
unknown
2cedc54d33 WL#3935 Improve mysqltest report and exitcode for diff
- Move the code to generate test report to the test tool(in this
   case mysqltest) where the best control of what failed is
- Simplify the code in mysql-test-run.pl
- mysqltest will now find what diff to use in a best effort attempt
  using "diff -u", "diff -c" and finally dumping the two files verbatim
  in the report.


client/mysqltest.c:
  - Add new option --tail-lines indicating how many lines of the result to output
    when generating report for a failure
  - Remove eval_result, noone knows what it should do and it's not used.
  - Add support for best effort execution of systems builtin "diff",
    try with "diff -u" and "diff -c" and if that fails dump the whole content
     of teh two files to report
  - Use one common function when comapring two files, used when test 
    has completed and the result should be compared to the .result file
    as well as using it from myqltest's builtin diff_files command.
  - Output the last lines og the result so far  in the report that mysqltest
    generates in case of a test failure.
mysql-test/lib/mtr_report.pl:
  - Remove code for generating diff between .reject and .result file,
    that is handled by mysqltest(or the test tool) from now on.
  - Add better comments
mysql-test/mysql-test-run.pl:
  - Remove the --udiff flag to mysql-test-run.pl, if the systems diff supports
    unified diff it will be used automatically
  - Remove the code for "mtr_show_failed_diff", the report from mysqltest
    will know include the diff so if mysqltest(or another test tool)
    fails, just display it's report what went wrong
  - Pass --tail-lines=20 to mysqltest to it will shos the last 20 lines 
    from the result in the report in case of failure.	
mysql-test/r/mysqltest.result:
  Update result file now when the output from mysqltest has been sent to /dev/null
mysql-test/t/mysqltest.test:
  - Improve tests for --diff_files
  - Remove temporary files in var/tmp generated in the fly
  - Send output from test for --diff_files to /deb/null since only the error
    code it returns are of interest and tyhe outpu may vary depending
    on what builtin diff is being used.
2007-08-03 13:12:53 +02:00
unknown
02d18d3cf9 Merge 192.168.0.7:mysql/mysql-5.0-maint
into  pilot.(none):/data/msvensson/mysql/mysql-5.0-maint


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
2007-08-03 12:57:09 +02:00
unknown
8b265ffcc1 Cleanup created procedures in sp.test
mysql-test/r/sp.result:
  Cleanup created procedures
mysql-test/t/sp.test:
  Cleanup created procedures
2007-08-03 12:56:45 +02:00
unknown
0d1972aa72 Merge mysql.com:/home/bar/mysql-work/mysql-5.0.b28875
into  mysql.com:/home/bar/mysql-work/mysql-5.0-rpl


mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
strings/conf_to_src.c:
  Auto merged
strings/ctype-extra.c:
  Auto merged
mysql-test/r/ctype_ucs.result:
  After merge fix
mysql-test/t/ctype_ucs.test:
  After merge fix
2007-08-03 15:30:31 +05:00
unknown
53df09a9a6 Bug#28875 Conversion between ASCII and LATIN1 charsets does not function
(Regression, caused by a patch for the bug 22646).
Problem: when result type of date_format() was changed from
binary string to character string, mixing date_format()
with a ascii column in CONCAT() stopped to work.
Fix:
- adding "repertoire" flag into DTCollation class,
to mark items which can return only pure ASCII strings.
- allow character set conversion from pure ASCII to other character sets.


include/m_ctype.h:
  Defining new flags.
  Adding new function prototypes.
mysql-test/r/ctype_ucs.result:
  Adding tests.
mysql-test/r/ctype_utf8.result:
  Adding tests.
mysql-test/r/func_time.result:
  Adding tests.
mysql-test/t/ctype_ucs.test:
  Adding tests.
mysql-test/t/ctype_utf8.test:
  Adding tests.
mysql-test/t/func_time.test:
  Adding test.
mysys/charset.c:
  Adding pure ASCII detection when loading a dynamic character set.
sql/item.cc:
  - Moving detection of a Unicode superset into function.
  - Adding detection of a ASCII subset.
  - Adding creation of to-ASCII character set convertor when
    safe_charset_converter() failed and when the argument.
    repertoire is know to be pure ASCII.
sql/item.h:
  - Adding "repertoire" member into DTCollation class.
  - Adding "repertoire" argument to constructors.
  - Adding new methods:
    set_repertoire_from_charset()
    set_repertoire_from_value()
sql/item_func.cc:
  Adding "repertoire" argument.
sql/item_strfunc.cc:
  Adding "repertoire" argument.
sql/item_timefunc.cc:
  Initializing the result repertoire taking into account the "is_ascii"
  flag of the current locale.
sql/sql_lex.cc:
  Detect 7bit strings, return in Lex->text_string_is_7bit.
sql/sql_lex.h:
  Adding new member into LEX structure.
  Adding new member into Lex_input_stream
sql/sql_string.cc:
  Allow simple copy from pure ASCII to a ASCII-based character set.
sql/sql_yacc.yy:
  Depening on Lex->text_string_is_7bit and character set features,
  create Item_string with MY_REPERTOIRE_ASCII when it is possible.
strings/conf_to_src.c:
  - Adding printing of the "MY_CS_PUREASCII" flag
  - Adding printing of copyright
strings/ctype-extra.c:
  Recreating ctype-extra.c: ascii_general_ci and ascii_bin
  are now marked with MY_CS_PUREASCII flag.
strings/ctype.c:
  Adding new functions.
2007-08-03 15:25:23 +05:00
unknown
30f63c14d1 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-27352
into  gleb.loc:/home/uchum/work/bk/5.0-opt


sql/sql_parse.cc:
  Auto merged
2007-08-03 02:03:01 +05:00
unknown
a53510f0be Fixed bug #27352.
The SELECT query with more than 31 nested dependent SELECT queries returned
wrong result.

New error message has been added: ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT.
It will be reported as: "Too high level of nesting for select".


sql/sql_parse.cc:
  Fixed bug #27352.
  The Item_sum::register_sum_func method has been modified to return
  TRUE on exceeding of allowed level of SELECT nesting and to report
  corresponding error message.
sql/unireg.h:
  Fixed bug #27352.
  Constant definition has been added: maximal allowed level of SELECT nesting.
mysql-test/t/select.test:
  Updated test case for bug #27352.
mysql-test/r/select.result:
  Updated test case for bug #27352.
sql/share/errmsg.txt:
  Fixed bug #27352.
  New error message has been added: ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT.
2007-08-03 01:58:21 +05:00
unknown
9687988e83 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/ram/work/b30088/b30088.5.0


mysql-test/r/show_check.result:
  Auto merged
mysql-test/t/show_check.test:
  Auto merged
2007-08-02 18:23:23 +05:00
unknown
90d6229652 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50


sql/handler.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.cc:
  Auto merged
2007-08-01 18:39:13 -06:00
unknown
41ac5d83b2 Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50


mysql-test/r/federated.result:
  Auto merged
mysql-test/t/federated.test:
  Auto merged
sql/ha_federated.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Manual merge
mysql-test/t/innodb_mysql.test:
  Manual merge
2007-08-01 18:14:50 -06:00
unknown
586304c814 Add a test case for Bug#18287 create federated table always times out,
error 1159 ' ' (fixed by the patch for Bug 25679)


mysql-test/r/federated.result:
  Update results (Bug#18287)
mysql-test/t/federated.test:
  Add a test case for Bug#18287 create federated table always times out,
   error 1159 ' '
2007-08-02 03:32:54 +04:00
unknown
f87acb594a Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out

Problem: using "mysqlbinlog | mysql" for recoveries the connection_id() 
result may differ from what was used when issuing the statement.

Fix: if there is a connection_id() in a statement, write to binlog
SET pseudo_thread_id= XXX; before it and use the value later on.


mysql-test/r/mysqlbinlog.result:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - test result.
mysql-test/t/mysqlbinlog.test:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - test case.
sql/item_create.cc:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - set thread_specific_used flag for the connection_id() function.
sql/item_func.cc:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - always return thd->variables.pseudo_thread_id as a connection_id() 
  result, as it contains a proper value for both master and slave.
sql/log_event.cc:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - set LOG_EVENT_THREAD_SPECIFIC_F event flag if thread_specific_used
  is set.
sql/sql_class.cc:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - thd->thread_specific_used introduced, which is set if thread specific 
  value(s) used in a statement.
sql/sql_class.h:
  Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect 
  restores from mysqlbinlog out
    - thd->thread_specific_used introduced, which is set if thread specific 
  value(s) used in a statement.
2007-08-01 15:27:03 +05:00
unknown
25723542a1 Fix an unstable test. It was reliant on the current time.
mysql-test/r/func_time.result:
  Update results (use fixed datetime values instead of NOW()).
mysql-test/t/func_time.test:
  Use fixed datetime values instead of NOW(): the test would have a sporadic
  failure when current day changed between two consequtive calls to
  NOW(). The test actually tests FROM_DAYS/TO_DAYS functions, 
  so use of NOW() is not necessary.
2007-08-01 12:28:08 +04:00
unknown
1281fbc58c Fix for bug #30088: Can't disable myisam-recover by a value of "".
- test result.

Problem: we don't proper handle "" value of the --myisam-recover option.

Fix: turn off myisam recovering if --myisam-recover="" is set.


mysql-test/r/show_check.result:
  Fix for bug #30088: Can't disable myisam-recover by a value of "".
    - test result.
mysql-test/t/show_check-master.opt:
  Fix for bug #30088: Can't disable myisam-recover by a value of "".
    - test case.
mysql-test/t/show_check.test:
  Fix for bug #30088: Can't disable myisam-recover by a value of "".
    - test case.
sql/mysqld.cc:
  Fix for bug #30088: Can't disable myisam-recover by a value of "".
    - turn off myisam recovering if --myisam-recover="" is passed.
2007-08-01 11:41:13 +05:00
unknown
91f54bf1f7 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.(none):/opt/local/work/mysql-5.0-runtime


client/mysqldump.c:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/table.cc:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Manual merge.
mysql-test/t/innodb_mysql.test:
  Manual merge.
sql/sql_table.cc:
  Manual merge.
2007-07-31 20:03:52 +04:00
unknown
125bc936ac Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B27417-5.0-opt


sql/handler.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
2007-07-31 15:23:25 +03:00
unknown
a9610aa0e1 Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/hf/work/29717/my50-29717
2007-07-31 11:53:56 +05:00
unknown
465c3ef060 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-30120
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-07-31 11:16:11 +05:00
unknown
e1dee88ab1 Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-07-31 11:14:53 +05:00
unknown
2dc02f2424 Merge mysql.com:/home/hf/work/29717/my41-29717
into  mysql.com:/home/hf/work/29717/my50-29717


mysql-test/t/insert_select.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/group_by.result:
  merging
mysql-test/r/insert_select.result:
  merging
mysql-test/t/group_by.test:
  merging
sql/sql_select.h:
  merging
2007-07-31 11:03:31 +05:00
unknown
6b745cf601 Merge mysql.com:/home/hf/work/029717/my41-29717
into  mysql.com:/home/hf/work/29717/my41-29717


sql/sql_select.cc:
  Auto merged
2007-07-31 11:00:19 +05:00
unknown
791584ae0d Bug #29717 INSERT INTO SELECT inserts values even if
SELECT statement itself returns empty.

As a result of this bug 'SELECT AGGREGATE_FUNCTION(fld) ... GROUP BY'
can return one row instead of an empty result set.

When GROUP BY only has fields of constant tables
(with a single row), the optimizer deletes the group_list.
After that we lose the information about whether we had an
GROUP BY statement. Though it's important
as SELECT min(x) from empty_table; and
   SELECT min(x) from empty_table GROUP BY y; have to return
different results - the first query should return one row,
second - an empty result set.
So here we add the 'group_optimized_away' flag to remember this case
when GROUP BY exists in the query and is removed
by the optimizer, and check this flag in end_send_group()


mysql-test/r/group_by.result:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  test result
mysql-test/r/insert_select.result:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  test result
mysql-test/t/group_by.test:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  This is additional testcase that is more basic than the
  original bug's testcase and has the same reason.
mysql-test/t/insert_select.test:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  test case
sql/sql_select.cc:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  Remember the 'GROUP BY was optimized away' case in the JOIN::group_optimized
  and check this in the end_send_group()
sql/sql_select.h:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  JOIN::group_optimized member added to remember the 'GROUP BY optimied away'
  case
2007-07-31 10:46:04 +05:00
unknown
77edfb16e8 bigint.test:
Fixing a typo in the test case.


mysql-test/t/bigint.test:
  Fixing a typo in the test case.
2007-07-30 21:05:56 +05:00
unknown
1307d3b803 (pushing for Andrei)
Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
  
Once had been set the flag might later got reset inside of a stored routine 
execution stack.
The reason was in that there was no check if a new statement started at time 
of resetting.
The artifact affects most of binlogable DML queries. Notice, that multi-update 
is wrapped up within
  bug@27716 fix, multi-delete bug@29136.
  
Fixed with saving parent's statement flag of whether the statement modified 
non-transactional table, and unioning (merging) the value with that was gained 
in mysql_execute_command.
  
Resettling thd->no_trans_update members into thd->transaction.`member`;
Asserting code;
Effectively the following properties are held.
  
1. At the end of a substatement thd->transaction.stmt.modified_non_trans_table
   reflects the fact if such a table got modified by the substatement.
   That also respects THD::really_abort_on_warnin() requirements.
2. Eventually thd->transaction.stmt.modified_non_trans_table will be computed as
   the union of the values of all invoked sub-statements.
   That fixes this bug#27417;

Computing of thd->transaction.all.modified_non_trans_table is refined to base to 
the stmt's value for all the case including insert .. select statement which 
before the patch had an extra issue bug@28960.
Minor issues are covered with mysql_load, mysql_delete, and binloggin of insert in
to temp_table select. 
  
The supplied test verifies limitely, mostly asserts. The ultimate testing is defered
for bug@13270, bug@23333.


mysql-test/r/mix_innodb_myisam_binlog.result:
  results changed
mysql-test/t/mix_innodb_myisam_binlog.test:
  regression test incl the related bug#28960.
sql/ha_ndbcluster.cc:
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
sql/handler.cc:
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
sql/handler.h:
  new member added
sql/log.cc:
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
sql/set_var.cc:
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
sql/sp_head.cc:
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
  
  and saving and merging stmt's flag at the end of a substatement.
sql/sql_class.cc:
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
sql/sql_class.h:
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
sql/sql_delete.cc:
  correcting basic delete incl truncate branch and multi-delete queries to set
  stmt.modified_non_trans_table;
  optimization to set the flag at the end of per-row loop;
  multi-delete still has an extra issue similar to bug#27716 of multi-update 
  - to be address with bug_29136 fix.
sql/sql_insert.cc:
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
sql/sql_load.cc:
  eliminating a separate issue where the stmt flag was saved and re-stored after 
  write_record that actually could change it and the change would be lost but 
  should remain permanent;
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
sql/sql_parse.cc:
  initialization to transaction.stmt.modified_non_trans_table at the common part 
  of all types of statements processing - mysql_execute_command().
sql/sql_table.cc:
  moving the reset up to the mysql_execute_command() caller
sql/sql_update.cc:
  correcting update query case (multi-update part of the issues covered by other 
  bug#27716 fix)
  thd->transaction.{all,stmt}.modified_non_trans_table
  instead of
  thd->no_trans_update.{all,stmt}
2007-07-30 18:27:36 +03:00
unknown
3887705e09 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/24989-bug-5.0-opt-mysql


sql/ha_innodb.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
2007-07-30 18:10:34 +04:00
unknown
9246c37201 Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
When innodb detects a deadlock it calls ha_rollback_trans() to rollback the 
main transaction. But such action isn't allowed from inside of triggers and
functions. When it happen the 'Explicit or implicit commit' error is thrown
even if there is no commit/rollback statements in the trigger/function. This
leads to the user confusion.

Now the convert_error_code_to_mysql() function doesn't call the 
ha_rollback_trans() function directly but rather calls the
mark_transaction_to_rollback function and returns an error.
The sp_rcontext::find_handler() now doesn't allow errors to be caught by the
trigger/function error handlers when the thd->is_fatal_sub_stmt_error flag
is set. Procedures are still allowed to catch such errors.
The sp_rcontext::find_handler function now accepts a THD handle as a parameter.
The transaction_rollback_request and the is_fatal_sub_stmt_error flags are 
added to the THD class. The are initialized by the THD class constructor.
Now the ha_autocommit_or_rollback function rolls back main transaction
when not in a sub statement and the thd->transaction_rollback_request
is set.
The THD::restore_sub_statement_state function now resets the 
thd->is_fatal_sub_stmt_error flag on exit from a sub-statement.


sql/ha_innodb.cc:
  Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
  Now the convert_error_code_to_mysql() function doesn't call the
  ha_rollback_trans() function directly but rather calls the
  mark_transaction_to_rollback function and returns an error.
sql/handler.cc:
  Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
  Now the ha_autocommit_or_rollback function rolls back main transaction
  when not in a sub statement and the thd->transaction_rollback_request
  is set.
mysql-test/r/innodb-big.result:
  Added a test case for the bug#24989: The DEADLOCK error is improperly handled by
  InnoDB.
mysql-test/t/innodb-big.test:
  Added a test case for the bug#24989: The DEADLOCK error is improperly handled by
  InnoDB.
sql/sql_class.h:
  Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
  The transaction_rollback_request and the is_fatal_sub_stmt_error flags are 
  added to the THD class.
sql/sql_class.cc:
  Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
  Initialization of the transaction_rollback_request and the
  is_fatal_sub_stmt_error flags are added to the THD class constructor.
  The mark_transaction_to_rollback function is added.
  The THD::restore_sub_statement_state function now resets the
  thd->is_fatal_sub_stmt_error flag on exit from a sub-statement.
sql/sp_rcontext.h:
  Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
  The sp_rcontext::find_handler function now accepts a THD handle as a parameter.
  The in_sub_stmt flag is added to the sp_rcontext class.
sql/sp_rcontext.cc:
  Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
  The sp_rcontext::find_handler() now doesn't allow errors to be caught by the
  trigger/function error handlers when the thd->is_fatal_sub_stmt_error flag
  is set. Instead it tries to find a most inner procedure that isn't called
  directly or indirectly from any function/trigger.
  Procedures are still allowed to catch such errors.
  The sp_rcontext::find_handler function now accepts a THD handle as a parameter.
2007-07-30 17:14:34 +04:00
unknown
33fc4ad4e1 Fixed bug #30120.
SP with local variables with non-ASCII names crashed the server.

The server replaces SP local variable names with NAME_CONST calls
when putting statements into the binary log. It used UTF8-encoded
item names as variable names for the replacement inside NAME_CONST
calls. However, statement string may be encoded by any
known character set by the SET NAMES statement.
The server used byte length of UTF8-encoded names to increment
the position in the query string that led to array index overrun.


sql/item.cc:
  Fixed bug #30120.
  The Item_splocal class constructor has been modified to
  accept new parameter `len_in_q': the byte length of
  variable name in the query string.
sql/item.h:
  Fixed bug #30120.
  The Item_splocal class has been modified to keep new
  field `len_in_query': the byte length of variable name in
  the query string.
sql/sp_head.cc:
  Fixed bug #30120.
  The subst_spvars function has been modified to increment
  position in the query string by the lengths of not
  encoded variable names instead of byte length of names
  encoded to UTF-8.
sql/sql_yacc.yy:
  Fixed bug #30120.
  The simple_ident rule action has been modified to
  pass the byte length of the local variable name token
  to the Item_splocal object constructor.
mysql-test/t/sp.test:
  Updated test case for bug #30120.
mysql-test/r/sp.result:
  Updated test case for bug #30120.
2007-07-30 04:35:16 +05:00
unknown
d86f0a1382 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/29856-bug-5.0-opt-mysql


sql/sp_head.cc:
  Auto merged
mysql-test/r/query_cache.result:
  SCCS merged
mysql-test/t/query_cache.test:
  SCCS merged
2007-07-28 22:47:03 +04:00
unknown
ba9e6a5673 Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-07-28 23:47:02 +05:00
unknown
3c1716151e Merge gleb.loc:/home/uchum/work/bk/5.0-opt-29834
into  gleb.loc:/home/uchum/work/bk/5.0-opt


sql/sql_base.cc:
  Auto merged
mysql-test/r/sp.result:
  Merge with local tree.
mysql-test/t/sp.test:
  Merge with local tree.
2007-07-28 23:36:27 +05:00
unknown
90c5621d6c Fixed bug #29834.
Using view columns by their names during an execution of
a prepared SELECT statement or a SELECT statement inside
a SP caused a memory leak.


sql/sql_base.cc:
  Fixed bug #29834.
  The find_field_in_view function has been modified to
  use the execution memory root for the Item_direct_view_ref
  objects allocation at non-first executions of
  a PS/SP instead of the statement memory.
mysql-test/t/sp.test:
  Updated test case for bug #29834.
mysql-test/r/sp.result:
  Updated test case for bug #29834.
2007-07-28 23:10:38 +05:00
unknown
da2652884c Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/30020-bug-5.0-opt-mysql
2007-07-28 21:39:03 +04:00
unknown
bb2d58f5e4 Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-07-28 21:24:19 +05:00
unknown
aa4a3c9ad0 Bug#30020: Insufficient check led to a wrong info provided by the
information schema table.

The get_schema_views_record() function fills records in the view table of
the informations schema with data about given views. Among other info
the is_updatable flag is set. But the check whether the view is updatable or
not wasn't covering all cases thus sometimes providing wrong info.
This might led to a user confusion.

Now the get_schema_views_record function additionally calls to the 
view->can_be_merge() function to find out whether the view can be updated or
not.


mysql-test/t/view.test:
  Added a test case for the bug#30020: Insufficient check led to a wrong info
  provided by the information schema table.
mysql-test/r/view.result:
  Added a test case for the bug#30020: Insufficient check led to a wrong info
  provided by the information schema table.
sql/sql_show.cc:
  Bug#30020: Insufficient check led to a wrong info provided by the
  information schema table.
  Now the get_schema_views_record function additionally calls to the 
  view->can_be_merge() function to find out whether the view can be updated or
  not.
2007-07-28 16:02:29 +04:00
unknown
40d596c200 Bug#29856: Insufficient buffer space led to a server crash.
The subst_spvars function is used to create query string with SP variables 
substituted with their values. This string is used later for the binary log
and for the query cache. The problem is that the
query_cache_send_result_to_client function requires some additional space
after the query to store database name and query cache flags. This 
space wasn't reserved by the subst_spvars function which led to a memory
corruption and crash.

Now the subst_spvars function reserves additional space for the query cache.


mysql-test/t/query_cache.test:
  Added a test case for the bug#29856: Insufficient buffer space led to a server crash.
mysql-test/r/query_cache.result:
  Added a test case for the bug#29856: Insufficient buffer space led to a server crash.
sql/sp_head.cc:
  Bug#29856: Insufficient buffer space led to a server crash.
  Now the subst_spvars function reserves additional space for the query cache.
2007-07-28 15:01:29 +04:00
unknown
0ce785538f Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/29878/my50-29878
2007-07-28 01:33:03 +05:00