Commit graph

115 commits

Author SHA1 Message Date
unknown
0ce02f6d98 Fix for bug #22533: Traditional: Too-long bit value not rejected.
Problem: storing >=8 byte hexadecimal values we don't check data.
Fix: check if the data fits the {u}longlong range.


mysql-test/r/select.result:
  Fix for bug #22533: Traditional: Too-long bit value not rejected.
    - test result.
mysql-test/t/range.test:
  Fix for bug #22533: Traditional: Too-long bit value not rejected.
    - adjusted.
mysql-test/t/select.test:
  Fix for bug #22533: Traditional: Too-long bit value not rejected.
    - test case.
sql/item.cc:
  Fix for bug #22533: Traditional: Too-long bit value not rejected.
    - limit storing value to {U}LONGLONG_MAX in numeric context.
2006-12-06 16:32:12 +04:00
unknown
70d27b3503 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-4.1-opt
into  rakia.(none):/home/kgeorge/mysql/autopush/B21019-4.1-opt


sql/sql_select.cc:
  Auto merged
mysql-test/r/select.result:
  SCCS merged
mysql-test/t/select.test:
  SCCS merged
2006-07-26 18:49:26 +03:00
unknown
5ca1ee5eea Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
When optimizing conditions like 'a = <some_val> OR a IS NULL' so that they're
 united into a single condition on the key and checked together the server must 
 check which value is the NULL value in a correct way : not only using ->is_null 
 but also check if the expression doesn't depend on any tables referenced in the 
 current statement. 
 This additional check must be performed because that optimization takes place 
 before the actual execution of the statement, so if the field was initialized 
 to NULL from a previous statement the optimization would be applied incorrectly.


mysql-test/r/select.result:
  Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
   - test case
mysql-test/t/select.test:
  Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
   - test case. 
     Note that ALTER TABLE is important here : it happens to
     leave the Field instance for t1.b set to NULL, witch is vital for
     demonstrating the problem fixed by this changeset.
sql/sql_select.cc:
  Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
   - check whether a value is null taking into account its table dependency.
2006-07-26 13:32:28 +03:00
unknown
585b5bbc92 Fix for BUG#20954: avg(keyval) retuns 0.38 but max(keyval) returns an empty set
The problem was in that opt_sum_query() replaced MIN/MAX functions
with the corresponding constant found in a key, but due to imprecise
representation of float numbers, when evaluating the where clause,
this comparison failed.

When MIN/MAX optimization detects that all tables can be removed,
also remove all conjuncts in a where clause that refer to these
tables. As a result of this fix, these conditions are not evaluated
twice, and in the case of float number comparisons we do not discard
result rows due to imprecise float representation.

As a side-effect this fix also corrects an unnoticed problem in
bug 12882.


mysql-test/r/func_group.result:
  BUG#20954 - test result adjustment.
  Adjusted the test result of bug 12882 which was not preperly fixed.
  The current patch corrects the problem that was fully corrected by the
  patch for 12882.
  
  The problem was that opt_sum_query() indicated that the optimizer may
  remove all tables because all MIN/MAX/COUNT functions are constants,
  but this lead to an empty result instead of NULL because the WHERE
  clause was still evaluated.
  
  The current fix removes all conjuncts in the where clause that
  reference the removed tables, and thus corrects the problem.
mysql-test/r/select.result:
  BUG#20954 - added test
mysql-test/r/subselect.result:
  BUG#20954 - test result adjustment.
  
  The fix removes those conditions in a where clause that refer to
  tables optimized away by MIN/MAX optimization (opt_sum_query()).
mysql-test/t/select.test:
  BUG#20954 - added test
sql/sql_select.cc:
  Fix for BUG#20954: avg(keyval) retuns 0.38 but max(keyval) returns an empty set
  
  When MIN/MAX optimization detects that all tables can be removed,
  also remove all conjuncts in a where clause that refer to these
  tables. As a result of this fix, these conditions are not evaluated
  twice, and in the case of float number comparisons we do not discard
  result rows due to imprecise float representation.
  
  As a side-effect this fix also corrects an unnoticed problem in
  bug 12882.
