Commit graph

20 commits

Author SHA1 Message Date
Alexander Barkov
36eba98817 MDEV-19123 Change default charset from latin1 to utf8mb4
Changing the default server character set from latin1 to utf8mb4.
2024-07-11 10:21:07 +04:00
Oleksandr Byelkin
034a175982 Merge branch '10.6' into 10.11 2024-07-04 11:52:07 +02:00
Oleksandr Byelkin
dcd8a64892 Merge branch '10.5' into 10.6 2024-07-03 13:27:23 +02:00
Lena Startseva
9e74a7f4f3 Removing MDEV-27871 from tastcases because it is not a bug 2024-06-28 16:45:50 +07:00
Sergei Golubchik
018d537ec1 Merge branch '10.6' into 10.11 2024-04-22 15:23:10 +02:00
Sergei Golubchik
41296a07c8 Merge branch '10.5' into 10.6 2024-04-11 13:58:22 +02:00
Alexander Barkov
d4936c8b26 MDEV-18898 SELECT using wrong index when using operator IN with mixed types
These patches:

  # commit 74891ed257
  #
  #  MDEV-11514, MDEV-11497, MDEV-11554, MDEV-11555 - IN and CASE type aggregation problems

  # commit 53499cd1ea
  #
  # MDEV-31303 Key not used when IN clause has both signed and usigned values

earlier fixed MDEV-18898.

Adding only an MTR case.

	modified:   mysql-test/main/func_in.result
	modified:   mysql-test/main/func_in.test
2024-04-09 16:05:56 +04:00
Alexander Barkov
6606abb6a4 MDEV-18319 BIGINT UNSIGNED Performance issue
The patch for MDEV-18319 BIGINT UNSIGNED Performance issue
fixed this problem in 10.5.23.

This patch adds only an MTR test to cover MDEV-18319.
2024-04-09 13:27:49 +04:00
Marko Mäkelä
d5e15424d8 Merge 10.6 into 10.10
The MDEV-29693 conflict resolution is from Monty, as well as is
a bug fix where ANALYZE TABLE wrongly built histograms for
single-column PRIMARY KEY.
Also includes a fix for safe_malloc error reporting.

Other things:
- Copied main.log_slow from 10.4 to avoid mtr issue

Disabled test:
- spider/bugfix.mdev_27239 because we started to get
  +Error	1429 Unable to connect to foreign data source: localhost
  -Error	1158 Got an error reading communication packets
- main.delayed
  - Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
    This part is disabled for now as it fails randomly with different
    warnings/errors (no corruption).
2023-10-14 13:36:11 +03:00
Marko Mäkelä
2325f8f339 Merge 10.5 into 10.6 2023-08-31 13:01:42 +03:00
Alexander Barkov
53499cd1ea MDEV-31303 Key not used when IN clause has both signed and usigned values
Summary:

This patch enables possible index optimization when
the WHERE clause has an IN condition of the form:

signed_or_unsigned_column IN (signed_or_unsigned_constant,
                              signed_or_unsigned_constant
                              [,signed_or_unsigned_constant]*)

when the IN list constants are of different signess, e.g.:
  WHERE signed_column   IN (signed_constant, unsigned_constant ...)
  WHERE unsigned_column IN (signed_constant, unsigned_constant ...)

Details:

In a condition like:
   WHERE unsigned_predicant IN (1, LONGLONG_MAX + 1)

comparison handlers for individual (predicant,value) pairs are
calculated as follows:

* unsigned_predicant and 1 produce &type_handler_newdecimal
* unsigned_predicant and (LONGLONG_MAX + 1) produce &type_handler_slonglong

The old code decided that it could not use bisection because
the two pairs had different comparison handlers.
As a result, bisection was not allowed, and, in case of
an indexed integer column predicant the index on the column was not used.

The new code catches special cases like:
    signed_predicant   IN (signed_constant, unsigned_constant)
    unsigned_predicant IN (signed_constant, unsigned_constant)

It enables bisection using in_longlong, which supports a mixture
of predicant and values of different signess.
In case when the predicant is an indexed column this change
automatically enables index range optimization.

