Commit graph

11974 commits

Author SHA1 Message Date
Davi Arnaut
017307f216 Bug#38823: Invalid memory access when a SP statement does wildcard expansion
The problem is that field names constructed due to wild-card
expansion done inside a stored procedure could point to freed
memory if the expansion was performed after the first call to
the stored procedure.

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

mysql-test/r/sp.result:
  Add test case result for Bug#38823
mysql-test/t/sp.test:
  Add test case for Bug#38823
sql/item.cc:
  Remark that this also impacts wildcard expansion inside SPs.
2008-10-14 11:04:36 -03:00
Georgi Kodinov
9b6347f0ab merged 5.0-main -> 5.0-bugteam 2008-10-10 17:27:16 +03:00
Gleb Shchepa
097b60bd06 Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
Select with a "NULL NOT IN" condition containing complex
subselect from the same table as in the outer select failed
with an assertion.


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

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


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


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

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

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


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


mysql-test/r/metadata.result:
  Added test case for bug #39283.
mysql-test/t/metadata.test:
  Added test case for bug #39283.
sql/sql_select.cc:
  Bug #39283: Date returned as VARBINARY to client for queries
              with COALESCE and JOIN
  
  To create a column of various date/time types in a
  temporary table the create_tmp_field_from_item() function
  uses the Item::tmp_table_field_from_field_type() method
  call. However, fields of the MYSQL_TYPE_NEWDATE type were
  missed there, and the VARBINARY columns were created
  by default.
  Necessary condition has been added.
2008-10-10 15:13:12 +05:00
Gleb Shchepa
a83f5b18ef Bug#38499: flush tables and multitable table update with
derived table cause crash

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

Extra cleanup has been added.


mysql-test/r/lock_multi.result:
  Added test case for bug #38499.
mysql-test/t/lock_multi.test:
  Added test case for bug #38499.
sql/sql_union.cc:
  Bug#38499: flush tables and multitable table update with
             derived table cause crash
  
  Obsolete assertion has been removed.
sql/sql_update.cc:
  Bug#38499: flush tables and multitable table update with
             derived table cause crash
  
  Extra cleanup for derived tables has been added:
  1) unit.cleanup(),
  2) unit->reinit_exec_mechanism().
2008-10-09 20:24:31 +05:00
Kristofer Pettersson
f985e78775 Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
When running Stored Routines the Status Variable "Questions" was wrongly
incremented. According to the manual it should contain the "number of
statements that clients have sent to the server"
              
Introduced a new status variable 'questions' to replace the query_id
variable which currently corresponds badly with the number of statements
sent by the client.
            
The new behavior is ment to be backward compatible with 4.0 and at the
same time work with new features in a similar way.
            
This is a backport from 6.0

mysql-test/r/status2.result:
  Added test case
mysql-test/t/status2.test:
  Added test case
sql/mysqld.cc:
  Introduced a new status variable 'questions' to replace the query_id
  variable which currently corresponds badly with the number of statements
  sent by the client.
sql/sql_class.h:
  Introduced a new status variable 'questions' to replace the query_id
  variable which currently corresponds badly with the number of statements
  sent by the client.
sql/sql_parse.cc:
  To be backward compatible with 4.0 and at the same time extend the 
  interpretation of the Question variable, it should be increased on
  all COM-commands but COM_STATISTICS, COM_PING, COM_STMT_PREPARE,
  COM_STMT_CLOSE and COM_STMT_RESET.
  Since COM_QUERY can process multiple statements, there has to be an
  extra increase there as well.
sql/sql_show.cc:
  Removed deprecated SHOW_QUESTION status code.
sql/structs.h:
  Removed deprecated SHOW_QUESTION status code.
2008-10-09 09:26:42 +02:00
Georgi Kodinov
7b628ade5f merged 5.0-5.1.29-rc -> 5.0-bugteam 2008-10-08 11:36:24 +03:00
Gleb Shchepa
f48b42e776 Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''

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


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

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


mysql-test/r/lock_multi.result:
  Added test case for bug #38691.
mysql-test/t/lock_multi.test:
  Added test case for bug #38691.
sql/item.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  The Item_field constructor has been modified to allocate
  and copy original database/table/field names always (not
  during PS preparation/1st execution only), because
  an initialization of Item_field items with a pointer to
  short-living Field structures is a common practice.
sql/sql_base.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  1) Type adjustment for Natural_join_column::table_field
     (Field to Item_field);
  2) The setup_natural_join_row_types function has been
     updated to take into account new
     first_natural_join_processing flag to skip unnecessary
     reinitialization of Natural_join_column::join_columns
     during table reopening after lock_tables() failure
     (like the 'first_execution' flag for PS).
sql/sql_lex.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  Initialization of the new
  st_select_lex::first_natural_join_processing flag has
  been added.
sql/sql_lex.h:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  The st_select_lex::first_natural_join_processing flag
  has been added to skip unnecessary rebuilding of
  NATURAL/USING JOIN structures during table reopening
  after lock_tables failure.
sql/sql_update.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  Extra cleanup calls have been added to reset
  Natural_join_column::table_field items.
sql/table.cc:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  Type adjustment for Natural_join_column::table_field
  (Field to Item_field).
sql/table.h:
  Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
            ``FLUSH TABLES WITH READ LOCK''
  
  Type of the Natural_join_column::table_field field has
  been changed from Field that points into short-living
  TABLE memory to long-living Item_field that can be
  linked to (fixed) reopened table.
2008-10-08 02:34:00 +05:00
Georgi Kodinov
5a3086221d merged 5.0-5.1.29-rc -> 5.0-bugteam 2008-10-07 18:24:25 +03:00
Chad MILLER
494d2a2357 Merge fix for join-testcase failure. 2008-10-06 08:24:14 -04:00
Chad MILLER
468cacec4f Fix for test for b-g#35754 which fails based on hostname ?= "localhost". 2008-10-06 08:18:13 -04:00
Matthias Leich
7c0b007e64 Merge of fixes for Bug#38427 and Bug#38762 into actual tree
(no conflicts)
2008-10-04 17:13:43 +02:00
Chad MILLER
aa1a69222f Merge fix for Bug#35754. 2008-10-03 10:19:02 -04:00
Sergey Glukhov
d51e2c0760 Bug#35924 DEFINER should be stored 'quoted' in I_S
The '@' symbol can not be used in the host name according to rfc952.
The fix:
added function check_host_name(LEX_STRING *str)
which checks that all symbols in host name string are valid and
host name length is not more than max host name length
(just moved check_string_length() function from the parser into check_host_name()).


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


mysql-test/r/information_schema_db.result:
  test result
mysql-test/t/information_schema_db.test:
  test case
sql/sql_show.cc:
  The problem:
  I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL
  privileges for a view. It leads to discrepancy between SHOW CREATE VIEW
  and I_S.VIEWS.
  The fix:
  added appropriate check.
2008-10-02 14:37:07 +05:00
Ramil Kalimullin
1ce81aac15 merge 2008-10-02 13:10:06 +05:00
Georgi Kodinov
eb3c08069d Bug#37943: Reproducible mysqld crash/sigsegv in sel_trees_can_be_ored
When analyzing the possible index use cases the server was re-using an internal structure.
This is wrong, as this internal structure gets updated during the analysis.
Fixed by making a copy of the internal structure for every place it needs to be used.
Also stopped the generation of empty SEL_TREE structures that unnecessary 
complicate the analysis.

mysql-test/r/index_merge.result:
  Bug#37943: test case
mysql-test/t/index_merge.test:
  Bug#37943: test case
sql/opt_range.cc:
  Bug#37943: 
   - Make copy constructors for SEL_TREE and sub-structures and use them when OR-ing trees.
   - don't generate empty SEL_TREEs. Return NULL instead.
2008-10-01 18:50:55 +03:00
Georgi Kodinov
652565d362 fixed a failure in symlink.test caused by replacing rm with remove_file 2008-10-01 15:53:11 +03:00
Ramil Kalimullin
d3e317d16b Fix for bug#39182: Binary log producing incompatible character set query
from stored procedure. 

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

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

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


mysql-test/r/binlog.result:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - test result.
mysql-test/r/ctype_cp932_binlog.result:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - results adjusted.
mysql-test/r/rpl_sp.result:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - results adjusted.
mysql-test/t/binlog.test:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - test case.
sql/item.cc:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure.
    - allow NAME_CONST() to get _charset'foo' COLLATE 'bar' strings
  (see Item_func_set_collation).
sql/sp_head.cc:
  Fix for bug#39182: Binary log producing incompatible character set query
  from stored procedure. 
    - pass the value's collation to NAME_CONST().
2008-10-01 14:48:47 +05:00
Georgi Kodinov
ab5b7ceb97 fixed a wrong directory in distinct.test 2008-10-01 12:45:02 +03:00
Georgi Kodinov
dca2c113c6 merged 5.0-5.1.29-rc into 5.0-bugteam 2008-10-01 12:41:13 +03:00
Patrick Crews
006b940a27 Bug#38311 Some tests use 'rm' which is not portable
Repush of change to fix tests on Pushbuild.
2008-09-30 20:54:06 -04:00
Patrick Crews
8c33da076e Automerge 2008-09-30 12:56:12 -04:00
Alexey Botchkov
ce64a16b75 Bug#37949 Crash if argument to SP is a subquery that returns more than one row
JOIN for the subselect wasn't cleaned if we came upon an error
     during sub_select() execution. That leads to the assertion failure
     in close_thread_tables()

     part of the 6.0 code backported

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

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

  sql/sp_head.cc
Bug#37949 Crash if argument to SP is a subquery that returns more than one row 
    lex->unit.cleanup() call added if not substatement
2008-09-29 19:11:34 +05:00
Chad MILLER
392ff10eac Bug#35754: mysql_install_db does not work if no hostname is set
Machines with hostname set to "localhost" cause uniqueness errors in 
the SQL bootstrap data.