2006-07-26 01:11:19 +03:00
unknown
3e7d68b11c select.result:
Added test case for bug#18759 Incorrect string to numeric conversion.  
select.test:
  Added test case for bug#18759 Incorrect string to numeric conversion.
item_cmpfunc.cc:
  Cleanup after fix for bug#18360 removal


sql/item_cmpfunc.cc:
  Cleanup after fix for bug#18360 removal
mysql-test/t/select.test:
  Added test case for bug#18759 Incorrect string to numeric conversion.
mysql-test/r/select.result:
  Added test case for bug#18759 Incorrect string to numeric conversion.
2006-06-20 23:05:55 +04:00
unknown
d0f39b6aeb Manually merged
sql/item_timefunc.cc:
  Auto merged
sql/item_timefunc.h:
  Auto merged
2006-06-17 02:11:12 +04:00
unknown
3390eaa085 Bug #4981: 4.x and 5.x produce non-optimal execution path,
3.23 regression test failure

The member SEL_ARG::min_flag was not initialized, 
due to which the condition for no GEOM_FLAG in function 
key_or did not choose "Range checked for each record" as 
the correct access method.


mysql-test/r/select.result:
  testcase for 'Range checked' access method
mysql-test/t/select.test:
  testcase for 'Range checked' access method
sql/opt_range.cc:
  All of the class members initialized
2006-06-02 12:04:03 +03:00
unknown
a2993441ab Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX
refers to a column name.


mysql-test/r/select.result:
  Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX
  refers to a column name.
  Added a new test case.
mysql-test/t/select.test:
  Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX
  refers to a column name.
  Added a new test case.
sql/share/czech/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/danish/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/dutch/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/english/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/estonian/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/french/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/german/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/greek/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.\
sql/share/hungarian/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/italian/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/japanese-sjis/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.\
sql/share/japanese/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/korean/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/norwegian-ny/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/norwegian/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/polish/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/portuguese/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/romanian/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/russian/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/serbian/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/slovak/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/spanish/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/swedish/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
sql/share/ukrainian/errmsg.txt:
  Removed error message ER_INDEX_DOES_NOT_EXIST,
  used ER_KEY_DOES_NOT_EXITS instead.
2006-05-30 00:08:58 -07:00
unknown
42104b2efd Fixed bug #17873: confusing error message when IGNORE/USE/FORCE INDEX
refers to a column name.
Added a new error message ER_INDEX_DOES_NOT_EXIST.


include/mysqld_error.h:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
include/sql_state.h:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
mysql-test/r/explain.result:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
mysql-test/r/key_cache.result:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
mysql-test/r/preload.result:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
mysql-test/r/select.result:
  Added a test case for bug #17873.
mysql-test/t/explain.test:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
mysql-test/t/select.test:
  Added a test case for bug #17873.
sql/share/czech/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/danish/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/dutch/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/english/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/estonian/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/french/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/german/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/greek/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/hungarian/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/italian/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/japanese-sjis/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/japanese/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/korean/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/norwegian-ny/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/norwegian/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/polish/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/portuguese/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/romanian/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/russian/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/serbian/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/slovak/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/spanish/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/swedish/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
sql/share/ukrainian/errmsg.txt:
  Fixed bug #17873.
  Added a new error message ER_INDEX_DOES_NOT_EXIST.
2006-05-27 23:57:33 -07:00
unknown
3190b21f95 Fix bug #14482 Wrongly applied optimization in resolve_const_item() caused
crash

resolve_const_item() substitutes item which will evaluate to constant with
equvalent constant item, basing on the item's result type. In this case
subselect was resolved as constant, and resolve_const_item() was substituting
it's result's Item_caches to Item_null. Later Item_cache's function was called
for Item_null object, which caused server crash.

resolve_const_item() now substitutes constants for items with 
result_type == ROW_RESULT only for Item_rows.


