Commit graph

32061 commits

Author SHA1 Message Date
Michael Widenius
c050b5fdf9 Fixed MDEV-5424: SELECT using ORDER BY DESC and LIMIT produces unexpected results (InnoDB/XtraDB)
This only happend when using an ORDER BY on a primary key part, where all other key parts where constant.
Remove of duplicated expressions in ORDER BY (as the old code did this in some strange cases)


mysql-test/r/group_by.result:
  Fixed results to take into account that duplicate order by parts are now deleted
mysql-test/r/group_by_innodb.result:
  Ensure extended keys are on
mysql-test/r/innodb_ext_key.result:
  More tests
mysql-test/r/order_by.result:
  More tests
mysql-test/t/group_by.test:
  Fixed results to take into account that duplicate order by parts are now deleted
mysql-test/t/group_by_innodb.test:
  Ensure extended keys are on
mysql-test/t/innodb_ext_key.test:
  More tests
mysql-test/t/order_by.test:
  More tests
sql/sql_select.cc:
  Fixed bug where we looked at extended key parts when we shouldn't
  Remove of duplicated expressions in ORDER BY
sql/table.cc:
  Indentation fixes
2014-01-02 15:51:02 +02:00
Sergei Golubchik
50808b30d2 MDEV-5396 Assertion `Handlerton: r==0 ' failed (errno=0) on EXPLAIN with TokuDB tables
Fix EXPLAIN and CREATE SELECT to join_free() (and, thus, ha_index_end())
before ha_commit_trans().
2013-12-17 17:26:54 +01:00
Sergei Golubchik
e68bccc743 5.3 merge 2013-12-13 13:00:38 +01:00
Igor Babaev
3ec4296ec4 Fixed bug mdev-5410.
The fix for bug #27937 was incomplete: it did not handle correctly the queries
containing UNION with global ORDER BY in subselects.
2013-12-12 13:55:33 -08:00
Sergei Golubchik
c47dd98f90 backport from 10.0: "bugfix: MYSQL_THDVAR_STR plugins with PLUGIN_VAR_MEMALLOC didn't work
(PLUGIN_VAR_MEMALLOC is 0x8000 and cannot be saved in a char as such)"
2013-12-12 18:14:08 +01:00
Igor Babaev
fde2777b27 Another attempt to fix the memory leak of mdev-5400. 2013-12-11 10:13:08 -08:00
Igor Babaev
d5262a63fc Fixed bug mdev-5400:
a memory leak in save_index() first seen in the test case for mdev-5382.
2013-12-07 07:51:02 -08:00
Igor Babaev
21d0d8c5bf Merge 2013-12-05 12:40:04 -08:00
Igor Babaev
ccf5871d7b Fixed bug mdev-5382
When marking used columns the function find_field_in_table_ref() erroneously
called the walk method for the real item behind a view/derived table field
with the second parameter set to TRUE.
This erroneous code was introduced in 2006.
2013-12-05 11:13:20 -08:00
unknown
b78f721460 MDEV-5353: server crash on subselect if WHERE applied to some result field
Correct processing of view/derived with no tables added.
2013-12-04 16:54:33 +02:00
Alexander Barkov
62e959437e MDEV-5374 main.func_time fails with valgrind warning
"Conditional jump or move depends on uninitialised"
in Item_time_typecast::get_date.

Adding "null_value" into the debug assert condition.
2013-12-03 15:08:43 +04:00
Alexander Barkov
b97b9536c7 MDEV-4857 Wrong result of HOUR('1 00:00:00')
modified:
  mysql-test/r/func_time.result
  mysql-test/t/func_time.test
  sql-common/my_time.c
  sql/item_func.h
  sql/item_timefunc.cc
  sql/mysql_priv.h
  sql/time.cc
2013-12-02 15:09:34 +04:00
Sergey Petrunya
928543ca6c MDEV-5344: LEFT OUTER JOIN table data is lost in ON DUPLICATE KEY UPDATE section
- For INSERT ... SELECT ... ON DUPLICATE KEY UPDATE, table elimination should 
  check which tables are referenced in the ON DUPLICATE KEY UPDATE clause.
2013-11-27 17:43:16 +04:00
Igor Babaev
998ed51497 Made sure that JOIN::cond_equal is correctly set after the call of
remove_eq_conds() in the function make_join_statistics().
2013-11-24 20:45:16 -08:00
Igor Babaev
59f099dda1 Post-review changes of the patch for bug mdev-5103. 2013-11-22 13:13:03 -08:00
Igor Babaev
8224d95524 Merge 2013-11-21 18:28:20 -08:00
Igor Babaev
c0f31dc9f3 Another attempt to fix bug mdev-5103.
The earlier pushed fix for the bug was incomplete. It did not remove
the main cause of the problem: the function remove_eq_conds()
removed always true multiple equalities from any conjunct, but did not
adjust the list of them stored in Item_cond_and::cond_equal.current_level.

Simplified the test case for the bug and moved it to another test file.

The fix triggered changes in EXPLAIN EXTENDED for some queries.
2013-11-21 15:19:25 -08:00
Alexander Barkov
2394fa67d4 MDEV-4859 Wrong value and data type of "SELECT MAX(time_column) + 1 FROM t1"
Fixed.
2013-11-21 11:46:36 +04:00
Alexander Barkov
5a8bd446ad Merge 5.3->5.5
pending merges:
  Alexander Barkov 2013-12-02 MDEV-4857 Wrong result of HOUR('1 00:00:00')
2013-12-02 15:50:35 +04:00
Alexander Barkov
87355a453d Merge 5.3 -> 5.5
pending merges:
  Sergey Petrunya 2013-11-27 MDEV-5344: LEFT OUTER JOIN table data is lost...
2013-12-02 15:17:21 +04:00
Alexey Botchkov
fb2de58294 MDEV-5321 Calling mysql_library_end accesses freed memory; dumps memory to display.
Don't call the vio_end() in the clean_up() in EMBEDDED mode.
        Call vio_end() before the end_embedded_server().
2013-11-25 21:38:01 +04:00
Igor Babaev
3fc7743435 Merge 2013-11-24 22:10:36 -08:00
Igor Babaev
11eb7333f3 Merge 2013-11-22 18:38:13 -08:00
Igor Babaev
d34e46795e Merge 5.3->5.5 2013-11-21 21:40:43 -08:00
Sergey Petrunya
89ea0fc034 Merge 2013-11-21 11:21:53 +04:00
Alexander Barkov
c7355b1982 Merge 5.3->5.5 2013-11-21 13:09:08 +04:00
Sergey Petrunya
c4defdc8d9 MDEV-5161: Wrong result (missing rows) with semijoin, LEFT JOIN, ORDER BY, constant table
- Don't pull out a table out of a semi-join if it is on the inner side of an outer join.
- Make join->sort_by_table= get_sort_by_table(...) call after const table detection 
  is done. That way, the value of join->sort_by_table will match the actual execution.
  Which will allow the code in setup_semijoin_dups_elimination() (search for 
  "Make sure that possible sorting of rows from the head table is not to be employed." 
  to see that "Using filesort" is going to be used together with Duplicate Elimination (
  and change it to Using temporary + Using filesort)
2013-11-21 11:19:01 +04:00
Sergei Golubchik
45f81d4dcf merge 2013-11-20 09:20:48 +01:00
Sergei Golubchik
fa3f8a18b2 mysql-5.5.34 merge
(some patches reverted, test case added)
2013-11-19 13:16:25 +01:00
Sergey Petrunya
bc956c0046 MDEV-5069: Server crashes in SEL_ARG::increment_use_count with index_merge+index_merge_sort_union, FORCE INDEX
- Don't call incr_refs() is the merged SEL_ARG* is NULL.
2013-11-19 13:47:35 +04:00
Sergey Petrunya
8af289d2b0 MDEV-5293: outer join, join buffering, and order by - invalid query plan
- make_join_readinfo() has the code that forces use of "Using temporary; 
  Using filesort" when join buffering is in use.
  That code didn't handle all cases, in particular it didn't hande the case 
  where ORDER BY originally has tables from multiple columns, but the 
  optimizer eventually figures out that doing filesort() on one table 
  will be sufficient.  Adjusted the code to handle that case.
2013-11-18 12:26:25 +04:00
Sergei Golubchik
718c8c6044 5.3 merge 2013-11-15 10:06:23 +01:00
Igor Babaev
f8a6ee59ac Fixed bug mdev-5288.
This bug was a consequence of the incorrect fix for bug mdev-5091.
2013-11-14 13:25:05 -08:00
Alexander Barkov
9c3a76c879 Merge 5.3->5.5 2013-11-14 16:26:37 +04:00
Igor Babaev
222acc635b Merge 2013-11-13 15:31:12 -08:00
Igor Babaev
ae40c72077 Fixed bug mdev-5091.
The function SELECT_LEX::update_used_tables should process all
ORDER BY lists in any subselect of a union.
2013-11-13 14:43:09 -08:00
Alexander Barkov
d7463f8e59 Merge 5.3 -> 5.5 2013-11-13 19:16:35 +04:00
Alexander Barkov
e4608eb3c1 Merge 5.2 -> 5.3 2013-11-13 18:34:12 +04:00
Alexander Barkov
1bb3a0e3c8 Merge 5.1 -> 5.2 2013-11-13 18:28:40 +04:00
Alexander Barkov
f2cfcd91f5 MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
Allow only one level of symlink recursion in mysql_tzdata_to_sql,
to avoid infinite loops.
2013-11-13 18:26:03 +04:00
unknown
7787835520 incorrect assertion removed 2013-11-13 15:22:57 +02:00
Sergei Golubchik
f3a78f392d 5.3 merge 2013-11-13 13:38:37 +01:00
Sergei Golubchik
b468cd4749 MDEV-5284 Assertion `!(*expr)->fixed' fails in replace_where_subcondition with IN suquery 2013-11-13 12:43:39 +01:00
Sergey Petrunya
86b8ed3eab Merge 2013-11-13 08:29:12 +04:00
Sergey Petrunya
229aa1d4bf MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
Apply fix suggested by Igor:
- When eliminate_item_equal() generates pair-wise equalities from a 
  multi-equality,  do generate a "bridge" equality between the first 
  field inside SJM nest and the field that's first in the overall multi-equality.
