Commit graph

143 commits

Author SHA1 Message Date
Sergei Golubchik
febe1e8503 Merge branch '10.0' into 10.1 2018-03-23 17:40:53 +01:00
Varun Gupta
ddc5c65333 MDEV-14779: using left join causes incorrect results with materialization and derived tables
Conversion of a subquery to a semi-join is blocked when we have an
IN subquery predicate in the on_expr of an outer join. Currently this
scenario is handled but the cases when an IN subquery predicate is wrapped
inside a Item_in_optimizer item then this blocking is not done.
2018-03-22 03:01:53 +05:30
Vicențiu Ciorbaru
e3d89652e5 Merge branch '10.0' into 10.1 2017-12-20 13:30:05 +02:00
Varun Gupta
b8d1398b1d MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields
For BIT field null_bit is not set to 0 even for a field defined as NOT NULL.
So now in the function TABLE::create_key_part_by_field, if the bit field is not nullable
then the null_bit is explicitly set to 0
2017-11-30 11:56:02 +02:00
Marko Mäkelä
30df297c2f Merge 10.0 into 10.1
Rewrite the test encryption.innodb-checksum-algorithm not to
require any restarts or re-bootstrapping, and to cover all
innodb_page_size combinations.

Test innodb.101_compatibility with all innodb_page_size combinations.
2017-06-06 10:59:54 +03:00
Oleksandr Byelkin
b8405c853f MDEV-11958: LEFT JOIN with stored routine produces incorrect result
Added forgoten method of Item_func_sp to make it correctly work with LEFT/RIGHT JOIN.
Fixed inconsistency with the null table caches.
2017-05-23 11:06:31 +02:00
Sergei Petrunia
5c68bc2c32 MDEV-10006: optimizer doesn't convert outer join to inner on views with WHERE clause
When simplify_joins() converts an outer join to an inner, it should
reset the value of TABLE::dep_tables.  This is needed, because the
function may have already set TABLE::dep_tables according to the outer
join dependency.
2016-05-11 15:55:14 +03:00
Sergei Golubchik
853077ad7e Merge branch '10.0' into bb-10.1-merge
Conflicts:
	.bzrignore
	VERSION
	cmake/plugin.cmake
	debian/dist/Debian/control
	debian/dist/Ubuntu/control
	mysql-test/r/join_outer.result
	mysql-test/r/join_outer_jcl6.result
	mysql-test/r/null.result
	mysql-test/r/old-mode.result
	mysql-test/r/union.result
	mysql-test/t/join_outer.test
	mysql-test/t/null.test
	mysql-test/t/old-mode.test
	mysql-test/t/union.test
	packaging/rpm-oel/mysql.spec.in
	scripts/mysql_config.sh
	sql/ha_ndbcluster.cc
	sql/ha_ndbcluster_binlog.cc
	sql/ha_ndbcluster_cond.cc
	sql/item_cmpfunc.h
	sql/lock.cc
	sql/sql_select.cc
	sql/sql_show.cc
	sql/sql_update.cc
	sql/sql_yacc.yy
	storage/innobase/buf/buf0flu.cc
	storage/innobase/fil/fil0fil.cc
	storage/innobase/include/srv0srv.h
	storage/innobase/lock/lock0lock.cc
	storage/tokudb/CMakeLists.txt
	storage/xtradb/buf/buf0flu.cc
	storage/xtradb/fil/fil0fil.cc
	storage/xtradb/include/srv0srv.h
	storage/xtradb/lock/lock0lock.cc
	support-files/mysql.spec.sh
2014-12-02 22:25:16 +01:00
Sergey Petrunya
30b28babdc Merge 5.3->5.5 2014-10-29 13:22:48 +03:00
Sergey Petrunya
94c8f33569 MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled
- TABLE::create_key_part_by_field() should not set PART_KEY_FLAG in field->flags
  = The reason is that it is used by hash join code which calls it to create a hash
    table lookup structure. It doesn't create a real index.
  = Another caller of the function is TABLE::add_tmp_key(). Made it to set the flag itself.

- The differences in join_cache.result could also be observed before this patch: one
  could put "FLUSH TABLES" before the queries and get exactly the same difference.