sql/item.cc:
  Fix bug #14482 Wrongly applied optimization in resolve_const_item() caused
  crash
  
  resolve_const_item() now applies optimization for items with
  result_type == ROW_RESULT only to Item_rows.
mysql-test/t/select.test:
  Test case for bug #14482 Wrongly applied optimization in resolve_const_item() caused crash
mysql-test/r/select.result:
  Test case for bug #14482 Wrongly applied optimization in resolve_const_item() caused crash
2005-11-24 19:16:51 +03:00
unknown
fb94ffdaf5 select.result:
After merge fix


mysql-test/r/select.result:
  After merge fix
2005-10-27 18:36:11 +04:00
unknown
111b40e156 Manually merged
include/config-netware.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/select.result:
  Manually merged fix for bug#13855
mysql-test/t/select.test:
  Manuall merged fix for bug#13855
2005-10-27 17:44:28 +04:00
unknown
0390de8672 Fix bug #13855 select distinct with group by caused server crash
DISTINCT wasn't optimized away and caused creation of tmp table in wrong
case. This result in integer overrun and running out of memory.

Fix backported from 4.1. Now if optimizer founds that in result be only 1
row it removes distinct.


sql/sql_select.cc:
  Fix bug #13855 select distinct with group by caused server crash
mysql-test/r/select.result:
  Test case for bug#13855 select distinct with group by caused server crash
mysql-test/t/select.test:
   Test case for bug#13855 select distinct with group by caused server crash
2005-10-14 01:22:24 +04:00
unknown
3d332ea76f merging 2005-10-13 19:51:07 +05:00
unknown
2a0183b54d merging
sql/sql_select.cc:
  Auto merged
2005-10-13 19:31:09 +05:00
unknown
2e887f794a Fix for bug #3874 (Group by field is not considered)
mysql-test/r/select.result:
  test result fixed
mysql-test/t/select.test:
  test case added
sql/sql_select.cc:
  do the same for nullable
2005-10-13 19:23:52 +05:00
unknown
8b6ba46c2c Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into moonbone.local:/work/13535-bug-4.1-mysql


mysql-test/r/select.result:
  Auto merged
mysql-test/t/select.test:
  Auto merged
2005-10-13 17:17:32 +04:00
unknown
d68f16e215 Manual merged
sql/item.cc:
  Auto merged
2005-10-13 01:14:58 +04:00
unknown
228d5c42fa Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into moonbone.local:/work/13535-bug-4.1-mysql


mysql-test/r/select.result:
  Auto merged
mysql-test/t/select.test:
  Auto merged
2005-10-13 00:16:33 +04:00
unknown
b455f7c575 Manual merge, fix for bug #7672
mysql-test/r/select.result:
  Manual merge
mysql-test/t/select.test:
  Manual merge
sql/item.cc:
  Manual merge
sql/sql_lex.cc:
  Manual merge
sql/sql_lex.h:
  Manual merge
sql/sql_select.cc:
  Manual merge
2005-10-12 03:32:14 +04:00
unknown
f3f84ed8a0 Fix bug#7672 Unknown column error in order clause
When fixing Item_func_plus in ORDER BY clause field c is searched in all
opened tables, but because c is an alias it wasn't found there.

This patch adds a flag to select_lex which allows Item_field::fix_fields() 
to look up in select's item_list to find aliased fields.


sql/item.cc:
  Fix bug#7672 Unknown column error in order clause
  When fixing fields in ORDER BY clause allow Item_field::fix_fields() to look up items in select's item list to find aliased fields.
sql/sql_lex.cc:
   Fix bug#7672 Unknown column error in order clause
sql/sql_lex.h:
  Fix bug#7672 Unknown column error in order clause
  Added flag to select_lex allowing Item_field::fix_fields to look up items in select's item list.
sql/sql_select.cc:
  Fix bug#7672 Unknown column error in order clause
mysql-test/t/select.test:
  Test case for bug#7672 Unknown column error in order clause
mysql-test/r/select.result:
  Test case for bug#7672 Unknown column error in order clause