Thanks to Vicențiu Ciorbaru for proposing the idea and for preparing MTR tests.
2023-08-29 13:20:10 +03:00
Oleksandr Byelkin
1ebfa2af62 Merge branch '10.6' into 10.7 2022-10-29 19:22:04 +02:00
Sergei Golubchik
09c4253619 MDEV-29895 prepared view crash server (unit.conc_view)
it's incorrect to use change_item_tree() to replace arguments
of top-level AND/OR, because they (arguments) are stored in a List,
so a pointer to an argument is in the list_node, and individual
list_node's of top-level AND/OR can be deleted in Item_cond::build_equal_items().
In that case rollback_item_tree_changes() will modify the deleted object.

Luckily, it's not needed to use change_item_tree() for top-level
AND/OR, because the whole top-level item is copied and preserved
in prep_where and prep_on, and restored from there.

So, just don't.
2022-10-29 18:48:41 +02:00
Oleg Smirnov
5027cb2b74 MDEV-29662 Replace same values in 'IN' list with an equality
If all elements in the list of 'IN' or 'NOT IN' clause are equal
and there are no NULLs then clause
-  "a IN (e1,..,en)" can be converted to "a = e1"
-  "a NOT IN (e1,..,en)" can be converted to "a <> e1".
This means an object of Item_func_in can be replaced with an object
of Item_func_eq for IN (e1,..,en) clause and Item_func_ne for
NOT IN (e1,...,en). Such a replacement allows the optimizer to choose
a better execution plan
2022-10-26 11:01:56 +07:00
Lena Startseva
410a07277f Merge branch 'bb-10.6-all-builders' into bb-10.7-all-builders 2022-09-27 14:59:07 +07:00
Lena Startseva
78dcf71e88 Merge branch 'bb-10.3-all-builders' into bb-10.4-all-builders 2022-09-23 19:47:13 +07:00
Lena Startseva
72ba96a48e MDEV-27691: make working view-protocol
Tests with checking metadata or that cannot be run with
the view-protocol are excluded from --view-protocol.
For tests that do not allow the use of an additional connection,
the util connection is disabled with "--disable_service_connection".
Also cases with bugs for --view-protocol are disabled.
2022-09-23 17:36:20 +07:00
Oleksandr Byelkin
8f7edb784f MDEV-26637: (variables) ASAN: main.metadata and user_variables.basic MTR failures after MDEV-26572
Prohibit user variables without name
2021-10-12 10:16:07 +02:00
Alexander Barkov
4b0cedf82d MDEV-16454 Bad results for IN with ROW
Consider an IN predicate with ROW-type arguments:
  predicant IN (value1, ..., valueM)
where predicant and all values consist of N elements.

When performing IN for these arguments, at every position i (1..N)
only data type of i-th element of predicant was taken into account,
while data types on i-th elements of value1..valueM were not taken.

These led to bad comparison data type detection, e.g. when
mixing unsigned and signed integer values.

After this change all element data types are taken into account.
So, for example, a mixture of unsigned and signed values is
now calculated using decimal and does not overflow any more.

Detailed changes:
1. All comparators for ROW elements are now created recursively
   at fix_fields() time, inside  cmp_item_row::prepare_comparators().

   Previously prepare_comparators() installed comparators only
   for temporal data types, while comparators for other types were
   installed at execution time, in cmp_item_row::store_value().

2. Removing comparator creating code from cmp_item_row::store_value().
   It was responsible for non-temporal data types.

3. Removing find_date_time_item(). It's not needed any more.
   All ROW-element data types are now covered by
   cmp_item_row::prepare_comparators().

4. Adding a helper method Item_args::alloc_and_extract_row_elements()
   to extract elements from an array of ROW-type Items, from the given
   position. Using this method to collect elements from the i-th
   position and further pass them to
   Type_handler_hybrid_field_type::aggregate_for_comparison().

5. Moving the call for alloc_comparators() inside
   cmp_item_row::prepare_comparators(). This helps
   to call prepare_comparators() for ROW elements recursively
   (if elements appear to be ROWs again).
   Moving alloc_comparators() from "public" to "private".
2018-06-27 16:07:21 +04:00
Michael Widenius
a7abddeffa Create 'main' test directory and move 't' and 'r' there 2018-03-29 13:59:44 +03:00
Renamed from mysql-test/t/func_in.test (Browse further)