Now, insert zero lines for cases where the (lowercased) hostname is 
the same as an already-inserted 'localhost' name.  Also, fix a few tests 
that expect certain local accounts to have a certain host name.
2008-09-24 08:59:56 -04:00
Patrick Crews
f5c1c9af8e Bug#38311 - Fix of some cruft from remove_files in ndb_autodiscover.test, clean up of distinct.test,
and replacing error numbers with error names.
2008-09-23 05:24:32 -04:00
Kristofer Pettersson
119c5aaeba Automerge 2008-09-20 16:45:39 +02:00
Kristofer Pettersson
f0352e346a Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar
A stored procedure involving substrings could crash the server on certain
platforms because of invalid memory reads.
          
During storing the new blob-field value, the cached value's address range
overlapped that of the new field value. This caused problems when the 
cached value storage was reallocated to provide access for a new 
characater set representation. The patch checks the address ranges, and if
they overlap, the new field value is copied to a new storage before it is
converted to the new character set.


mysql-test/r/sp.result:
  Added result set
mysql-test/t/sp.test:
  Added test case
sql/field.cc:
  The source and destination address ranges of a character conversion must not overlap or the 'from' address will be invalidated as the temporary value-
  object is re-allocated to fit the new character set.
sql/field.h:
  Added comments
2008-09-20 10:51:03 +02:00
Patrick Crews
404e4b802c Bug#38311 Some tests use 'rm' which is not portable
Substituted use of MTR's remove_file function in the tests
Started with 5.0 tree and will clean up any offenders discovered during upmerge.
2008-09-20 02:21:28 -04:00
Georgi Kodinov
bf09a809a6 merged 5.0-5.1.29-rc into B39353 tree 2008-09-19 14:31:51 +03:00
Matthias Leich
24fe747024 Merge actual tree -> local tree
no conflicts
2008-09-18 15:32:06 +02:00
Georgi Kodinov
71fe190172 Bug #39353: Multiple conditions on timestamp column crashes server
The fix for bug 31887 was incomplete : it assumes that all the 
field types returned by the IS_NUM macro are descendants of 
Item_num and tries to zero-fill the values before doing constant
substitution with such fields when they are compared to constant string
values.
The only exception to this is Field_timestamp : it's in the IS_NUM
macro, but is not a descendant of Field_num.
Fixed by excluding timestamp fields (Field_timestamp) when zero-filling
when converting the constant to compare with to a string.
Note that this will not exclude the timestamp columns from const 
propagation.

mysql-test/r/compare.result:
  Bug #39353: test case
mysql-test/t/compare.test:
  Bug #39353: test case
sql/item.cc:
  Bug #39353: don't zero-fill timestamp fields when const propagating
  to a string : they'll be converted to a string in a date/time format
  and not as an integer.
2008-09-18 15:55:36 +03:00
Tatiana A. Nurnberg
654db75dfb Bug#37114: sql_mode NO_BACKSLASH_ESCAPES does not work properly with LOAD DATA Bug#37114: sql_mode NO_BACKSLASH_ESCAPES does not work properly with LOAD DATA INFILE
tweaked test to make embedded server happy
2008-09-18 11:24:50 +02:00
Tatiana A. Nurnberg
2f082d9d42 Bug#37114: sql_mode NO_BACKSLASH_ESCAPES does not work properly with LOAD DATA INFILE
NO_BACKSLASH_ESCAPES was not heeded in LOAD DATA INFILE
and SELECT INTO OUTFILE.  It is now.

mysql-test/r/loaddata.result:
  Show that SQL-mode NO_BACKSLASH_ESCAPES is heeded in
  INFILE/OUTFILE, and that dump/restore cycles work!
mysql-test/t/loaddata.test:
  Show that SQL-mode NO_BACKSLASH_ESCAPES is heeded in
  INFILE/OUTFILE, and that dump/restore cycles work!
sql/sql_class.cc:
  Add function to enquire whether ESCAPED BY was given.
  When doing SELECT...OUTFILE, use ESCAPED BY if specifically
  given; otherwise use sensible default value depending on
  SQL-mode features NO_BACKSLASH_ESCAPES.
sql/sql_class.h:
  Add function to enquire whether ESCAPED BY was given.
sql/sql_load.cc:
  When doing LOAD DATA INFILE, use ESCAPED BY if specifically
  given; otherwise use sensible default value depending on
  SQL-mode features NO_BACKSLASH_ESCAPES.
2008-09-17 08:34:00 +02:00
Matthias Leich
635887dcee Fix for Bug#38184 : main.federated fails sporadically
Details:
- backport of some improvements which prevent sporadic
  failures from 5.1 to 5.0
- @@GLOBAL.CONCURRENT_INSERT= 0 also for slave server
- --sorted_result before all selects which have result
  sets with more than one row
- Replace error numbers by error names
2008-09-16 19:05:30 +02:00
Patrick Crews
ebd3a6e452 Bug#37938 Test "mysqldump" lacks various INSERT statements / values
Moved fix for this bug to 5.0 as other mysqldump bugs seem tied to concurrent_insert being on
Setting concurrent_insert off during this test as INSERTs weren't being 
completely processed before the calls to mysqldump, resulting in failing tests.

Altered .test file to turn concurrent_insert off during the test and to restore it
to whatever the value was at the start of the test when complete.

Re-recorded .result file to account for changes to variables in the test.
2008-09-15 15:34:39 -04:00
Georgi Kodinov
bed8cec485 merged 5.0-5.1.29-rc -> 5.0-bugteam 2008-09-10 12:40:58 +03:00
Ramil Kalimullin
776793a97c Fix for bug#37526: asymertic operator <=> in trigger
Problem: <=> operator may return wrong results 
comparing NULL and a DATE/DATETIME/TIME value.

Fix: properly check NULLs.


mysql-test/r/type_datetime.result:
  Fix for bug#37526: asymertic operator <=> in trigger
    - test result.
mysql-test/t/type_datetime.test:
  Fix for bug#37526: asymertic operator <=> in trigger
    - test case.
sql/item_cmpfunc.cc:
  Fix for bug#37526: asymertic operator <=> in trigger
    - if is_nulls_eq is TRUE Arg_comparator::compare_datetime() 
  should return 1 only if both arguments are NULL.
2008-09-09 20:05:27 +05:00
Ramil Kalimullin
788be2aebd Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
Problem: SELECT ... REGEXP BINARY NULL may lead to server crash/hang.

Fix: properly handle NULL regular expressions.


mysql-test/r/func_regexp.result:
  Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
    - test result.
mysql-test/t/func_regexp.test:
  Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
    - test case.
sql/item_cmpfunc.cc:
  Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
    - checking regular expressions' null_value
  we tested it without a val_xxx() call before, which is wrong.
  Now Item_func_regex::regcomp() returns -1 in the case
  and allows to handle NULL expessions properly.
sql/item_cmpfunc.h:
  Fix for bug #39021: SELECT REGEXP BINARY NULL never returns
    - checking regular expressions' null_value
  we tested it without a val_xxx() call before, which is wrong.
  Now Item_func_regex::regcomp() returns -1 in the case
  and allows to handle NULL expessions properly.
2008-09-05 13:30:01 +05:00
Ramil Kalimullin
bcbff0b93b Merge 2008-09-05 12:48:56 +05:00
Ramil Kalimullin
f0a50bd969 Fix for bug#38821: Assert table->auto_increment_field_not_null failed
in open_table()

Problem: repeating "CREATE... ( AUTOINCREMENT) ... SELECT" may lead to
an assertion failure.

Fix: reset table->auto_increment_field_not_null after each record 
writing.


mysql-test/r/create.result:
  Fix for bug#38821: Assert table->auto_increment_field_not_null failed 
  in open_table()
    - test result.
mysql-test/t/create.test:
  Fix for bug#38821: Assert table->auto_increment_field_not_null failed 
  in open_table()
    - test case.
sql/sql_insert.cc:
  Fix for bug#38821: Assert table->auto_increment_field_not_null failed 
  in open_table()
    - reset table->auto_increment_field_not_null after writing a record
  for "{CREATE, INSERT}..SELECT".
2008-09-03 15:17:19 +05:00
Gleb Shchepa
dd1d9adbb0 merge with local tree 2008-09-03 12:59:48 +05:00
Gleb Shchepa
59b9d50c8a Bug #39002: The server crashes on the query:
INSERT .. SELECT .. ON DUPLICATE KEY UPDATE col=DEFAULT

In order to get correct values from update fields that
belongs to the SELECT part in the INSERT .. SELECT .. ON
DUPLICATE KEY UPDATE statement, the server adds referenced
fields to the select list. Part of the code that does this
transformation is shared between implementations of
the DEFAULT(col) function and the DEFAULT keyword (in
the col=DEFAULT expression), and an implementation of
the DEFAULT keyword is incomplete.


mysql-test/r/default.result:
  Added test case for bug #39002.
mysql-test/t/default.test:
  Added test case for bug #39002.
sql/item.cc:
  The Item_default_value::transform() function has been
  modified to take into account the fact that the DEFAULT
  keyword has no arguments unlike the DEFAULT(col) function
  that always has an argument.
2008-09-03 12:32:43 +05:00
Mats Kindahl
7258de3862 Merging in 5.0-rpl into 5.0-bugteam 2008-09-01 10:19:17 +02:00
Matthias Leich
e5ab6f5fa5 Merge actual 5.0-bugteam into local tree 2008-08-28 14:18:40 +02:00
Gleb Shchepa
54a59681d6 Bug #37799: SELECT with a BIT column in WHERE clause
returns unexpected result

If:
  1. a table has a not nullable BIT column c1 with a length
     shorter than 8 bits and some additional not nullable
     columns c2 etc, and
  2. the WHERE clause is like: (c1 = constant) AND c2 ...,