2005-10-09 23:05:44 +04:00
unknown
3dcf205664 Review of new code since last pull
- Use %lx instead of %p as %p is not portable
- Don't replace ROW item with Item_null


myisam/mi_rkey.c:
  Use %lx instead of %p as %p is not portable
myisam/mi_search.c:
  Use %lx instead of %p as %p is not portable
mysql-test/r/select.result:
  More test for ROW comparison
mysql-test/t/select.test:
  More test for ROW comparison
sql/item.cc:
  We can't replace a ROW item with Item_null because:
  - Arg_comparator is still using the orignal row items and it's not good to have args[0] different from what is actually compared
  - If we are using the <=> comparator, NULL can still be compared as true
  - We would break things if we would ever use resolve_const_item() for operators like >, < etc.
2005-10-07 03:12:15 +03:00
unknown
78e8833f39 Fix bug#13535 Incorrect result from SELECT statement after SHOW TABLE STATUS
After SHOW TABLE STATUS last_insert_id wasn't cleaned, and next select
erroneously rewrites WHERE condition and returs a row;
5.0 isn't affected because of different SHOW TABLE STATUS handling.

last_insert_id cleanup added to mysqld_extend_show_tables().


sql/sql_show.cc:
  Fix bug #13535 Incorrect result from SELECT statement after SHOW TABLE STATUS
  Added last_insert_id cleanup after SHOW TABLE STATUS command.
mysql-test/t/select.test:
  Test case for bug #13535 Incorrect result from SELECT statement after SHOW TABLE STATUS
mysql-test/r/select.result:
  Test case for bug #13535 Incorrect result from SELECT statement after SHOW TABLE STATUS
2005-10-03 23:22:46 +04:00
unknown
a17b3dcbe3 Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items.
resolve_const_item() assumed to be not called for Item_row items. For
ensuring that DBUG_ASSERT(0) was set there.

This patch adds section for Item_row items. If it can it recursively calls
resolve_const_item() for each item the Item_row contains. If any of the
contained items is null then whole Item_row substitued by Item_null. Otherwise
it just returns.


sql/item.cc:
  Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items.
  
  Added section to resolve_const_item() for Item_row items. If it can it
  recursively calls resolve_const_item() for each item the Item_row contains. If
  any of the contained items is null then Item_row is substituted by Item_null.
  Otherwise it just returns.
  Comment moved closer to function it belongs to.
mysql-test/t/select.test:
  Test case for bug#13356 resolve_const_item() wasn't able to handle Item_row items.
mysql-test/r/select.result:
  Test case for bug#13356 resolve_const_item() wasn't able to handle Item_row items.
2005-09-28 00:58:12 +04:00
unknown
3a31f7b91f Simple fixes during review of new code
include/my_global.h:
  Added floatget() to read unaligned flaot
mysql-test/r/select.result:
  Added test for found_rows()
mysql-test/t/select.test:
  Added test for found_rows()
sql/des_key_file.cc:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
sql/field_conv.cc:
  Added optimizzed varsion of do_cut_string (for simple character sets)
sql/item_func.cc:
  Simplify code (and ensure DBUG_ENTER is excuted before main code)
sql/item_strfunc.cc:
  Safe calculation of max_length
  This was needed as max_length can now be 1<<32-1 (after konstantins recent patch to fix BLOB_LENGTH)
  Remove init_des_key_file() as this is not initialized in mysqld.cc
sql/item_timefunc.cc:
  Safe calculation of max_length
  This was needed as max_length can now be 1<<32-1 (after konstantins recent patch to fix BLOB_LENGTH)
sql/log_event.cc:
  Simplify code