2013-11-13 07:40:46 +04:00
Sergei Golubchik
441192bfb0 MDEV-5113 Wrong result (extra row) and valgrind warnings in Item_maxmin_subselect::any_value on 2nd execution of PS with SELECT subquery
When setting Item_func_not_all::test_sum_item or Item_func_not_all::test_sub_item,
reset the other one to NULL - they can never be set both. When a PS is reexecuted,
different executions might be optimized differently and a wrong test_su*_item
might stay set from the previous execution.
2013-11-12 15:02:25 +01:00
Sergey Petrunya
88bf8b9c8f MDEV-5257: MIN/MAX Optimization (Select tables optimized away) does not work for DateTime
- MIN/MAX optimizer does a check whether a "field CMP const" comparison uses a constant 
  that's longer than the field it is compared to.  Make this check only for string columns,
  also compare character lengths, not byte lengths.
2013-11-12 17:37:32 +04:00
Sergei Golubchik
1585652862 MDEV-5236 Status variables are not all listed alphabetically
sort Com_ counters. No simple fix for Binlog_ variables.
2013-11-11 17:20:18 +01:00
unknown
c98a054fde MDEV-5153: Server crashes in Item_ref::fix_fields on 2nd execution of PS with LEFT JOIN and MERGE view or SELECT SQ
1. Transformation of row IN subquery made the same as single value.
2. replace_where_subcondition() made working on several layers of OR/AND because it called on expression before fix_fields().
2013-11-11 17:28:14 +02:00
Sergei Golubchik
f486f49e8d MDEV-4824 userstats - wrong user statistics
(and valgrind warnings)

* move thd userstat initialization to the same function
  that was adding thd userstat to global counters.
* initialize thd->start_bytes_received in THD::init
  (when thd->userstat_running is set)
2013-11-11 16:17:32 +01:00