Commit graph

193 commits

Author SHA1 Message Date
ramil/ram@mysql.com/myoffice.izhnet.ru
0027b6e4b7 Fix for bug #20732: Partial index and long sjis search with '>' fails sometimes
We miss some records sometimes using RANGE method if we have
partial key segments.
Example:
  Create table t1(a char(2), key(a(1)));
  insert into t1 values ('a'), ('xx');
  select a from t1 where a > 'x';
We call index_read() passing 'x' key and HA_READ_AFTER_KEY flag
in the handler::read_range_first() wich is wrong because we have
a partial key segment for the field and might miss records like 'xx'.

Fix: don't use open segments in such a case.
2006-10-19 12:52:37 +05:00
jimw@rama.(none)
caf4392f71 Merge bk-internal:/home/bk/mysql-4.1-maint
into  rama.(none):/home/jimw/my/mysql-4.1-clean
2006-09-28 18:11:29 -07:00
jimw@rama.(none)
cb6a084076 Bug #2717: include/my_global.h mis-defines __attribute__
Fix when __attribute__() is stubbed out, add ATTRIBUTE_FORMAT() for specifying
  __attribute__((format(...))) safely, make more use of the format attribute,
  and fix some of the warnings that this turns up (plus a bonus unrelated one).
2006-08-17 12:25:40 -07:00
gkodinov/kgeorge@macbook.gmz
3183f73601 Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
Reseting subqueries with "quick" access methods was incomplete.
 Partially backported the correct reseting of QUICK_SELECTs from 5.x.
2006-08-03 19:20:30 +03:00
sergefp@mysql.com
61348cac0c Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/home/psergey/mysql-4.1-bug16168-push
2006-07-01 01:55:43 +04:00
sergefp@mysql.com
611e20d8e1 BUG#16168: Wrong results from range optimizer, "Use_count: Wrong count for key ..." warnings:
- Added comments.
 - Make SEL_ARG::clone() set SEL_ARG::elements in the created copy.
2006-06-30 09:05:12 +04:00
gkodinov@mysql.com
96ceb6c234 gcc 4.1 linux warning fixes backported from 5.0. 2006-06-28 16:28:29 +03:00
gkodinov@mysql.com
b519877c90 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.
2006-06-02 12:04:03 +03:00
sergefp@mysql.com
b91173af11 BUG#12915: post-review fixes 2005-10-18 14:04:14 +04:00
sergefp@mysql.com
e9f2f9437a BUG#12915: Added single-table UPDATE/DELTE ... ORDER BY ... LIMIT
optimization: now can use index to find records to update/delete
when there is no WHERE clause.
2005-09-30 15:21:37 +04:00
aivanov@mysql.com
fa51afedeb item_cmpfunc.h:
Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   The classes Item_func_between, Item_func_if, Item_func_in are modified.
   Item_func_between/in objects can represent now [NOT]BETWEEN/IN expressions.
   The class Item_func_opt_neg is added to factor out the functionality
   common for the modified classes Item_func_between and Item_func_in.
item_cmpfunc.cc:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   Added Item_func_between::fix_fields(), Item_func_if::fix_fields(),
   Item_func_in::fix_fields(). They correct generic calculation of
   the not_null_tables attribute when it is needed.
   Modified Item_func_between::val_int(), Item_func_in::val_int().
opt_range.cc:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   The function get_mm_tree() is modified. There cannot be NOT before
   BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
   now [NOT]BETWEEN/IN expressions.
sql_yacc.yy:
  Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
   for some expressions.
   Item_func_between/in objects can represent now [NOT]BETWEEN/IN expresions.