sql/mysql_priv.h:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
sql/mysqld.cc:
  Moved initalization of LOCK_des_key_file to mysqld to make simpler code and avoid theoretical race condition
  Revert wrong patch of calling close_connection() in first close_connections() loop. (Bug #7403)
  Instead we now print a warning for closed connections only if mysqld is sarted with --warnings
  Added comments to make the close_connections() logic clearer
sql/sql_prepare.cc:
  Use floatget() and doubleget() to protect against unaligned data
sql/sql_select.cc:
  Fixed some cases unlikely cases where found_rows() would return wrong for queries that would return 0 or 1 rows
2005-07-19 19:25:05 +03:00
unknown
6a88fa48ae select.result, select.test:
Added a test case for bug #11745.
sql_select.cc:
  Fixed bug # 11745.
  Added support of where clause for queries with FROM DUAL.
sql_yacc.yy:
  Fixed bug # 11745.
  Added optional where clause for queries with FROM DUAL.


sql/sql_yacc.yy:
  Fixed bug # 11745.
  Added optional where clause for queries with FROM DUAL.
sql/sql_select.cc:
  Fixed bug # 11745.
  Added support of where clause for queries with FROM DUAL.
mysql-test/t/select.test:
  Added a test case for bug #11745.
mysql-test/r/select.result:
  Added a test case for bug #11745.
2005-07-17 09:46:14 -07:00
unknown
7adfe96d9e Added test for Bug #11521
"Negative integer keys incorrectly substituted for 0 during range analysis."

The problem is that the range optimizer incorrectly replaces any negative
constant with '0' for all types except BIGINT because the method save_in_field()
casts negative integers to non-negative. This causes incorrect query
results where (0 = any_negative_number).

The problem caused by this bug is fixed by the patch for BUG#11185.
That patch constitutes an optimization due to which the problem code is
never called with negative constants. This patch adds a test so we are sure
that the problem does not reappear.


mysql-test/r/select.result:
  Test for BUG#11521.
mysql-test/t/select.test:
  Test for BUG#11521.
2005-07-16 10:30:25 +03:00
unknown
0f41fb4234 Fix bug#11482 4.1.12 produces different resultset for a complex query
than in previous 4.1.x

Wrongly applied optimization were adding NOT NULL constraint which results in
rejecting valid rows and reduced result set.

The problem was that add_notnull_conds() while checking subquery were adding
NOT NULL constraint to left joined table, to which, normally, optimization 
don't have to be applied.


sql/sql_select.cc:
  Fix bug #11482 Wrongly applied optimization was erroneously rejecting valid rows
  Constraint were added to optimization appliance test.
mysql-test/t/select.test:
  Test case for bug #11482  Wrongly applied optimization was erroneously rejecting valid rows
mysql-test/r/select.result:
  Test case for bug #11482  Wrongly applied optimization was erroneously rejecting valid rows
2005-07-16 03:29:12 +04:00
unknown
d91c901f61 Fix for BUG#11700: in add_not_null_conds(), call full fix_fields() for the created NOT NULL.
This is needed because in some cases range optimization is performed twice and added 
  NOT NULL item must have correct const_table_map() value. 


mysql-test/r/select.result:
  Testcase for BUG#11700
mysql-test/t/select.test:
  Testcase for BUG#11700
2005-07-14 15:13:36 +00:00
unknown
3aca0a0c62 fixed not_null_tables() for IN() (BUG#9393)
(IN() remove NULL rows only for tables from first argument (value which we looking for in IN() list) but not for tables from IN() list)
Also it will be better change Item::not_null_tables() to prohibit this optimisation by default for new created items in 5.0 or 5.1.


mysql-test/r/select.result:
  IN with outer join condition
mysql-test/t/select.test:
  IN with outer join condition
sql/item_cmpfunc.h:
  correct not_null_tables() for IN
2005-06-28 22:20:25 +03:00
unknown
801c2c275a Added a test case for Bug#8009.
sql/item.cc:
  Fixed Bug#8009.
2005-05-24 17:50:17 +03:00
unknown
275aa24740 after merge fix 2005-05-19 09:47:13 +02:00
unknown
7e507270b8 merged
sql/unireg.cc:
  Auto merged
2005-05-18 22:14:08 +02:00
unknown
06736ab48a Fix for BUG#10095: {wrong query results because of incorrect constant propagation}
The problem: base_list::remove didn't modify base_list::last when removing 
the last list element.
The fix: If we remove the last element, find the element before it (by walking
from the beginning of the list) and set base_list::last accordingly.

The list gets corrupted in both 4.0 and 4.1. There are no visible problems in 
current 4.1 because current 4.1 doesn't call where_cond->fix_fields() after 
constant propagation step.


mysql-test/r/select.result:
  Testcase for BUG#10095
mysql-test/t/select.test:
  Testcase for BUG#10095
sql/sql_list.h:
  Fix for BUG#10095: {wrong query results because of incorrect constant propagation} 
  The problem: base_list::remove didn't modify base_list::last when removing 
  the last list element.
  The fix: If we remove the last element, find the element before it (by walking
  from the beginning of the list) and set base_list::last accordingly.
2005-05-15 22:56:45 +02:00
unknown
2a695127a6 Fixes during review
mysql-test/r/select.result:
  Better error message
mysql-test/t/select.test:
  Better error message
sql/hostname.cc:
  Join identical code
sql/sql_yacc.yy:
  Combine code (and get a better error message)
strings/ctype-ucs2.c:
  Cast pointer differencess
2005-05-13 14:04:32 +03:00
unknown
19b8643830 Bug#8733 - server accepts malformed query (multiply mentioned distinct)
Detect conflicting options in SELECT


mysql-test/r/select.result:
  Test for bug#8733
mysql-test/t/select.test:
  Test for bug#8733
sql/mysql_priv.h:
  New bit for ALL
sql/sql_yacc.yy:
  We want to complain if DISTINCT or ALL is used in SELECT when a
  conflicting option is already selected.
2005-05-09 14:31:46 +01:00
unknown
dd882cfb64 Merge embedded-server testing changes.
mysql-test/r/ctype_ucs.result:
  Auto merged
mysql-test/r/ps_1general.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/type_blob.result:
  Auto merged
mysql-test/r/type_float.result:
  Auto merged
mysql-test/r/user_var.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/ctype_ucs.test:
  Auto merged
mysql-test/t/grant2.test:
  Auto merged
mysql-test/t/mysqldump.test:
  Auto merged
mysql-test/t/select.test:
  Auto merged
mysql-test/t/show_check.test:
  Auto merged
mysql-test/t/type_float.test:
  Auto merged
mysql-test/t/user_var.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/mysql-test-run.sh:
  Merge changes
mysql-test/t/ps_1general.test:
  Merge changes
2005-04-01 16:43:35 -08:00
unknown
f0148b21c3 Remove result.es files and support for them, which requires splitting
up a couple of tests and adjusting the output of others. Exposes two
bugs (9472 and 9508).


BitKeeper/deleted/.del-drop_temp_table.result.es~bc4cfb1ee1257458:
  Delete: mysql-test/r/drop_temp_table.result.es
BitKeeper/deleted/.del-insert_select.result.es~ae7eb9891d6c07c4:
  Delete: mysql-test/r/insert_select.result.es
BitKeeper/deleted/.del-myisam-blob.result.es~d498dae7d9f1a6d4:
  Delete: mysql-test/r/myisam-blob.result.es
BitKeeper/deleted/.del-packet.result.es~6e71c3b634806185:
  Delete: mysql-test/r/packet.result.es
BitKeeper/deleted/.del-query_cache.result.es~246ad731a517d9ab:
  Delete: mysql-test/r/query_cache.result.es
BitKeeper/deleted/.del-select.result.es~240635f6a3f1a079:
  Delete: mysql-test/r/select.result.es
BitKeeper/deleted/.del-type_blob.result.es~a4a0d4454b2d0218:
  Delete: mysql-test/r/type_blob.result.es
BitKeeper/deleted/.del-type_float.result.es~a5533e4118eadc04:
  Delete: mysql-test/r/type_float.result.es
BitKeeper/deleted/.del-type_ranges.result.es~bb77517f4c9dc978:
  Delete: mysql-test/r/type_ranges.result.es
mysql-test/mysql-test-run.sh:
  Remove support for special result extension -- bad idea!
mysql-test/t/ps_1general.test:
  Explain --replace_result
mysql-test/r/insert_select.result:
  Update results
mysql-test/r/select.result:
  Update results
mysql-test/r/type_blob.result:
  Update results
mysql-test/r/type_float.result:
  Update results
mysql-test/r/type_ranges.result:
  Update results
mysql-test/t/drop_temp_table.test:
  Skip this test with embedded server
mysql-test/t/insert_select.test:
  Move binlog test to new file
mysql-test/t/select.test:
  Replace grants column from 'show full columns'
mysql-test/t/type_blob.test:
  Replace grants column from 'show full columns'
mysql-test/t/type_float.test:
  Replace grants column from 'show full columns'
mysql-test/t/type_ranges.test:
  Replace grants column from 'show full columns'
sql/sql_select.cc:
  Fix conditional around query_cache_abort() call.
2005-03-30 17:32:44 -08:00
unknown
146df30f79 Fix for BUG#7425.
The reported problems were due to two completely unrelated omissions.
1) The file sort procedure didn't correctly create the sort key in
   make_sortkey when the sortkey was an unsigned integer.
2) The name resolution procedure for column references inside a HAVING
   clause did not propagate the unsigned_flag of the resolved references.
