Commit graph

29195 commits

Author SHA1 Message Date
Sergey Petrunya
ddc21f7977 Fix compile failure:
In function ‘void* memset(void*, int, size_t)’,
    inlined from ‘void Lifo_buffer::set_buffer_space(uchar*, uchar*)’ at sql_lifo_buffer.h:70:5,
    inlined from ‘int DsMrr_impl::dsmrr_init(handler*, RANGE_SEQ_IF*, void*, uint, uint, HANDLER_BUFFER*)’ at multi_range_read.cc:895:62:
/usr/include/i386-linux-gnu/bits/string3.h:82:32: error: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [-Werror]

It was intentional that the buffer is set to zero length there.
2014-02-19 17:52:47 +04:00
Sergey Petrunya
260c802e7d Add a debugger helper function that does this:
(gdb) p dbug_print_table_row(table)
  $33 = "SUBQUERY2_t1(col_int_key,col_varchar_nokey)=(7,c)"
2014-02-19 17:47:02 +04:00
Sergey Petrunya
097b644006 MDEV-5600: Wrong result on 2nd execution of PS depending on the length of the query
- Item_direct_view_ref didn't clear its pointer to item_equal in ::cleanup.
- Some Item_direct_view_ref objects have statement lifetime (i.e. they
  survive across multiple EXECUTE commands). Item_equal objects live only for
  the duration of one EXECUTE. This caused Item_direct_view_ref to have a stale pointer,
  which could cause all sorts of effects. (In this bug's testcase it was pointing to
  the wrong Item_equal, causing wrong query result)
- Fixed by doing what Item_field::cleanup() does - don't keep item_equal pointer value.
- There is no testcase because the only testcase I've got is highly fragile (e.g. the
  bug will not show up if @@datadir is of the wrong length).
2014-02-19 17:45:33 +04:00
Alexey Botchkov
820b1a6687 MDEV-5615 crash in Gcalc_function::add_operation.
The result is EMPTY for a buffer(line, -1), but we still
need one FALSE operation to be stored in the condition.
And we actually add it but forgot to alloc memory to store it.
2014-02-18 17:15:25 +04:00
Sergey Petrunya
8c9b2f3429 MDEV-5581: Server crashes in in JOIN::prepare on 2nd execution of PS with materialization+semijoin
- The problem was that JOIN::prepare() tried to set TABLE::maybe_null
  for a table in join. Non-merged semi-join tables 1) are present as 
  join's base tables on second EXECUTE, but 2) do not yet have a TABLE 
  object.
  Worked around the problem by putting mixed_implicit_grouping into JOIN
  object, and then passing it to JTBM tables in setup_jtbm_semi_joins().
2014-02-15 01:21:46 +04:00
Sergei Golubchik
12253abadb MDEV-714 LP:1020645 - crash (sig 11) with union query
Don't ignore the error from st_select_lex_unit::optimize()
2014-02-13 20:21:57 +01:00
Sergei Golubchik
4b57720caa use a different error for MySQL bug#11747970 - kill the query,
as it was supposed to be in bug#11747970, don't fake an error.
(this kill can be useful for other bugs too)
2014-02-13 20:20:17 +01:00
Sergei Golubchik
642495345f Remove the fix from MySQL-5.1 that's not necessary in 5.3 2014-02-13 20:18:07 +01:00
Sergei Golubchik
913beda8c8 5.2 merge 2014-02-13 10:15:03 +01:00
Sergei Golubchik
48445f3556 5.1 merge 2014-02-13 08:25:33 +01:00
Sergei Golubchik
5f5d2db141 fix embedded tests
(mainly by backporting 5.5. changes)

mysql-test/suite/maria/t/distinct.test:
  Remove the test that requires SSL. One test case for a bug is enough.
sql/scheduler.cc:
  make it the same as in 5.5
storage/innodb_plugin/row/row0mysql.c:
  make it the same as in 5.5
storage/innodb_plugin/row/row0sel.c:
  make it the same as in 5.5
storage/xtradb/row/row0mysql.c:
  make it the same as in 5.5
storage/xtradb/row/row0sel.c:
  make it the same as in 5.5