2014-10-29 01:20:45 +03:00
Sergei Petrunia
378878e1e9 MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate
IS [NOT] NULL predicate is sargable within an outer join. Range
analysis only uses predicates from ON expressions, which have
regular semantics (without null-complemented rows, etc).
There is no reason not use IS [NOT] NULL predicates.
2014-08-24 12:36:51 +04:00
Sergei Golubchik
5d0c01608c 5.2 merge 2014-03-16 21:03:01 +01:00
Sergei Golubchik
e772cbd7b7 5.1 merge 2014-03-16 13:59:44 +01:00
Sergei Golubchik
d7304375e5 mysql-5.1.73 merge 2014-03-15 18:24:15 +01:00
Sergey Petrunya
92003f0166 MDEV-4836: Merge into 5.5-main 2013-09-03 18:41:07 +04:00
Igor Babaev
59af095da4 Merge 5.3->5.5 2013-08-29 12:32:09 -07:00
Igor Babaev
37f18d2318 Fixed bug mdev-4962.
When a non-nullable datetime field is used under an IS NULL predicate
of the WHERE condition in a query with outer joins the remove_eq_conds
function should check whether this field belongs to an inner table
of any outer join that can be, in a general case, a nested outer join.
2013-08-29 10:56:12 -07:00
Sergey Petrunya
d6f7649d3c mdev-4942: Add another testcase after merging with other fixes. 2013-08-28 21:21:12 +04:00
Sergey Petrunya
184df98582 Automatic merge of MDEV-4836 fix into 5.5 2013-08-28 20:31:23 +04:00
Igor Babaev
34aa69564d Merge 5.3->5.5 2013-08-27 22:19:14 -07:00
Igor Babaev
650d3266bb Fixed bug mdev-4952
When in function remove_eq_conds() a sub-formula of the processed condition
is replaced for another formula we should ensure that in the resulting
formula AND/OR levels must alternate.
2013-08-26 15:51:47 -07:00
Sergey Petrunya
edd980225a Fix for MDEV-4836 fix: take into account situation where "notnull_col IS NULL" is not
a direct child of the WHERE clause item, but rather is embedded inside Item_cond_and or 
Item_cond_or.
2013-08-26 21:38:04 +04:00
Sergey Petrunya
af753c2188 Fix for MDEV-4836: Merge with current 5.5 2013-08-26 16:31:58 +04:00
Sergey Petrunya
7907b9b4da Merge fix for MDEV-4942, 5.3->5.5 2013-08-26 16:23:14 +04:00
Igor Babaev
dbc84ff96c Fixed bug mdev-4942.
Made sure that degenerate conjunctions/disjunctions are obtained from
AND/OR conditions.
2013-08-23 22:17:02 -07:00
Sergey Petrunya
970542ec90 MDEV-4836: Wrong result on <not null date column> IS NULL (old documented hack stopped working)
- When applying optimization introduced by MDEV-4817, ignore the conditions that have form
  "datetime_not_null_col IS NULL".
2013-08-23 16:32:56 +04:00
Sergey Petrunya
04684b7709 MDEV-4817: Optimizer fails to optimize expression of the form 'FOO' IS NULL
- Modify the way Item_cond::fix_fields() and Item_cond::eval_not_null_tables() 
  calculate bitmap for Item_cond_or::not_null_tables():
  if they see a "... OR inexpensive_const_false_item OR ..." then the item can
  be ignored.
- Updated test results. There can be more warnings produced since parts of WHERE 
  are evaluated more times.
2013-07-31 17:24:52 +04:00
Sergei Golubchik
b381cf843c mysql-5.5.31 merge 2013-05-07 13:05:09 +02:00
Igor Babaev
75befe7526 Merge 5.3->5.5 2013-05-04 21:56:45 -07:00
Igor Babaev
920c479c6e Fixed bug mdev-4336.
When iterating over a list of conditions using List_iterator
the function remove_eq_conds should skip all predicates that
replace a condition from the list. Otherwise it can come to
an infinite recursion.
2013-05-03 22:46:45 -07:00
Chaithra Gopalareddy
cb72ecbe2c Merge from 5.1 to 5.5 2013-01-11 06:36:53 +05:30
Chaithra Gopalareddy
8b41f491c8 Bug#11760726: LEFT JOIN OPTIMIZED INTO JOIN LEADS TO
INCORRECT RESULTS