This patch corrects both problems.


mysql-test/r/select.result:
  Added test result for BUG#7425.
mysql-test/t/select.test:
  Added test for BUG#7425.
sql/filesort.cc:
  Take into account whether 'item' represents a signed or an unsigned integer.
sql/item.cc:
  Once an Item_ref is resolved, propagate the unsigned_flag to the resolved item.
2005-03-09 16:51:03 +02:00
unknown
7f905da3d8 select.result, select.test:
Added a test case for bug #7098.
sql_select.cc:
  Fixed bug #7098.
  When a string field was substituted for an equal constant
  the collation of the constant was changed by mistake for 
  the binary collation.


sql/sql_select.cc:
  Fixed bug #7098.
  When a string field was substituted for an equal constant
  the collation of the constant was changed by mistake for 
  the binary collation.
mysql-test/t/select.test:
  Added a test case for bug #7098.
mysql-test/r/select.result:
  Added a test case for bug #7098.
2005-02-16 21:17:20 -08:00
unknown
aa3727d7dc select.result:
After revision of the fix for bug #7520.
table.cc:
  Revised the fix for bug #7520.
  Made it compliant with 5.0 code where the bug does not exist.


sql/table.cc:
  Revised the fix for bug #7520.
  Made it compliant with 5.0 code where the bug does not exist.