the SELECT query returns unexpected result set.


The server stores BIT columns in a tricky way to save disk
space: if column's bit length is not divisible by 8, the
server places reminder bits among the null bits at the start
of a record. The rest bytes are stored in the record itself,
and Field::ptr points to these rest bytes.

However if a bit length of the whole column is less than 8,
there are no remaining bytes, and there is nothing to store in
the record at its regular place. In this case Field::ptr points
to bytes actually occupied by the next column in a record.
If both columns (BIT and the next column) are NOT NULL,
the Field::eq function incorrectly deduces that this is the
same column, so query transformation/equal item elimination
code (see build_equal_items_for_cond) may mix these columns
and damage conditions containing references to them.


mysql-test/r/type_bit.result:
  Added test case for bug #37799.
mysql-test/t/type_bit.test:
  Added test case for bug #37799.
sql/field.h:
  1. The Field::eq function has been modified to take types of
  comparing columns into account to distinguish between BIT and
  not BIT columns referencing the same bytes in a record.
  
  2. Unnecessary type comparison has been removed from the
  Field_bit::eq function (moved to Field::eq).
2008-08-28 02:10:37 +05:00
Evgeny Potemkin
06bf25e4d4 Bug#38195: Incorrect handling of aggregate functions when loose index scan is
used causes server crash.
      
When the loose index scan access method is used values of aggregated functions
are precomputed by it. Aggregation of such functions shouldn't be performed
in this case and functions should be treated as normal ones.
The create_tmp_table function wasn't taking this into account and this led to
a crash if a query has MIN/MAX aggregate functions and employs temporary table
and loose index scan.
Now the JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
functions as normal ones when the loose index scan is used.


mysql-test/r/group_min_max.result:
  Added a test case for the bug#38195.
mysql-test/t/group_min_max.test:
  Added a test case for the bug#38195.
sql/sql_select.cc:
  Bug#38195: Incorrect handling of aggregate functions when loose index scan is
  used causes server crash.
  The JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
  functions as normal ones when the loose index scan is used.
2008-08-27 17:03:17 +04:00
Ramil Kalimullin
b219978514 Fix for bug #37310: 'on update CURRENT_TIMESTAMP' option crashes the table
Problem: data consistency check (maximum record length) for a correct
MyISAM table with CHECKSUM=1 and ROW_FORMAT=DYNAMIC option 
may fail due to wrong inner MyISAM parameter. In result we may 
have the table marked as 'corrupted'. 

Fix: properly set MyISAM maximum record length parameter.


myisam/mi_create.c:
  Fix for bug #37310: 'on update CURRENT_TIMESTAMP' option crashes the table
  
  Use HA_OPTION_PACK_RECORD instead of HA_PACK_RECORD (typo?) 
  calculating packed record length.
2008-08-26 18:48:50 +05:00
Alexey Botchkov
3b1adb501e merging fixes 2008-08-26 14:21:07 +05:00
Matthias Leich
5f2354b846 Fix for
Bug#26687 rpl_ddl test fails if run with --innodb option
  Details:
  - The current test + the expected results do only fit
    if the slave uses MyISAM for mysqltest1.t1.
    Therefore skip the test if we do not meet these
    conditions.
  - The solution for 5.1 will look quite different
    because "ps_ddl" is already much improved in
    MySQL 5.1.
2008-08-22 19:49:51 +02:00
Alexey Botchkov
ec524d50a8 Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
test_if_data_home_dir fixed to look into real path.
            Checks added to mi_open for symlinks into data home directory.

per-file messages:
        include/my_sys.h
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          my_is_symlink interface added
        include/myisam.h
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          myisam_test_invalid_symlink interface added
        myisam/mi_check.c
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          mi_open_datafile calls modified
        myisam/mi_open.c
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          code added to mi_open to check for symlinks into data home directory.
          mi_open_datafile now accepts 'original' file path to check if it's
          an allowed symlink.
        myisam/mi_static.c
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          myisam_test_invlaid_symlink defined
        myisam/myisamchk.c
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          mi_open_datafile call modified
        myisam/myisamdef.h
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          mi_open_datafile interface modified - 'real_path' parameter added
        mysql-test/r/symlink.test
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          error codes corrected as some patch now rejected pointing inside datahome
        mysql-test/r/symlink.result
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          error messages corrected in the result
        mysys/my_symlink.c
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          my_is_symlink() implementsd
          my_realpath() now returns the 'realpath' even if a file isn't a symlink
        sql/mysql_priv.h
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          test_if_data_home_dir interface
        sql/mysqld.cc
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          myisam_test_invalid_symlik set with the 'test_if_data_home_dir'
        sql/sql_parse.cc
          Bug#32167 another privilege bypass with DATA/INDEX DIRECTORY.
          
          error messages corrected
          test_if_data_home_dir code fixed
2008-08-22 17:31:53 +05:00
Sergey Glukhov
de73b72954 Bug#38291 memory corruption and server crash with view/sp/function
Send_field.org_col_name has broken value on secondary execution.
It happens when result field is created from the field which belongs to view
due to forgotten assignment of some Send_field attributes. 
The fix:
set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.

mysql-test/r/metadata.result:
  result fix
  The result file was changed because now forgotten attributes are properly set.
mysql-test/r/sp.result:
  test result
mysql-test/t/sp.test:
  test case
sql/item.cc:
  Send_field.org_col_name has broken value on secondary execution.
  It happens when result field is created from the field which belongs to view
  due to forgotten assignment of some Send_field attributes. 
  The fix:
  set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.
tests/mysql_client_test.c:
  test case fix
  The test was changed because now forgotten attributes are properly set.
2008-08-20 14:49:28 +05:00
Georgi Kodinov
40bd9a4218 merged 5.0-main to 5.0-bugteam 2008-08-19 14:55:36 +03:00
Georgi Kodinov
6387cac94b Bug#38195: Incorrect handling of aggregate functions when loose index scan
is used causes server crash.
  Revert the fix : unstable test case revealed by pushbuild
2008-08-19 13:36:24 +03:00
Chad MILLER
21598ea0e6 Bug#37301 Length and Max_length differ with no obvious reason(2nd version)
Length value is the length of the field,
Max_length is the length of the field value.
So Max_length can not be more than Length.
The fix: fixed calculation of the Item_empty_string item length

(Patch applied and queued on demand of Trudy/Davi.)

sql/item.h:
  fixed calculation of the item length
sql/sql_show.cc:
  removed unnecessary code
2008-08-15 16:13:27 -04:00
Chad MILLER
65c3870cfc Bug#36270: incorrect calculation result - works in 4.1 but not in 5.0 or 5.1
When the fractional part in a multiplication of DECIMALs
overflowed, we truncated the first operand rather than the
longest. Now truncating least significant places instead
for more precise multiplications.

(Queuing at demand of Trudy/Davi.)

mysql-test/r/type_newdecimal.result:
  show that if we need to truncate the scale of an operand, we pick the
  right one (that is, we discard the least significant decimal places)
mysql-test/t/type_newdecimal.test:
  show that if we need to truncate the scale of an operand, we pick the
  right one (that is, we discard the least significant decimal places)
strings/decimal.c:
  when needing to disregard fractional parts, pick the least
  significant ones
2008-08-15 15:46:21 -04:00
Ramil Kalimullin
2b179caf9a Fix for bug #34779: crash in checksum table on federated tables
with blobs containing nulls

Problem: FEDERATED SE improperly stores NULL fields in the record buffer.

Fix: store them properly.


mysql-test/r/federated.result:
  Fix for bug #34779: crash in checksum table on federated tables 
  with blobs containing nulls
    - test result.
mysql-test/t/federated.test:
  Fix for bug #34779: crash in checksum table on federated tables 
  with blobs containing nulls
    - test case.
sql/ha_federated.cc:
  Fix for bug #34779: crash in checksum table on federated tables 
  with blobs containing nulls
    - storing a NULL field in the record buffer
      we must initialize its data as other code
      may rely on it.
2008-08-15 11:40:05 +05:00
Evgeny Potemkin
368f7f63b2 Fixed failing test case for the bug#38195. 2008-08-14 23:55:18 +04:00
Evgeny Potemkin
b789b4f33c Bug#38195: Incorrect handling of aggregate functions when loose index scan is
used causes server crash.

When the loose index scan access method is used values of aggregated functions
are precomputed by it. Aggregation of such functions shouldn't be performed
in this case and functions should be treated as normal ones.
The create_tmp_table function wasn't taking this into account and this led to
a crash if a query has MIN/MAX aggregate functions and employs temporary table
and loose index scan.
Now the JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
functions as normal ones when the loose index scan is used.


mysql-test/r/group_min_max.result:
  Added a test case for the bug#38195.
mysql-test/t/group_min_max.test:
  Added a test case for the bug#38195.
sql/sql_select.cc:
  Bug#38195: Incorrect handling of aggregate functions when loose index scan is
  used causes server crash.
  Now the JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
  functions as normal ones when the loose index scan is used.
2008-08-13 22:24:55 +04:00
Timothy Smith
9d9fa39b97 Cherry-pick fix for Bug#35220 from innodb-5.0-ss2475 snapshot.
Bug#35220: ALTER TABLE too picky on reserved word "foreign"

In ALTER TABLE, change the internal parser to search for
``FOREIGN[[:space:]]'' instead of only ``FOREIGN'' when parsing
ALTER TABLE ... DROP FOREIGN KEY ...; otherwise it could be mistaken
with ALTER TABLE ... DROP foreign_col;

(This fix is already present in MySQL 5.1 and higher.)
2008-08-07 18:25:24 -06:00
Timothy Smith
dc593c3ec4 Cherry-pick InnoDB fixes for Bug#34286, Bug#35352, and Bug#36600 from snapshot
innodb-5.0-ss2475.