join_outer.result:
  Fixed some testcases results (bugs #12101, #12102)
join_outer.test:
  Added testcases for bugs #12101, #12102
2005-09-06 18:03:08 +04:00
monty@mysql.com
10c4678def Move reset of insert_values to ensure it's done also during error conditions
This fixed a failure of insert_update.test on some platforms
2005-06-28 15:06:16 +03:00
kent@mysql.com
b3a00568fb opt_range.cc:
Added missing `;' to DBUG_RETURN()
2005-06-28 04:33:06 +02:00
timour@mysql.com
294498e203 Fix for BUG#11185.
The source of the problem is in Field_longlong::cmp. If 'this' is
an unsigned number, the method casts both the current value, and
the constant that we compare with to an unsigned number. As a
result if the constant we compare with is a negative number, it
wraps to some unsigned number, and the comparison is incorrect.

When the optimizer chooses the "range" access method, this problem
causes handler::read_range_next to reject the current key when the
upper bound key is a negative number because handler::compare_key
incorrectly considers the positive and negative keys to be equal.

The current patch does not correct the source of the problem in
Field_longlong::cmp because it is not easy to propagate sign
information about the constant at query execution time. Instead
the patch changes the range optimizer so that it never compares
unsiged fields with negative constants. As an added benefit,
queries that do such comparisons will execute faster because
the range optimizer replaces conditions like:
(a) (unsigned_int [< | <=] negative_constant) == FALSE
(b) (unsigned_int [> | >=] negative_constant) == TRUE
with the corresponding constants.
In some cases this may even result in constant time execution.
2005-06-23 10:56:44 +03:00
serg@serg.mylan
6a5349028c a compiler must see '#pragma implementation' *before*
'#pragma interface' (that comes with the #include'd header file)
2005-06-05 19:38:52 +02:00
monty@mysql.com
29fd1f2fd9 Move USE_PRAGMA_IMPLEMENTATION to proper place
Ensure that 'null_value' is not accessed before val() is called in FIELD() functions
Fixed initialization of key maps. This fixes some problems with keys when you have more than 64 keys
Fixed that ROLLUP don't always create a temporary table. This fix ensures that func_gconcat.test results are now predictable
2005-06-03 23:46:03 +03:00
kent@mysql.com
bd48eed988 tztime.cc:
Set #pragma implementation" earlier
Many files:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
2005-06-02 02:43:32 +02:00
msvensson@neptunus.(none)
83d430353e Add ifdefs to control when "#pragma implementation" should be used
Added some more ifdefs for "#pragma interface"
2005-05-26 12:09:14 +02:00
sergefp@mysql.com
a76ecc5bc7 Fix for BUG#9103:
Don't produce data truncation warnings from within cp_buffer_from_ref(). This function
is only used to make index search tuples and data truncation that occurs here has no
relation with truncated values being saved into tables.
2005-04-18 05:21:44 +04:00
sergefp@mysql.com
2ef1963c91 Fix for BUG#9348: when computing union of two intervals set lower bound to
minimum of lower bounds of two joined intervals.
2005-04-17 02:05:09 +04:00
monty@mysql.com
b903a129e2 Simpler arena swapping code
Now thd->mem_root is a pointer to thd->main_mem_root and THR_MALLOC is a pointer to thd->mem_root.
This gives us the following benefits:
- Allow us to easily detect if arena has already been swapped before (this fixes a bug in setup_conds() where arena was swaped twice in some cases)
- Faster swaps of arenas (as we don't have to copy the whole MEM_ROOT)
- We don't anymore have to call my_pthread_setspecific_ptr(THR_MALLOC,...) to change where memory is alloced. Now it's enough to set thd->mem_root
2004-11-08 01:13:54 +02:00
bar@mysql.com
45451568bf opt_range.cc, range.result, range.test:
Bug #6045: Binary Comparison regression in MySQL 4.1
  Binary searches didn't use a case insensitive index, now they do.
2004-11-03 15:22:33 +04:00
magnus@neptunus.(none)
ac9016df91 Initialise "sorted" variable in constructor of QUICK_SELECT. The variable is set to 1 in test_if_skip_sort_order if we decide to optimize "order by" by uinsg index_read. 2004-10-07 11:57:48 +02:00
dlenev@brandersnatch.localdomain
f5d1b711c6 Implementation of Monty's idea about clear_alloc_root() optimization and cleanup of work
with memory roots in THD/Statement/Item_arena.
Added assertions preventing memory allocation on bzero'ed MEM_ROOT since it is worked by 
pure luck and was very ineffective.
2004-09-23 13:48:17 +04:00
serg@serg.mylan
62c2f1c161 sql_print_error cleanup 2004-09-04 20:17:09 +02:00
ram@gw.mysql.r18.ru
49868b9fd4 Should check for GEOM_FLAG later because keyX may be partly initialized (min_flag is not set). 2004-08-26 17:43:08 +05:00
ram@gw.mysql.r18.ru
2133721ac6 A fix (Bug#5219: Cannot use '||' with MBRContains(..)). 2004-08-26 16:51:26 +05:00
monty@mysql.com
db7efa2780 New handler::index_flags() definition to make it easy to check the full used key and a specific key part.
Added key part to optimize_range() to fix problems when using fields in key parts.
2004-07-08 15:45:25 +03:00
serg@serg.mylan
d2adc38cb6 merged 2004-06-25 23:20:46 +02:00
serg@serg.mylan
924de89305 release cursors in return_zero_rows 2004-06-25 21:43:02 +02:00
monty@mysql.com
e7a01ed3dc After merge fixes 2004-06-25 21:56:23 +03:00
serg@serg.mylan
b511996ff4 workaround for gcc 2.95.3 bug
anybody knows how to distinguish 2.95.3 from 2.95.4 (which is ok) ?
2004-06-25 01:25:02 +02:00
serg@serg.mylan
1ff21a9e64 bug#4089 - JOIN::join_free calling mysql_unlock w/o index_end() before 2004-06-24 19:46:50 +02:00
serg@serg.mylan
c03addab79 merged 2004-06-23 12:36:07 +02:00
serg@serg.mylan
3f1c4ba745 handler interface cleanups:
more logical table/index_flags
  return  HA_ERR_WRONG_COMMAND instead of abstract methods where appropriate
  max_keys and other limits renamed to max_supported_keys/etc
  max_keys/etc are now wrappers to max_supported_keys/etc 
  ha_index_init/ha_rnd_init/ha_index_end/ha_rnd_end are now wrappers to real {index,rnd}_{init,end} to enforce strict pairing
2004-06-23 12:29:05 +02:00
monty@mysql.com
b11d258835 Merge with 4.0.21 2004-06-18 04:38:58 +03:00
monty@mysql.com
fd6858dccd Fixed unlikely bug in the range optimzer when using many IN() queries on different key parts. (Bug #4157) 2004-06-18 02:31:11 +03:00
konstantin@mysql.com
f207b33a7b Support for character set conversion in binary protocol: another go
after Monty's review.
- Item_param was rewritten.
- it turns out that we can't convert string data to character set of
  connection on the fly, because they first should be written to the binary
  log.
  To support efficient conversion we need to rewrite prepared statements
  binlogging code first.
2004-05-25 02:03:49 +04:00
monty@mysql.com
56c0258536 After merge fixes
Remove compiler warnings
Update windows project files
2004-05-24 14:42:34 +03:00
monty@mishka.local
314a8bf114 key_cmp -> key_cmp_if_same
New records_in_range() interface (similar to read_range())
Macros for faster bitmap handling
Simplify read_range() code (#WL1786)
New general key_cmp() function to compare keys
2004-05-16 14:48:32 +03:00
miguel@hegel.local
8d1480f7c5 Windows fixes for VC++ compiler compability 2004-05-05 02:59:17 -03:00
monty@mysql.com
00738a2be0 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
2004-04-08 15:02:25 +03:00
monty@mysql.com
43546e7a82 Moved reading of ranges from opt_range.cc to handler.cc
This gives the handler more optimization possiblities and is needed for NDB cluster
Fixed not-initialized memory error detected by valgrind
2004-04-08 13:58:06 +03:00
monty@mysql.com
e94d935221 Cleanup/optimizations of structures and key usage to make it easier to move key-range-search to handler 2004-04-08 01:50:59 +03:00
serg@serg.mylan
e8eda8129f ::reset(), HA_FAST_KEY_READ, disable_indexes(), enable_indexes(), start_bulk_insert(), end_bulk_insert()
Field::val_str simplification, comment
2004-04-06 21:35:26 +02:00
monty@mysql.com
53c810cda4 merge fixes (use old code) 2004-03-18 00:16:04 +02:00
hf@deer.(none)
5868807b92 Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into deer.(none):/home/hf/work/mysql-4.1.233
2004-03-17 14:04:02 +04:00
monty@mysql.com
350b433569 merge with 4.0 2004-03-16 22:41:30 +02:00
hf@deer.(none)
ceaac59c42 Fix for #233 (the second one) 2004-03-16 13:26:37 +04:00
miguel@hegel.local
0c92e90441 Cast for VC++ compiler errors 2004-03-12 18:05:51 -03:00