2014-02-13 08:09:07 +01:00
Sergei Golubchik
52f038c5c3 MDEV-5655 Server crashes on NAME_CONST containing AND/OR expressions
fix the NAME_CONST check to only allow literals, negated literals, and literals with
the explicit collation.
2014-02-12 21:17:28 +01:00
Igor Babaev
3845a89b01 Merge 2014-02-07 16:55:25 -08:00
Igor Babaev
50b9e30b72 Fixed bug mdev-5611.
The method Item_field::update_table_bitmaps() should not try
to mark the bit for a self-referencing virtual column.
2014-02-07 15:50:36 -08:00
Sergey Petrunya
cfbc545d1a Merge 2014-02-07 23:57:55 +04:00
Sergey Petrunya
34b6f51dab MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
- Let cleanup_empty_jtbm_semi_joins() walk into semi-join nests.
2014-02-07 20:51:31 +04:00
Igor Babaev
5b441013e1 Fixed bug mdev-5468.
The field JOIN::select_lex->where should be updated after the call
of remove_eq_conds() in the function make_join_statistics(). This
matters for subselects.
2014-02-05 17:47:38 -08:00
unknown
08293a35e6 MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of PS with LEFT JOIN, TEMPTABLE view
Set of JOIN_TYPE_OUTER made only once to avoid interference with optimization joins which made only once per query.
2014-01-28 23:23:14 +02:00
Sergei Golubchik
19b24f8f53 5.1 merge 2014-01-28 10:23:11 +01:00
Alexander Barkov
f189ed5009 MDEV-5506 safe_mutex: Trying to lock unitialized mutex at safemalloc.c
on server shutdown after SELECT with CONVERT_TZ

It's wrong to return my_empty_string from val_str().
Removing my_empty_string. Using make_empty_result() instead.
2014-01-28 12:25:29 +04:00
Alexander Barkov
7ea9d1e692 MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(...):
Assertion `mon > 0 && mon < 13' failed.'
2014-01-27 13:15:40 +04:00
Sergey Petrunya
669c6620af [Backport to 5.3]
MDEV-5337: Wrong result in mariadb 5.5.32 with ORDER BY + LIMIT when 
index_condition_pushdown=on
- in test_if_skip_sort_order(), correct the condition under which
  we have the code that restores the previously pushed index condition.
2014-01-25 00:26:40 +04:00
Alexander Barkov
d106dc0597 MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP
The crash happened because Item_func_monthname was derived from
Item_func_month, so Item_func_monthname::is_null() did not work fine.
Backporting a change from 5.5: Item_func_monthname is now derived from
Item_str_func.
2014-01-24 16:50:39 +04:00
Sergey Petrunya
519c7305ac MDEV-5368: Server crashes in Item_in_subselect::optimize on ...
- convert_subq_to_sj() must connect child select's tables into 
  parent select's TABLE_LIST::next_local chain.  
- The problem was that it took child's leaf_tables.head() which
  is different. This could cause certain tables (in this bug's case,
  child select's non-merged semi-join) not to be present in 
  TABLE_LIST::next_local chain.  Which would cause non-merged semi-join
  not to be initialized in setup_tables(), which would lead to 
  NULL pointer dereference.
2014-01-23 21:26:04 +04:00
unknown
d9cb1352c8 merge of MDEV-5356 5.1->5.3 (with more fixes and test suite).
THD::thd->activate_stmt_arena_if_needed() should be used to temporary activating statement arena instead of direct usage of THD::set_n_backup_active_arena() because possible such scenario:
  1) func1 saves current arena and activates copy1 of statement arena
  2) func2 saves copy1 of statement arena setup by func1 and activates copy2
  3) some changes made for copy 2
  4) func2 stores changed copy2 back to statenet arena and activates copy1
  5) func1 store unchanged copy1 back to statemnt arena (rewrite changed copy 2 so changes become lost) and activates arena which was before.
2014-01-23 12:05:10 +02:00
unknown
5f5f7befe3 MDEV-5356: Server crashes in Item_equal::contains on 2nd execution of a PS
THD::thd->activate_stmt_arena_if_needed() should be used to temporary activating statement arena instead of direct usage of THD::set_n_backup_active_arena() because possible such scenario:
  1) func1 saves current arena and activates copy1 of statement arena
  2) func2 saves copy1 of statement arena setup by func1 and activates copy2
  3) some changes made for copy 2
  4) func2 stores changed copy2 back to statenet arena and activates copy1
  5) func1 store unchanged copy1 back to statemnt arena (rewrite changed copy 2 so changes become lost) and activates arena which was before.
2014-01-23 11:11:01 +02:00
Sergei Golubchik
aa2f88baa0 5.1 merge 2014-01-21 09:41:28 +01:00
unknown
3aa370bb69 MDEV-5515: 2nd execution of a prepared statement returns wrong results
update_used_tables() should be called after handling derived tables in any case.
2014-01-13 21:30:42 +02:00
unknown
1555f1801d make 5.1 compiling with modern gcc. 2013-12-20 12:35:47 +02:00
unknown
57400ee681 MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQL
Materialization forced in case if rand() used in view or derived table to avoud several calls of rand for gting value of a field.

Fixed set variable uncachable flag from - it shouldbe a side effect not a random value.
2013-12-18 15:59:51 +02: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
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
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
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
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