Bug #34286  Assertion failure in thread 2816 in file .\row\row0sel.c line 3500
Since autoinc init performs a MySQL SELECT query to determine the auto-inc
value, set prebuilt->sql_stat_start = TRUE so that it is performed like any
normal SELECT, regardless of the context in which it was invoked.


Bug #35352  If InnoDB crashes with UNDO slots full error the error persists on restart
We've added a heuristic that checks the size of the UNDO slots cache lists
(insert and upate). If either of cached lists has more than 500 entries then we
add any UNDO slots that are freed, to the common free list instead of the cache
list, this is to avoid the case where all the free slots end up in only one of
the lists on startup after a crash.

Tested with test case for 26590 and passes all mysql-test(s).

Bug #36600  SHOW STATUS takes a lot of CPU in buf_get_latched_pages_number
Fixed by removing the Innodb_buffer_pool_pages_latched variable from SHOW
STATUS output in non-UNIV_DEBUG compilation.
2008-07-31 15:47:57 -06:00
Georgi Kodinov
ae4a35fd5c Bug#37662 nested if() inside sum() is parsed in exponential time
min() and max() functions are implemented in MySQL as macros.
This means that max(a,b) is expanded to: ((a) > (b) ? (a) : (b))
Note how 'a' is quoted two times.
Now imagine 'a' is a recursive function call that's several 10s of levels deep.
And the recursive function does max() with a function arg as well to dive into
recursion.
This means that simple function call can take most of the clock time.
Identified and fixed several such calls to max()/min() : including the IF() 
sql function implementation.

mysql-test/r/func_if.result:
  Bug#37662 test case
mysql-test/t/func_if.test:
  Bug#37662 test case
sql/item.cc:
  Bug#37662 don't call expensive functions as arguments to min/max
sql/item_cmpfunc.cc:
  Bug#37662 don't call expensive functions as arguments to min/max
sql/item_func.cc:
  Bug#37662 don't call expensive functions as arguments to min/max
2008-07-30 14:07:37 +03:00
Igor Babaev
7f615b2c14 Merge 2008-07-28 01:24:56 -07:00
Igor Babaev
b6e3a9e28c Fixed bug #38191.
Calling List<Cached_item>::delete_elements for the same list twice
caused a crash of the server in the function JOIN::cleaunup.
Ensured that delete_elements() in JOIN::cleanup would be called only once.


mysql-test/r/subselect.result:
  Added a test case for bug #38191.
mysql-test/t/subselect.test:
  Added a test case for bug #38191.
sql/sql_select.cc:
  Fixed bug #38191.
  Ensured that delete_elements() in JOIN::cleanup would be called only once.
2008-07-26 13:44:07 -07:00
Davi Arnaut
14887bb2ab Cherry-pick Bug#33362 from mysql-5.1 2008-07-24 11:14:34 -03:00
Georgi Kodinov
dd85aa78ba Bug#37830 : ORDER BY ASC/DESC - no difference
Range scan in descending order for c <= <col> <= c type of
ranges was ignoring the DESC flag.
However some engines like InnoDB have the primary key parts 
as a suffix for every secondary key.
When such primary key suffix is used for ordering ignoring 
the DESC is not valid.
But we generally would like to do this because it's faster.
            
Fixed by performing only reverse scan if the primary key is used.
Removed some dead code in the process.

mysql-test/r/innodb_mysql.result:
  Bug#37830 : test case
mysql-test/t/innodb_mysql.test:
  Bug#37830 : test case
sql/opt_range.cc:
  Bug#37830 : 
  - preserve and use used_key_parts to
    distinguish when a primary key suffix is used
  - removed some dead code
sql/opt_range.h:
  Bug#37830 : 
  - preserve used_key_parts
  - dead code removed
sql/sql_select.cc:
  Bug#37830 : Do only reverse order traversal
  if the primary key suffix is used.
2008-07-23 14:25:00 +03:00
Georgi Kodinov
88d66418c8 Bug 38158: mysql client regression, can't read dump files
- Revert the fix for bug 33812
- fixed a win32 warning

client/mysql.cc:
  revert the fix for bug 33812
mysql-test/r/mysql.result:
  revert the fix for bug 33812
mysql-test/t/mysql_delimiter.sql:
  revert the fix for bug 33812
mysys/default.c:
  fixed a win32 warning
2008-07-18 13:24:59 +03:00
Alexander Barkov
6a42c35fa7 Bug#27934 test client_xml misssing initialization
Problem: missing initialization, if the previous test
fails leaving table t1, client_xml fails as well.
Fix: adding initialization.
2008-07-18 14:07:16 +05:00
Marc Alff
e73e7bb9ae Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)

The crash was caused by freeing the internal parser stack during the parser
execution.
This occured only for complex stored procedures, after reallocating the parser
stack using my_yyoverflow(), with the following C call stack:
- MYSQLparse()
- any rule calling sp_head::restore_lex()
- lex_end()
- x_free(lex->yacc_yyss), xfree(lex->yacc_yyvs)

The root cause is the implementation of stored procedures, which breaks the
assumption from 4.1 that there is only one LEX structure per parser call.

The solution is to separate the LEX structure into:
- attributes that represent a statement (the current LEX structure),
- attributes that relate to the syntax parser itself (Yacc_state),
so that parsing multiple statements in stored programs can create multiple
LEX structures while not changing the unique Yacc_state.

Now, Yacc_state and the existing Lex_input_stream are aggregated into
Parser_state, a structure that represent the complete state of the (Lexical +
Syntax) parser.


mysql-test/r/parser_stack.result:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
mysql-test/t/parser_stack.test:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sp.cc:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sp_head.cc:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_class.cc:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_class.h:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_lex.cc:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_lex.h:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_parse.cc:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_prepare.cc:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_trigger.cc:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_view.cc:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
sql/sql_yacc.yy:
  Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
  build)
2008-07-14 15:41:30 -06:00
Tatiana A. Nurnberg
0833d66847 Bug#35848: UUID() returns UUIDs with the wrong time
offset for time part in UUIDs was 1/1000 of what it
should be. In other words, offset was off.

Also handle the case where we count into the future
when several UUIDs are generated in one "tick", and
then the next call is late enough for us to unwind
some but not all of those borrowed ticks.

Lastly, handle the case where we keep borrowing and
borrowing until the tick-counter overflows by also
changing into a new "numberspace" by creating a new
random suffix.


mysql-test/r/func_misc.result:
  Show that time-part of UUIDs is correct now.
mysql-test/t/func_misc.test:
  Show that time-part of UUIDs is correct now
  by replicating the C-code's resultin SQL.
  Results also decode to expect date-data on
  command-line (external validation).
  
  No test for unwinding of borrowed ticks as
  this a) is a race and b) depends on what timer
  we get.
sql/item_strfunc.cc:
  correct offset for date/time-part of UUID.
  also make sure that when we counted into
  the future earlier (several UUIDs generated
  in same tick), we only give back as many
  "borrowed" ticks as we can without duplicating
  past timestamps. If our tick-counter overflows
  before we can give back, or if the system-clock
  is set back (by user or Daylight Saving Time),
  we create a new random suffix to avoid
  collisions and clear the tick-counter.
2008-07-10 03:58:30 +02:00
Marc Alff
c7724872d8 Bug#26030 (Parsing fails for stored routine w/multi-statement execution
enabled)

Before this fix, the lexer and parser would treat the ';' character as a
different token (either ';' or END_OF_INPUT), based on convoluted logic,
which failed in simple cases where a stored procedure is implemented as a
single statement, and used in a multi query.

With this fix:
- the character ';' is always parsed as a ';' token in the lexer,
- parsing multi queries is implemented in the parser, in the 'query:' rules,
- the value of thd->client_capabilities, which is the capabilities
  negotiated between the client and the server during bootstrap,
  is immutable and not arbitrarily modified during parsing (which was the
  root cause of the bug)
2008-07-07 10:00:08 -06:00
Gleb Shchepa
b83b4697d2 backport from 6.0
Bug#35658 (An empty binary value leads to mysqld crash)
        
Before this fix, the following token
  b''
caused the parser to crash when reading the binary value from the empty string.
The crash was caused by:
  ptr+= max_length - 1;
because max_length is unsigned and was 0, causing an overflow.
        
With this fix, an empty binary literal b'' is parsed as a binary value 0,
in Item_bin_string.

mysql-test/r/varbinary.result:
  Bug#35658 (An empty binary value leads to mysqld crash)
mysql-test/t/varbinary.test:
  Bug#35658 (An empty binary value leads to mysqld crash)
sql/item.cc:
  Bug#35658 (An empty binary value leads to mysqld crash)
2008-06-27 20:56:41 +05:00
Matthias Leich
49417ad7c8 Fix for
Bug#37492 timing bug in subselect.test
+ similar weaknesses found during testing
+ replace error numbers by error names
2008-06-25 16:59:38 +02:00
Gleb Shchepa
2c77798c74 back-port from 5.1.
Bug#33812: mysql client incorrectly parsing DELIMITER
      
Remove unnecessary and incorrect code that tried
to pull delimiter commands out of the middle of
statements.
2008-06-24 21:03:17 +05:00
Gleb Shchepa
6eb2e76abd Bug #36244: MySQL CLI doesn't recognize standalone --
as a commentary

mysql client has been modified to interpret EOL after
standalone -- commentary strings like whitespace
character (according to
http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-comments.html)


mysql-test/t/mysql_delimiter.sql:
  Added test case for bug #36244.
2008-06-24 19:32:06 +05:00
Georgi Kodinov
1e17f242f3 atuomatically merged 5.0 main to 5.0-bugteam 2008-06-12 17:32:31 +03:00
Georgi Kodinov
da4cfa6d1e Bug#37069 (5.0): implement --skip-federated
mysql-test/r/federated_disabled.result:
  Bug#37069 (5.0): test case