mysql-test/r/select.result:
  After revision of the fix for bug #7520.
2005-02-11 10:39:26 -08:00
unknown
d78bd41f55 select.result:
Adjusted results of the test case for bug #7520 for 4.1.


mysql-test/r/select.result:
  Adjusted results of the test case for bug #7520 for 4.1.
2005-02-10 23:47:57 -08:00
unknown
dca07cf034 Merge rurik.mysql.com:/home/igor/dev/mysql-4.0-0
into rurik.mysql.com:/home/igor/dev/mysql-4.1-0


BitKeeper/etc/logging_ok:
  auto-union
extra/replace.c:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/t/select.test:
  Auto merged
sql/table.cc:
  Auto merged
2005-02-10 22:17:18 -08:00
unknown
9540945624 select.result, select.test:
Added a test case for bug #7520.
table.cc:
  Fixed bug #7520.
  The bug was caused by a wrong calculation of the field max_key_length for
  a TABLE structure when there was an index on a blob field.


sql/table.cc:
  Fixed bug #7520.
  The bug was caused by a wrong calculation of the field max_key_length for
  a TABLE structure when there was an index on a blob field.
mysql-test/t/select.test:
  Added a test case for bug #7520.
mysql-test/r/select.result:
  Added a test case for bug #7520.