This is a backport of fix for Bug#13068506.

mysql-test/r/join_outer.result:
  Added test result for Bug#13068506
mysql-test/t/join_outer.test:
  Added test case for Bug#13068506
sql/item.h:
  Implement Item_outer_ref::not_null_tables()
2013-01-10 16:17:13 +05:30
unknown
e10fecc02f Merge 5.2->5.3 2012-05-11 11:40:23 +03:00
Sergei Golubchik
1185420da0 5.3 merge 2012-05-21 20:54:41 +02:00
unknown
f2cbc014d9 fix for LP bug#994392
The not_null_tables() of Item_func_not_all and Item_in_optimizer was inherited from
Item_func by mistake. It made the optimizer think that  subquery
predicates with ALL/ANY/IN were null-rejecting. This could trigger invalid
conversions of outer joins into inner joins.
2012-05-11 09:35:46 +03:00
Sergei Golubchik
a3073ecd96 merge 2012-04-05 23:07:18 +02:00
Sergei Golubchik
dea3544b2d mysql-5.1.62 merge 2012-04-05 10:49:38 +02:00
Sergei Golubchik
20e706689d mysql-5.5.22 merge
mysql-test/suite/innodb/t/group_commit_crash.test:
  remove autoincrement to avoid rbr being used for insert ... select
mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test:
  remove autoincrement to avoid rbr being used for insert ... select
mysys/my_addr_resolve.c:
  a pointer to a buffer is returned to the caller -> the buffer cannot be on the stack
mysys/stacktrace.c:
  my_vsnprintf() is ok here, in 5.5
2012-03-28 01:04:46 +02:00
Igor Babaev
8b469eb515 Merge 5.3->5.5. 2012-03-01 14:22:22 -08:00
Igor Babaev
000deedf3b Fixed LP bug #943543.
This bug appeared after the patch for bug 939009 that in the
function merge_key_fields forgot to reset a proper value for
the val field in the result of the merge operation of the key
field created for a regular key access and  the key field
created to look for a NULL key.

Adjusted the results of the test case for bug 939009 that
actually were incorrect.
2012-02-29 23:28:16 -08:00
Martin Hansson
bb9a3be632 Merge of fix for Bug#11765810. 2012-02-07 17:32:04 +01:00
Martin Hansson
9ada2f8ec5 Bug #11765810 58813: SERVER THREAD HANGS WHEN JOIN + WHERE + GROUP BY
IS EXECUTED TWICE FROM P

This bug is a duplicate of bug 12567331, which was pushed to the
optimizer backporting tree on 2011-06-11. This is just a back-port of
the fix. Both test cases are included as they differ somewhat.
2012-02-07 14:16:09 +01:00
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +01:00
Igor Babaev
a910e8ef5b Made join_cache_level == 2 by default. 2011-12-15 14:26:59 -08:00
Igor Babaev
f5dac20f38 Made the optimizer switch flags 'outer_join_with_cache', 'semijoin_with_cache'
set to 'on' by default.
2011-12-15 00:21:15 -08:00
Sergei Golubchik
d2755a2c9c 5.3->5.5 merge 2011-11-22 18:04:38 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Igor Babaev
715dc5f99d Fixed a cost estimation bug introduced into in the function best_access_path
of the 5.3 code line after a merge with 5.2 on 2010-10-28
in order not to allow the cost to access a joined table to be equal
to 0 ever.

Expanded data sets for many test cases to get the same execution plans
as before.
2011-09-30 18:55:02 -07:00
Igor Babaev
da59130ec1 Fixed LP bug #838633.
For any query JOIN::optimize() should call the method
SELECT::save_leaf_tables after the last transformation
that utilizes the statement memory rather than the 
execution memory.
2011-09-06 07:17:39 -07:00
Igor Babaev
249a10c7dd Fixed LP bug #825035.
The value of maybe_null flag should be saved for the second execution
of a prepared statement from SELECT that uses an outer join.
2011-08-16 22:48:35 -07:00