mysql-test/t/federated_disabled-master.opt:
  Bug#37069 (5.0): test case
mysql-test/t/federated_disabled.test:
  Bug#37069 (5.0): test case
2008-06-03 13:12:37 +03:00
Matthias Leich mleich@mysql.com
1544026443 Bug#36788 Multiple funcs_1 'trig' tests are failing on vanilla builds
Fix for this bug and additional improvements/fixes
In detail:
- Remove unicode attribute from several columns
  (unicode properties were nowhere needed/tested)
  of the table tb3
  -> The runnability of these tests depends no more on
     the availibility of some optional collations.
- Use a table tb3 with the same layout for all
  engines to be tested and unify the engine name
  within the protocols.
  -> <engine>_trig_<abc>.result have the same content
- Do not load data into tb3 if these rows have no
  impact on result sets
- Add tests for NDB (they exist already in 5.1)
- "--replace_result" at various places because
  NDB variants of tests failed with "random" row
  order in results
  This fixes a till now unknown weakness within the
  funcs_1 NDB tests existing in 5.1 and 6.0
- Fix the expected result of ndb_trig_1011ext
  which suffered from Bug 32656
  + disable this test
- funcs_1 could be executed with the mysql-test-run.pl
  option "--reorder", which saves some runtime by
  optimizing server restarts.
  Runtimes on tmpfs (one attempt only):
  with    reorder 132 seconds
  without reorder 183 seconds
- Adjust two "check" statements within func_misc.test
  which were incorrect (We had one run with result set
  difference though the server worked good.)
- minor fixes in comments
2008-06-02 21:57:11 +02:00
Matthias Leich mleich@mysql.com
200a93632e Bug#36345 Test 'func_misc' fails on RHAS3 x86_64
Fix for this bug and a second similar problem
found during experimenting.

This replaces the first fix (already pushed to 5.1
and merged to 6.0) which
- failed in runs with the embedded server
- cannot be ported back to 5.0
2008-05-29 18:38:10 +02:00
unknown
8bc987ab5b Merge host.loc:/work/bugs/5.0-bugteam-36676
into  host.loc:/work/bk/5.0-bugteam
2008-05-18 14:27:17 +05:00
unknown
29e7fa258d Fixed bug#36676: multiupdate using LEFT JOIN updates only
first row or fails with an error:
  ERROR 1022 (23000): Can't write; duplicate key in table ''

The server uses intermediate temporary table to store updated
row data.  The first column of this table contains rowid.
Current server implementation doesn't reset NULL flag of that
column even if the server fills a column with rowid.
To keep each rowid unique, there is an unique index.
An insertion into an unique index takes into account NULL
flag of key value and ignores real data if NULL flag is set.
So, insertion of actually different rowids may lead to two
kind of problems.  Visible effect of each of these problems
depends on an initial engine type of temporary table:

1. If multiupdate initially creates temporary table as
a MyISAM table (a table contains blob columns, and the
create_tmp_table function assumes, that this table is
large), it inserts only one single row and updates
only rows with one corresponding rowid. Other rows are
silently ignored. 

2. If multiupdate initially creates MEMORY temporary
table, fills it with data and reaches size limit for
MEMORY tables (max_heap_table_size), multiupdate
converts MEMORY table into MyISAM table and fails
with an error:
  ERROR 1022 (23000): Can't write; duplicate key in table ''


Multiupdate has been fixed to update the NULL flag of
temporary table rowid columns.



mysql-test/r/multi_update_tiny_hash.result:
  Added test case for bug#36676.
mysql-test/t/multi_update_tiny_hash-master.opt:
  Added test case for bug#36676.
mysql-test/t/multi_update_tiny_hash.test:
  Added test case for bug#36676.
sql/sql_update.cc:
  Fixed bug#36676: multiupdate using LEFT JOIN updates only
                   first row or fails with an error:
    ERROR 1022 (23000): Can't write; duplicate key in table ''
  
  The multi_update::send_data method has been modified to reset null bits of
  fields containing rowids.
2008-05-18 14:21:25 +05:00
unknown
eee5b97258 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-bugteam
2008-05-16 17:48:07 -04:00
unknown
290b6c00c9 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my50-bug36570
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-bugteam
2008-05-16 17:40:01 -04:00
unknown
97354b1907 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  magare.gmz:/home/kgeorge/mysql/autopush/B36011-take2-5.0-bugteam
2008-05-16 18:56:43 +03:00
unknown
1f904b7f11 Add a test at Andrei's behest. Show the SHOW CREATE on the
master also, so that we can visually see the slave is the same.


mysql-test/r/rpl_sp.result:
  SHOW CREATE on master also.
mysql-test/t/rpl_sp.test:
  SHOW CREATE on master also.
2008-05-16 11:26:29 -04:00
unknown
0fb1527e95 Bug #36011: server crash with explain extended on query
with dependent subqueries
An IN subquery is executed on EXPLAIN when it's not correlated.
If the subquery required a temporary table for its execution
not all the internal structures were restored from pointing to
the items of the temporary table to point back to the items of
the subquery.
Fixed by restoring the ref array when a temp tables were used in
executing the IN subquery during EXPLAIN EXTENDED.


mysql-test/r/subselect.result:
  Bug #36011: test case
mysql-test/t/subselect.test:
  Bug #36011: test case
sql/sql_select.cc:
  Bug #36011: restore the ref array after execution 
  when there were temp tables.
2008-05-16 17:05:55 +03:00
unknown
e10957274a Updated to address Davi's complaint about missing binlog.
mysql-test/r/rpl_sp.result:
  Add binlog results to show that they're written correctly.
mysql-test/t/rpl_sp.test:
  Add binlog results to show that they're written correctly.
2008-05-16 09:15:56 -04:00
unknown
7ca1538b90 Merge host.loc:/work/bugs/5.0-bugteam-36488
into  host.loc:/work/bk/5.0-bugteam
2008-05-16 13:00:12 +05:00
unknown
55012e427b Bug#36570: Parse error of CREATE PROCEDURE stmt with comments on \
slave

The stored-routine code took the contents of the (lowest) parser
and copied it directly to the binlog, which causes problems if there
is a special case of interpretation at the parser level -- which 
there is, in the "/*!VER */" comments.  The trailing "*/" caused
errors on the slave, naturally.

Now, since by that point we have /properly/ created parse-tree (as 
the rest of the server should do!) for the stored-routine CREATE, we
can construct a perfect statement from that information, instead of
writing uncertain information from an unknown parser state.  
Fortunately, there's already a function nearby that does exactly 
that.
---
Update for Bug#36570.  Qualify routine names with db name when
writing to the binlog ONLY if the source text is qualified.


mysql-test/r/binlog_innodb.result:
  Offsets changed due to quoting.
  ---
  New offset to account for db-qualified names.
mysql-test/r/ctype_cp932_binlog.result:
  Offsets changed due to quoting.
  ---
  Qualify routine names with DB.  Offsets change also.
mysql-test/r/mysqlbinlog.result:
  Case changed in result due to interpretation of data instead of 
  literal recitation.
  ---
  Qualify procedure name with db.
mysql-test/r/rpl_sp.result:
  Offsets changed due to quoting.  Added tests.
  ---
  Qualify routine names with DB if qualified in query.  Offsets change also.
mysql-test/t/rpl_sp.test:
  Add version-limiting quotes to exercise bug#36570.  Test that 
  backtick-quoted identifiers and labels work also.
  ---
  Use different db to show qualification works.  Qualify routine names
  with DB if qualified in query.
sql/sp.cc:
  In create_string, we may not have a sp_name parameter yet, so
  instead pass the char* and length of the only member we'd get out
  of it.
  
  Having done that, we can use the same function to write the 
  CREATE (FUNC|TRIG|PROC) statement to the binlog as we always used
  to display the statement to the user.
  ---
  Make the db name part of the CREATE string if it is specified.
  
  Specify it in part of writing to the binlog when creating a new
  routine.
sql/sp_head.cc:
  Set the sp_head m_explicit_name member as the sp_name member is set.  
  We can not peek at this later, as the sp_name is gone by then.
sql/sp_head.h:
  Add a member to track whether the name is qualified with the 
  database.
2008-05-15 19:13:24 -04:00
unknown
66367aeea8 Fixed bug #36488: regexp returns false matches, concatenating
with previous rows.

The WHERE clause containing expression:
  CONCAT(empty_field1, empty_field2, ..., 'literal constant', ...)
    REGEXP 'regular expression'
may return wrong matches.

Optimization of the CONCAT function has been fixed.



mysql-test/r/func_concat.result:
  Added test case for bug #36488.
mysql-test/t/func_concat.test:
  Added test case for bug #36488.
sql/item_strfunc.cc:
  Fixed bug #36488.
  The Item_func_concat::val_str method is optimized to
  use first non-empty argument of the CONCAT function for in-place
  result accumulation. This optimization is acceptable if that
  first argument is not a constant.
  However, current implementation checks this condition only for
  the first actual argument of the CONCAT function.
  So, the Item_func_concat::val_str method can corrupt values
  of, for example, literal strings by appending random data.
  
  The Item_func_concat::val_str method has been modified to take
  into account the ability to be modified in-place for the first
  non-empty argument.
2008-05-13 20:27:46 +05:00
unknown
ef4b6200ac Merge host.loc:/work/bugs/5.0-bugteam-36055
into  host.loc:/work/bk/5.0-bugteam
2008-05-13 00:32:43 +05:00
unknown
e7e49eb69e Fixed bug #36055: mysql_upgrade doesn't really 'upgrade' tables
The REPAIR TABLE ... USE_FRM query silently corrupts data of tables
with old .FRM file version.
The mysql_upgrade client program or the REPAIR TABLE query (without
the USE_FRM clause) can't prevent this trouble, because in the
common case they don't upgrade .FRM file to compatible structure.