2005-02-10 22:15:38 -08:00
unknown
1b898a2246 post-merge fix 2004-11-28 19:48:41 +01:00
unknown
dd33501f9e merged
BitKeeper/etc/logging_ok:
  auto-union
innobase/srv/srv0srv.c:
  Auto merged
mysql-test/t/select.test:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/slave.cc:
  Auto merged
2004-11-28 18:19:01 +01:00
unknown
60af920628 Fixes while reviewing code
(Cleanups and better bug fixes)


mysql-test/r/select.result:
  Fixed test after wrong merge
mysql-test/t/select.test:
  Fixed test after wrong merge
scripts/mysql_fix_privilege_tables.sh:
  Don't read defaults files
sql/item_cmpfunc.cc:
  Fix wrong value for not_null_tables_cache
sql/item_cmpfunc.h:
  Remove wrong patch (flags are set in fix_length_and_dec())
sql/item_func.h:
  Fix wrong value for not_null_tables_cache
sql/slave.cc:
  Fixed indentation
2004-11-26 02:31:22 +02:00
unknown
0dcb55f470 Merge for BUG#3759 which was missing from the main tree for some reason.
BitKeeper/etc/logging_ok:
  auto-union
sql/item_cmpfunc.h:
  Auto merged
mysql-test/r/select.result:
  Merge for BUG#3759
mysql-test/t/select.test:
  Merge for BUG#3759
2004-11-25 11:37:28 +02:00
unknown
0f9f2b02c1 A fix (bug #6449: DO server-crashing bug).
sql/sql_yacc.yy:
  A fix (bug #6449: DO server-crashing bug).
  expr_list is used for DO command.
2004-11-16 14:36:25 +04:00
unknown
96e7be58c8 After merge fixes
Some bigger code changes was necessary becasue of the multi-table-update and the new HANDLER code


include/hash.h:
  Added back function that's was used in 4.0
mysql-test/r/delete.result:
  Update results after merge
mysql-test/r/flush_table.result:
  Update results after merge
mysql-test/r/func_str.result:
  Update results after merge
mysql-test/r/handler.result:
  Update results after merge
  Change is big becasue in MySQL 4.1 you are not allowed to qualify the handler alias with a databasename
mysql-test/r/multi_update.result:
  More startup cleanups
mysql-test/r/rename.result:
  More startup-cleanups
mysql-test/r/select.result:
  More startup cleanups
mysql-test/r/show_check.result:
  More startup-cleanups
mysql-test/t/ctype_latin1_de.test:
  Cleanup
mysql-test/t/derived.test:
  Portability fix
mysql-test/t/handler.test:
  Update results after merge
  Change is big becasue in MySQL 4.1 you are not allowed to qualify the handler alias with a databasename
mysql-test/t/multi_update.test:
  More startup cleanups
mysql-test/t/range.test:
  More comments
mysql-test/t/rename.test:
  More startup cleanups
mysql-test/t/select.test:
  More startup cleanups
mysql-test/t/show_check.test:
  More startup cleanups
mysql-test/t/type_timestamp.test:
  Add back test deleted during merge
sql/item_cmpfunc.cc:
  After merge fixes
sql/item_func.cc:
  Remove compiler warning
sql/mysql_priv.h:
  After merge fixes
sql/mysqld.cc:
  After merge fixes
sql/sql_acl.cc:
  More debugging
sql/sql_base.cc:
  After merge fixes
  (This fix was needed bacause of multi-table-update reopens tables)
sql/sql_handler.cc:
  After merge fixes
sql/sql_lex.h:
  After merge fixes
sql/sql_select.cc:
  After merge fixes
sql/sql_show.cc:
  After merge fixes
sql/sql_table.cc:
  After merge fixes
  Simple cleanup of mysql_discard_or_import_tablespace
sql/sql_update.cc:
  After merge fixes
  Rework mysql_multi_update to take into account derived tables.
sql/sql_yacc.yy:
  After merge fixes
2004-10-07 10:50:13 +03:00