1. Evaluation of the REPAIR TABLE ... USE_FRM query has been
   modified to reject such tables with the message:
   "Failed repairing incompatible .FRM file".

2. REPAIR TABLE query (without USE_FRM clause) evaluation has been
   modified to upgrade .FRM files to current version.

3. CHECK TABLE ... FOR UPGRADE query evaluation has been modified
   to return error status when .FRM file has incompatible version.

4. mysql_upgrade and mysqlcheck client programs call CHECK TABLE
   FOR UPGRADE and REPAIR TABLE queries, so their behaviors have
   been changed too to upgrade .FRM files with incompatible
   version numbers.


mysql-test/std_data/bug36055.MYD:
  Added test data for bug #36055.
mysql-test/std_data/bug36055.MYI:
  Added test data for bug #36055.
mysql-test/std_data/bug36055.frm:
  Added test data for bug #36055.
mysql-test/r/repair.result:
  Added test case for bug# 36055.
mysql-test/t/repair.test:
  Added test case for bug# 36055.
sql/handler.cc:
  Fixed bug #36055: mysql_upgrade doesn't really 'upgrade' tables
  
  The handler::ha_check_for_upgrade method has been modified to
  return error if .FRM file has incompatible version number.
sql/sql_table.cc:
  Fixed bug #36055: mysql_upgrade doesn't really 'upgrade' tables
  
  The prepare_for_repair function has been modified to reject
  REPAIR TABLE ... USE_FRM queries on incompatible .FRM files
  with the message: "Failed repairing incompatible .FRM file".
2008-05-12 21:01:13 +05:00
unknown
ab6e91cf3a Merge client-10-129-10-147.upp.off.mysql.com:/Users/mattiasj/clones/bug32575-50-bugteam
into  client-10-129-10-147.upp.off.mysql.com:/Users/mattiasj/clones/topush-50-bugteam
2008-05-08 11:26:20 +02:00
unknown
a6f7fa35b1 Bug#32575 - Parse error of stmt with extended comments on slave side
Problem was that mysql_create_view did not remove all comments characters
when writing to binlog, resulting in parse error of stmt on slave side.

Solution was to use the recreated select clause
and add a generated CHECK OPTION clause if needed.


mysql-test/r/rpl_sp.result:
  Bug#32575 - Parse error of stmt with extended comments on slave side
  
  Updated test result
mysql-test/r/rpl_view.result:
  Bug#32575 - Parse error of stmt with extended comments on slave side
  
  Updated test result
mysql-test/t/rpl_view.test:
  Bug#32575 - Parse error of stmt with extended comments on slave side
  
  Added test case
sql/sql_view.cc:
  Bug#32575 - Parse error of stmt with extended comments on slave side
  
  Problem was that mysql_create_view did not remove all comments characters
  when writing to binlog, resulting in parse error of stmt on slave side.
  
  Solution was to use the recreated select clause and generate
  'WITH {LOCAL|CASCADED} CHECK OPTION'.
2008-05-08 09:41:22 +02:00
unknown
ac8585e88a Merge bk-internal:/home/bk/mysql-5.0
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam


mysql-test/mysql-test-run.pl:
  Auto merged
2008-05-05 15:04:26 +03:00
unknown
1a68ec2809 Fix for bug #35298: GROUP_CONCAT with DISTINCT can crash the server
The bug is a regression introduced by the patch for bug32798.

The code in Item_func_group_concat::clear() relied on the 'distinct'
variable to check if 'unique_filter' was initialized. That, however,
is not always valid because Item_func_group_concat::setup() can do
shortcuts in some cases w/o initializing 'unique_filter'.

Fixed by checking the value of 'unique_filter' instead of 'distinct'
before dereferencing.


mysql-test/r/func_gconcat.result:
  Added test cases for bugs #35298 and #36024.
mysql-test/t/func_gconcat.test:
  Added test cases for bugs #35298 and #36024.
sql/item_sum.cc:
  Check if unique_filter != NULL before dereferencing it. Non-zero value
  of distinct does not always mean that unique_filter is initialized
  because Item_func_group_concat::setup() can do shortcuts is some cases
2008-05-01 13:49:26 +03:00
unknown
cf2b2cc506 Merge bk-internal:/home/bk/mysql-5.0
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam
2008-05-01 13:40:56 +03:00
unknown
89b866e7bf Bug#36023: Incorrect handling of zero length caused an assertion to fail.
When a zero length is provided to the my_decimal_length_to_precision
function along with unsigned_flag set to false it returns a negative value.
For queries that employs temporary tables may cause failed assertion or
excessive memory consumption while temporary table creation.

Now the my_decimal_length_to_precision and the my_decimal_precision_to_length
functions take unsigned_flag into account only if the length/precision
argument is non-zero.


mysql-test/t/type_decimal.test:
  Added a test case for the bug#36023: Incorrect handling of zero length caused
   an assertion to fail.
mysql-test/r/type_decimal.result:
  Added a test case for the bug#36023: Incorrect handling of zero length caused
   an assertion to fail.
sql/my_decimal.h:
  Bug#36023: Incorrect handling of zero length caused an assertion to fail.
  Now the my_decimal_length_to_precision and the my_decimal_precision_to_length
  functions take unsigned_flag into account only if the length/precision
  argument is non-zero.
2008-04-25 00:39:37 +04:00
unknown
415112a940 subselect.test, subselect.result:
Post-commit minor cleanup of testcase (bug#36139).


mysql-test/r/subselect.result:
  Post-commit minor cleanup of testcase (bug#36139).
mysql-test/t/subselect.test:
  Post-commit minor cleanup of testcase (bug#36139).
2008-04-23 14:22:49 +05:00
unknown
c2d1ac6e2c Merge host.loc:/home/uchum/work/5.0-bugteam-35993
into  host.loc:/home/uchum/work/5.0-bugteam
2008-04-23 02:29:37 +05:00
unknown
73f7de59c2 Fixed bug#36005: server crashes inside NOT IN clause subquery with
impossible WHERE/HAVING clause
                 (subselect_single_select_engine::exec).

Allocation and initialization of joined table list t1, t2... of
subqueries like:

    NOT IN (SELECT ... FROM t1,t2,... WHERE 0)

is optimized out, however server tries to traverse this list.


mysql-test/r/subselect3.result:
  Added test case for bug#36005.
mysql-test/t/subselect3.test:
  Added test case for bug#36005.
sql/sql_select.cc:
  Fixed bug#36005.
  
  1. JOIN::prepare initializes JOIN::table counter (actually a size
     of the JOIN::join_tab array) and sets it to a number of joined tables.
  
  2. The make_join_statistics function (when called from JOIN::optimize)
     allocates and fills the JOIN::join_tab array.
     However, when optimizing subselect has impossible (definite false)
     WHERE or HAVING clause, optimizer skips call to make_join_statistics
     and leaves JOIN::join_tab == NULL.
  
  3. subselect_single_select_engine::exec does traversal of the JOIN::join_tab
     array and the server dies because array is not allocated but array
     counter is greater than 0.
  
  The JOIN::optimize method has been modified to reset the JOIN::table
  counter to 0 in cause of impossible WHERE/HAVING clause.
2008-04-23 02:27:23 +05:00
unknown
d8ebf27639 Fixed bug #35993: memory corruption and crash with multibyte conversion.
Grouping or ordering of long values in not indexed BLOB/TEXT columns
with GBK or BIG5 charsets crashes the server.

MySQL server uses sorting (the filesort procedure) in the temporary
table to evaluate the GROUP BY clause in case of lack of suitable index.
That procedure takes into account only first @max_sort_length bytes
(system variable, usually 1024) of TEXT/BLOB sorting key string.
The my_strnxfrm_gbk and my_strnxfrm_big5 fill temporary keys
with data of whole blob length instead of @max_sort_length bytes
length. That buffer overrun has been fixed.


mysql-test/r/ctype_gbk.result:
  Added test case for bug #35993.
mysql-test/t/ctype_gbk.test:
  Added test case for bug #35993.
strings/ctype-big5.c:
  Fixed bug #35993: memory corruption and crash with multibyte conversion.
  
  Buffer overrun has been fixed in the my_strnxfrm_big5 function.
strings/ctype-gbk.c:
  Fixed bug #35993: memory corruption and crash with multibyte conversion.
  
  Buffer overrun has been fixed in the my_strnxfrm_gbk function.
2008-04-23 02:14:58 +05:00
unknown
1c1f0a62e1 BUG#36139 "float, zerofill, crash with subquery"
- Make convert_zerofill_number_to_string() take into account that the 
  constant it is converting may evaluate to NULL.


mysql-test/r/subselect.result:
  BUG#36139 "float, zerofill, crash with subquery"
  - Testcase
mysql-test/t/subselect.test:
  BUG#36139 "float, zerofill, crash with subquery"
  - Testcase
2008-04-22 02:53:12 +04:00
unknown
a16a72b6c3 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug15776/my50-bug15776
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build


mysql-test/r/type_blob.result:
  Auto merged
mysql-test/t/type_blob.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/unireg.h:
  Auto merged
2008-04-09 12:27:51 -04:00
unknown
2bc7179d2d Follow-up to B-g#15776, test failures on 64-bit linux.
Make maximum blob size to be 2**32-1, regardless of word size.

Fix failure of timestamp with size of 2**31-1.  The method of
rounding up to the nearest even number would overflow.


mysql-test/r/type_blob.result:
  2**32-1 is not a special case for timestamp.
  
  Test 2**32-1 and 2**64 as the reliable test points for both 32-
  and 64-bit machines.  I'd like to test 2**32, but that would make 
  tests that vary between architectures.
  
  I'd like to generalize the tests by pulling the max blob size from
  the server, and then "eval"ing N-1, N, and N+1 instead of all these
  literal numbers, but I have not found a way to get UINT_MAX.
mysql-test/t/type_blob.test:
  2**32-1 is not a special case for timestamp.
  
  Test 2**32-1 and 2**64 as the reliable test points for both 32-
  and 64-bit machines.  I'd like to test 2**32, but that would make 
  tests that vary between architectures.
  
  I'd like to generalize the tests by pulling the max blob size from
  the server, and then "eval"ing N-1, N, and N+1 instead of all these
  literal numbers, but I have not found a way to get UINT_MAX.
sql/field.cc:
  Fix a bug where the round-to-even code for TIMESTAMP fields
  failed where the size would overflow the size to zero and then
  fail.
  
  Also, since we silently truncate the size of TIMESTAMP fields, set
  the maximum size we report is allowable to be the largest parsable
  number.
sql/unireg.h:
  Make BLOB size the maximum that the packed value in 
  field_blob::get_length() allows.
2008-04-09 12:27:30 -04:00
unknown
1a43dd8a24 Merge skozlov@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  mysql.com:/home/ksm/mysql/bugs/commit-mysql-5.0-rpl-bug32653


mysql-test/t/disabled.def:
  Auto merged
2008-04-07 15:59:51 +04:00
unknown
4091635247 Bug#32654. The reason of bug is incorrect clean up during restarting of mysqld under Windows platform (seems some files were in-use).
Mtr restarts servers because an option file exist for slave.
The option file for slave forces to skip test.foo table for replication. 
But really test case does not invlved test.foo table at all.
So option file can be removed and mtr will not restart servers for test case. 


BitKeeper/deleted/.del-rpl_view-slave.opt:
  Rename: mysql-test/t/rpl_view-slave.opt -> BitKeeper/deleted/.del-rpl_view-slave.opt
mysql-test/t/disabled.def:
  updated
2008-04-06 22:24:29 +04:00
unknown
b2799ebf5a Bug#32653.
Added --log-slave-updates because test requires it. 
The events based on LOAD DATA INFILE masked by --replace_regex instead restarting of slave.
Added waiting start and stop of slave after START|STOP SLAVE statements.


mysql-test/r/rpl_log.result:
  updated result file
mysql-test/t/disabled.def:
  updated disabled.def
mysql-test/t/rpl_log-slave.opt:
  updated option for slave
mysql-test/t/rpl_log.test:
  updated test
2008-04-04 01:16:55 +04:00
unknown
a0d02a942a Merge bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build


sql/share/errmsg.txt:
  Auto merged
2008-04-03 11:28:10 -04:00
unknown
cb29e2396b Merge bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build


sql/item_create.cc:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2008-04-02 10:58:37 -04:00
unknown
babd981e41 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug15776/my50-bug15776
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build


sql/field.cc:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/unireg.h:
  Auto merged
mysql-test/r/type_blob.result:
  Manual merge.
mysql-test/t/type_blob.test:
  Manual merge.
2008-04-02 10:56:49 -04:00
unknown
e538761350 Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge


sql/share/errmsg.txt:
  Manual merge.
2008-04-01 08:43:15 +02:00
unknown
a49184af50 Removing race conditions from rpl_packet causing test to fail.
mysql-test/r/rpl_packet.result:
  Result change.
mysql-test/t/rpl_packet.test:
  Setting net_buffer_length correctly for the test instead of relying on it
  being set correctly. Waiting for slave to stop after issuing a SLAVE STOP
  and waiting for slave to start when issuing a SLAVE START to prevent race
  conditions causing test failure.
2008-03-31 16:32:45 +02:00
unknown
d59b8cf093 Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
2008-03-31 09:57:29 +02:00
unknown
7021064aae Fix tree:
1. Use 'dat' extension, because it is handled in Makefile.am;
  2. Fix typo: the bug id is 35469, not 35649.


mysql-test/std_data/bug35469.dat:
  Rename: mysql-test/std_data/bug35649.data -> mysql-test/std_data/bug35469.dat
mysql-test/r/loaddata.result:
  Update result file.
mysql-test/t/loaddata.test:
  1. Use 'dat' extension, because it is handled in Makefile.am;
  2. Fix typo: the bug id is 35469, not 35649.
2008-03-28 23:39:47 +03:00
unknown
4ec65151dc Fix for Bug#35469: server crash with LOAD DATA INFILE to a VIEW.
The problem was that LOAD DATA code (sql_load.cc) didn't take into
account that there may be items, representing references to other
columns. This is a usual case in views. The crash happened because
Item_direct_view_ref was casted to Item_user_var_as_out_param,
which is not a base class.

The fix is to
  1) Handle references properly;
  2) Ensure that an item is treated as a user variable only when
     it is a user variable indeed;
  3) Report an error if LOAD DATA is used to load data into
     non-updatable column.


mysql-test/r/loaddata.result:
  Update result file.
mysql-test/t/loaddata.test:
  Add a test case form Bug#35469: server crash with
  LOAD DATA INFILE to a VIEW.
sql/share/errmsg.txt:
  Introduce a new error.
sql/sql_load.cc:
  Handle reference-items properly.
mysql-test/std_data/bug35649.data:
  Add a data file for the test case.
2008-03-28 18:59:13 +03:00
unknown
7c156537cc Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  moonbone.local:/work/27219-5.0-opt-mysql


sql/item.cc:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
2008-03-28 14:31:52 +03:00
unknown
ab82016ae8 Merge bk-internal:/home/bk/mysql-5.0
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam


sql/sql_acl.cc:
  Auto merged
2008-03-28 11:26:40 +02:00
unknown
b6b4202b48 Merge bk-internal:/home/bk/mysql-5.0
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam
2008-03-28 10:08:24 +02:00
unknown
9d661efd7f Bug#27219: Aggregate functions in ORDER BY.
Mixing aggregate functions and non-grouping columns is not allowed in the
ONLY_FULL_GROUP_BY mode. However in some cases the error wasn't thrown because
of insufficient check.

In order to check more thoroughly the new algorithm employs a list of outer
fields used in a sum function and a SELECT_LEX::full_group_by_flag.
Each non-outer field checked to find out whether it's aggregated or not and
the current select is marked accordingly.
All outer fields that are used under an aggregate function are added to the
Item_sum::outer_fields list and later checked by the Item_sum::check_sum_func
function.


mysql-test/t/group_by.test:
  Added a test case for the bug#27219: Aggregate functions in ORDER BY.
mysql-test/r/group_by.result:
  Added a test case for the bug#27219: Aggregate functions in ORDER BY.
sql/sql_select.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  Implementation of new check for mixing non aggregated fields and aggregation
  function in the ONLY_FULL_GROUP_BY mode.
sql/sql_lex.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  Initialization of the full_group_by_flag bitmap.
  SELECT_LEX::test_limit function doesn't reset ORDER BY
  clause anymore.
sql/sql_lex.h:
  Bug#27219: Aggregate functions in ORDER BY.
  The full_group_by_flag is added to the SELECT_LEX class.
sql/item_sum.h:
  Bug#27219: Aggregate functions in ORDER BY.
  The outer_fields list is added to the Item_sum class.
sql/mysql_priv.h:
  Bug#27219: Aggregate functions in ORDER BY.
  Defined a set of constants used in the new check for mixing non aggregated
  fields and sum functions in the ONLY_FULL_GROUP_BY_MODE.
sql/item_subselect.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  The Item_in_subselect::select_in_like_transformer function now drops
  ORDER BY clause in all selects in a subquery.
sql/item_sum.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  Now the Item_sum::check_sum_func function now checks whether fields in the
  outer_fields list are aggregated or not and marks selects accordingly.
sql/item.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  Now the Item_field::fix_fields function checks whether the field is aggregated
  or not and marks its select_lex accordingly.
2008-03-27 19:49:32 +03:00
unknown
8e473edd48 Merge host.loc:/home/uchum/work/mysql-5.0
into  host.loc:/home/uchum/work/5.0-opt


configure.in:
  Auto merged
sql/item.cc:
  Auto merged
2008-03-27 20:05:51 +04:00
unknown
f8653a79e9 Patch clean up.
Fixed interference between tests: Users were added but not properly removed.
This caused later tests to fail.


mysql-test/r/grant.result:
  Fixed interference between tests: Users were added but not properly removed.
  This caused later tests to fail.
mysql-test/t/grant.test:
  Fixed interference between tests: Users were added but not properly removed.
  This caused later tests to fail.
2008-03-27 09:37:20 -03:00
unknown
861434c3b0 Merge mysql.com:/Users/davi/mysql/mysql-5.1-bug33201
into  mysql.com:/Users/davi/mysql/mysql-5.0-bugteam


sql/sql_acl.cc:
  Auto merged
2008-03-27 09:13:51 -03:00
unknown
11cfd2ed67 Merge host.loc:/home/uchum/work/mysql-5.0
into  host.loc:/home/uchum/work/5.0-opt


sql/sql_delete.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
2008-03-27 15:52:55 +04:00
unknown
4020e6a2d7 post fix after push of BUG#33029
mysql-test/r/binlog_killed_simulate.result:
  Update test result after push of bug#33029
mysql-test/r/mix_innodb_myisam_binlog.result:
  Update test result after push of bug#33029
mysql-test/r/multi_update.result:
  Update test result after push of bug#33029
mysql-test/r/rpl_auto_increment_bug33029.result:
  disable warning messages
mysql-test/r/rpl_user.result:
  Update test result after push of bug#33029
mysql-test/t/rpl_auto_increment_bug33029.test:
  disable warning messages
2008-03-27 13:42:34 +08:00
unknown
ed6b0a2f50 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  mysql.com:/misc/mysql/34731/50-34731
2008-03-27 03:19:21 +01:00
unknown
fd1616311d Merge mysql.com:/misc/mysql/34731_/50-34731
into  mysql.com:/misc/mysql/34731/50-34731


sql/opt_range.cc:
  Auto merged
mysql-test/r/range.result:
  manual merge
mysql-test/t/range.test:
  manual merge
2008-03-27 03:16:35 +01:00
unknown
c3f2e30320 Merge host.loc:/home/uchum/work/5.0-opt-35193
into  host.loc:/home/uchum/work/5.0-opt
2008-03-27 00:44:13 +04:00
unknown
73e1c5ae10 Fix minor complaints of Marc Alff, for patch against B-g#15776.
mysql-test/t/type_blob.test:
  Drop table in case we start from a bad state.
sql/sql_yacc.yy:
  yacc/bison is left-recursive, so FIXME statement is wrong.
2008-03-26 14:52:10 -04:00
unknown
0b8342ba4e Fixed bug #35193.
View definition as SELECT ... FROM DUAL WHERE ... has
valid syntax, but use of such view in SELECT or
SHOW CREATE VIEW syntax causes unexpected syntax error.

Server omits FROM DUAL clause when storing view body
string in a .frm file for further evaluation.
However, syntax of SELECT-witout-FROM query is more
restrictive than SELECT FROM DUAL syntax, and doesn't
allow the WHERE clause.

NOTE: this syntax difference is not documented.


View registration procedure has been modified to
preserve original structure of view's body.



mysql-test/r/view.result:
  Added test case for bug #35193.
mysql-test/t/view.test:
  Added test case for bug #35193.
sql/sql_select.cc:
  Fixed bug #35193.
  The st_select_lex::print function always omits FROM DUAL clause,
  even if original SELECT query has the WHERE clause.
  
  The mysql_register_view function uses this function to reconstruct
  a body of view's AS clause for further evaluation and stores that
  reconstructed clause in a .frm file.
  
  SELECT without FROM syntax is more restrictive than 
  SELECT FROM DUAL syntax: second one allows
  the WHERE clause, but first one is not.
  
  Use of this view in SELECT or SHOW CREATE VIEW queries
  causes unexpected syntax errors.
  
  
  The st_select_lex::print function has been modified to
  reconstruct FROM DUAL clause in queries when needed.
  
  
  TODO: Syntax difference is not documented and should be
  eliminated, however improvement of
  the SELECT-without-FROM syntax is not trivial and leads to
  significant modification of grammar file because of additional
  shift/reduce conflicts.
2008-03-26 22:43:12 +04:00
unknown
4eaa7303fc Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-26 16:48:46 +01:00
unknown
a5ac54566c Merge mail.hezx.com:/media/sda3/work/mysql/bkroot/mysql-5.0-rpl
into  mail.hezx.com:/media/sda3/work/mysql/bkwork/b33029_5.0_to_5.1_fails_on_dup_key/5.0
2008-03-26 21:37:34 +08:00
unknown
7587a8710d Merge stella.local:/home2/mydev/mysql-5.0-ateam
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-26 09:34:37 +01:00
unknown
0d6f9bad70 Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg


mysql-test/r/ctype_big5.result:
  Auto merged
mysql-test/r/ctype_cp932.result:
  Auto merged
mysql-test/r/ctype_euckr.result:
  Auto merged
mysql-test/r/ctype_gb2312.result:
  Auto merged
mysql-test/r/ctype_gbk.result:
  Auto merged
mysql-test/r/ctype_uca.result:
  Auto merged
mysql-test/r/ctype_ucs.result:
  Auto merged
mysql-test/t/ctype_ucs.test:
  Auto merged
sql/slave.cc:
  Auto merged
2008-03-26 09:33:55 +01:00
unknown
18801aa829 Bug#20906 (Multiple assignments in SET in stored routine produce incorrect
instructions)

This bug can not be reproduced in the current version,
adding the test case to the test suite for coverage, no code change.


mysql-test/r/sp-code.result:
  Bug#20906 (Multiple assignments in SET in stored routine produce incorrect
  instructions)
mysql-test/t/sp-code.test:
  Bug#20906 (Multiple assignments in SET in stored routine produce incorrect
  instructions)
2008-03-25 11:20:11 -06:00
unknown
d62c9e33ca information_schema.test, information_schema.result:
Minor test case cleanup after bug#34529.


mysql-test/r/information_schema.result:
  Minor test case cleanup after bug#34529.
mysql-test/t/information_schema.test:
  Minor test case cleanup after bug#34529.
2008-03-25 19:44:27 +04:00
unknown
4816e7b7fb Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0
into  quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged


sql/sql_delete.cc:
  Auto merged
2008-03-25 14:53:23 +03:00
unknown
5ad505dda2 BUG#35509 - Federated leaks memory when connecting to
localhost/default port

When creating federated table that points to unspecified host or
localhost on unspecified port or port is 0, small memory leak occurs.

This happens because we make a copy of unix socket path, which is
never freed.

With this fix we do not make a copy of unix socket path, instead
share->socket points to MYSQL_UNIX_ADDR constant directly.

This fix is covered by a test case for BUG34788.

Affects 5.0 only.


mysql-test/t/federated.test:
  A test case for BUG#35509.
sql/ha_federated.cc:
  When creating federated table we call parse_url() to check if connect
  string is correct. parse_url() may make a copy of unix socket path if
  port is not specified or 0 and host is not specified or 'localhost'.
  This copy is never freed.
  
  As there is no need to make a copy of unix socket path, let
  share->socket point to MYSQL_UNIX_ADDR directly.
2008-03-25 12:47:57 +04:00
unknown
00be935419 Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  riffraff.(none):/data0/autopush/my50-bug34529
2008-03-24 16:19:50 +01:00
unknown
21bd55afec Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/33334/my50-33334


client/mysqltest.c:
  Auto merged
2008-03-23 21:53:36 +04:00
unknown
1a841e074a Merge mysql1000.(none):/home/andrei/MySQL/FIXES/5.0/bug35178_bh_ai
into  mysql1000.(none):/home/andrei/MySQL/MERGE/5.0-bug18199_35178
2008-03-21 16:11:07 +02:00
unknown
4717ba4405 Merge mysql1000.(none):/home/andrei/MySQL/FIXES/5.0/bug18199-purge_no_warn
into  mysql1000.(none):/home/andrei/MySQL/MERGE/5.0-bug18199_35178


sql/log.cc:
  Auto merged
2008-03-21 16:10:15 +02:00
unknown
8030bdfc16 BUG#34788 - malformed federated connection url is not handled
correctly - crashes server !

Creating federated table with connect string containing empty
(zero-length) host name and port is evaluated as 0 (port is
incorrect, omitted or 0) crashes server.

This happens because federated calls strcmp() with NULL pointer.

Fixed by avoiding strcmp() call if hostname is set to NULL.


mysql-test/r/federated.result:
  A test case for BUG#34788.
mysql-test/t/federated.test:
  A test case for BUG#34788.
sql/ha_federated.cc:
  Fixed that parse_url() may call strcmp() with NULL pointer.
2008-03-20 19:07:17 +04:00
unknown
070a233415 Merge host.loc:/home/uchum/work/PA/5.0-opt-34763
into  host.loc:/home/uchum/work/5.0-opt


sql/item.cc:
  Auto merged
2008-03-20 00:29:50 +04:00
unknown
5a6996dbcd Bug #35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables
binlogging of insert into a autoincrement blackhole table ignored
an explicit set insert_id.

Fixed with refining of the blackhole's insert method to call
update_auto_increment() that prepares binlogging the insert query 
with the preceeding set insert_id.

Note, as the engine does not store any actual data one has to explicitly
provide to the server with the value of the autoincrement column via
set insert_id. Otherwise binlogging will happend with the default 
set insert_id=1.


mysql-test/r/blackhole.result:
  results changed
mysql-test/t/blackhole.test:
  a regression test for the bug added
sql/ha_blackhole.cc:
  blackhole's insert method is refined to call update_auto_increment()
  that prepares binlogging the insert query with the preceeding set insert_id.
2008-03-19 18:44:50 +02:00
unknown
3c5894baaa Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY
When swapping out heap I_S tables to disk, this is done after plan refinement.
Thus, READ_RECORD::file will still point to the (deleted) heap handler at start
of execution. This causes segmentation fault if join buffering is used and the 
query is a star query where the result is found to be empty before accessing
some table. In this case that table has not been initialized (i.e. had its 
READ_RECORD re-initialized) before the cleanup routine tries to close the handler.
Fixed by updating READ_RECORD::file when changing handler.


mysql-test/r/information_schema.result:
  Bug#34529: Test result.
mysql-test/t/information_schema.test:
  Bug#34529: Test case.
sql/sql_show.cc:
  Bug#34529: The fix.
2008-03-19 14:32:28 +01:00
unknown
e12afb1e8d Merge kaamos.(none):/data/src/opt/bug34512/my50
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-03-19 16:30:56 +03:00
unknown
4018b13915 Bug #33334 mysqltest_embedded crashes when disconnecting before reap.
Before breaking the connection we have to check that there's no query
  executing at the moment. Otherwise it can lead to crash in embedded server.


client/mysqltest.c:
  Bug #33334 mysqltest_embedded crashes when disconnecting before reap.
  
  Wait until the query thread is finished before we break the connection.
  Waiting part moved to a separate wait_query_thread_end() function
mysql-test/r/flush.result:
  Bug #33334 mysqltest_embedded crashes when disconnecting before reap.
  
  test result
mysql-test/t/flush.test:
  Bug #33334 mysqltest_embedded crashes when disconnecting before reap.
  
  test case
2008-03-19 15:51:22 +04:00
unknown
f77686df0d Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0
into  quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged


libmysql/libmysql.c:
  Auto merged
sql-common/client.c:
  Auto merged
tests/mysql_client_test.c:
  Manually merged.
2008-03-18 13:53:51 +03:00