Commit graph

1514 commits

Author SHA1 Message Date
Alexander Barkov
f1e13fdc8d MDEV-21581 Helper functions and methods for CHARSET_INFO 2020-01-28 12:29:23 +04:00
Sergei Golubchik
00c3a28820 cleanup: data type plugins
simplify type naming (less boilerplate code).
don't force a plugin to specify the name twice.
2019-10-31 11:19:39 +01:00
Alexander Barkov
5392726e3c MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table
The patch for `MDEV-20795 CAST(inet6 AS BINARY) returns wrong result`
unintentionally changed what Item_char_typecast::type_handler()
returns. This broke UNIONs with the BINARY() function, as the Aria
engine started to get columns of unexpected data types.

Restoring previous behaviour, to return
  Type_handler::string_type_handler(max_length).

The prototype for Item_handed_func::return_type_handler() has changed
from:
  const Type_handler *return_type_handler() const
to:
  const Type_handler *return_type_handler(const Item_handled_func *) const
2019-10-14 08:21:08 +04:00
Alexander Barkov
b5fae7f743 MDEV-20795 CAST(inet6 AS BINARY) returns wrong result 2019-10-11 14:50:11 +04:00
Alexander Barkov
5e17b1f7cb A small cleanup for MDEV-16309 Split ::create_tmp_field() into virtual methods in Item
These two methods:
- Item_result_field::create_tmp_field_ex()
- Item_func_user_var::create_tmp_field_ex()
had duplicate code, except that they used a different type handler.
Adding a protected method Item_result_field::create_tmp_field_ex_from_handler()
with a "const Type_handler*" parameter, and reusing it from the
two mentioned methods.
2019-10-10 22:19:53 +04:00
Marko Mäkelä
fba9883bc4 Merge 10.4 into 10.5 2019-09-25 10:18:22 +03:00
Marko Mäkelä
d3350c160a Merge 10.3 into 10.4 2019-09-25 10:14:33 +03:00
Alexander Barkov
b6bb64e54a Merge remote-tracking branch 'origin/10.2' into 10.3 2019-09-24 23:05:09 +04:00
Marko Mäkelä
d28686ada6 Merge 10.4 into 10.5 2019-09-12 16:36:46 +03:00
Marko Mäkelä
60c04be659 Merge 10.3 into 10.4 2019-09-12 12:16:40 +03:00
Marko Mäkelä
da9201dd5b Merge 10.2 into 10.3 2019-09-10 09:25:20 +03:00
Alexander Barkov
8750df43ab MDEV-20517 Assertion `!is_expensive()' failed in Item::value_depends_on_sql_mode_const_item 2019-09-07 07:44:54 +04:00
Marko Mäkelä
4081b7b27a Merge 10.4 into 10.5 2019-09-06 17:16:40 +03:00
Marko Mäkelä
780d2bb8a7 Merge 10.4 into 10.5 2019-09-06 14:25:20 +03:00
Sergei Golubchik
244f0e6dd8 Merge branch '10.3' into 10.4 2019-09-06 11:53:10 +02:00
Alexander Barkov
7e08ac0b41 Merge 10.2 (up to commit ef00ac4c86) into 10.3 2019-09-04 10:19:58 +04:00
Alexander Barkov
dc719597ee MDEV-18156 Assertion 0' failed or btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH
This change takes into account a column's GENERATED ALWAYS AS
expression dependcy on sql_mode's PAD_CHAR_TO_FULL_LENGTH and
NO_UNSIGNED_SUBTRACTION flags.

Indexed virtual columns as well as persistent generated columns are
now not allowed to have such dependencies to avoid inconsistent data
or index files on sql_mode changes.
So an error is now returned in cases like this:

  CREATE OR REPLACE TABLE t1
  (
    a CHAR(5),
    v VARCHAR(5) AS (a) PERSISTENT -- CHAR->VARCHAR or CHAR->TEXT = ERROR
  );

Functions RPAD() and RTRIM() can now remove dependency on
PAD_CHAR_TO_FULL_LENGTH. So this can be used instead:

  CREATE OR REPLACE TABLE t1
  (
    a CHAR(5),
    v VARCHAR(5) AS (RTRIM(a)) PERSISTENT
  );

Note, unlike CHAR->VARCHAR and CHAR->TEXT this still works,
not RPAD(a) is needed:

  CREATE OR REPLACE TABLE t1
  (
    a CHAR(5),
    v CHAR(5) AS (a) PERSISTENT -- CHAR->CHAR is OK
  );

More sql_mode flags may affect values of generated columns.
They will be addressed separately.

See comments in sql_mode.h for implementation details.
2019-09-03 05:34:53 +04:00
Igor Babaev
9380850d87 MDEV-15777 Use inferred IS NOT NULL predicates in the range optimizer
This patch introduces the optimization that allows range optimizer to
consider index range scans that are built employing NOT NULL predicates
inferred from WHERE conditions and ON expressions.
The patch adds a new optimizer switch not_null_range_scan.
2019-08-30 18:47:14 -07:00
Alexander Barkov
235cf969d2 MDEV-20397 Support TIMESTAMP, DATETIME, TIME in ROUND() and TRUNCATE() 2019-08-22 15:09:59 +04:00
Alexander Barkov
cb4dcf39e7 MDEV-20363 Assertion `is_unsigned() == attr.unsigned_flag' failed in Type_handler_longlong::make_table_field 2019-08-16 22:49:56 +04:00
Alexander Barkov
6073049a36 MDEV-20353 Add separate type handlers for unsigned integer data types 2019-08-15 21:53:24 +04:00
Alexander Barkov
0e0d57141e MDEV-20331 Add class Type_numeric_attributes 2019-08-12 21:46:20 +04:00
Alexander Barkov
e7525beac8 MDEV-20326 Add class DTCollation_numeric 2019-08-12 18:41:02 +04:00
Alexander Barkov
d5f5cd2831 A cleanup: removing duplicate code: Item_func::val_decimal()
Using val_decimal_from_int() instead, which provides exactly
the same functionality.
2019-08-09 23:17:01 +04:00
Alexander Barkov
061a0f0b8d MDEV-20175 Move Type_handler_row from Type_collection_std to Type_collection_row 2019-07-25 14:49:33 +04:00
Alexander Barkov
e6ff3f9d1c MDEV-20052 Add a MEM_ROOT pointer argument to Type_handler::make_xxx_field() 2019-07-12 06:58:51 +04:00
Alexander Barkov
265a7d1613 MDEV-20009 Add CAST(expr AS pluggable_type) 2019-07-10 11:55:16 +04:00
Alexander Barkov
b511202335 MDEV-19923 Add type handlers for geometry sub-types 2019-07-03 14:51:00 +04:00
Oleksandr Byelkin
c07325f932 Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
Alexander Barkov
b7d22a843e MDEV-16872 Add CAST(expr AS FLOAT) 2019-05-16 10:16:32 +04:00
Marko Mäkelä
be85d3e61b Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Oleksandr Byelkin
c51f85f882 Merge branch '10.2' into 10.3 2019-05-12 17:20:23 +02:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
Vicențiu Ciorbaru
5543b75550 Update FSF Address
* Update wrong zip-code
2019-05-11 21:29:06 +03:00
Galina Shalygina
f2e27d53da MDEV-19139: pushdown condition with Item_func_set_user_var
The bug occurs because Item_func_set_user var is allowed to be pushed
into materialized derived table/view.
To fix it excl_dep_on_table() as added to Item_func_set_user_var class
to prevent pushdown.
2019-05-08 13:23:34 +03:00
Marko Mäkelä
bc145193c1 Merge 10.1 into 10.2 2019-04-25 09:04:09 +03:00
Galina Shalygina
a765b19e5c MDEV-19245: Impossible WHERE should be noticed earlier after HAVING pushdown
The bug appears because not all conditions are found to be knowingly
true or false in WHERE after HAVING pushdown optimization.
Impossible WHERE can be found much earlier compared with how it is done now.

To fix it and_new_conditions_to_optimized_cond() is changed.
2019-04-22 16:19:55 +03:00
Alexander Barkov
279b50b4eb MDEV-14041 Server crashes in String::length on queries with functions and ROLLUP 2019-04-22 14:01:58 +04:00
Galina Shalygina
694d1a50bd MDEV-19185: Pushdown constant function defined with subquery
The bug occurs because of the wrong pushdown of constant function
defined with subquery from HAVING into WHERE. Subqueries can't be
pushed into WHERE.

To fix it with_subquery() call is added to check if the function contains
subquery.
2019-04-05 22:55:20 +03:00
Marko Mäkelä
02d9b048a2 Merge 10.3 into 10.4 2019-04-05 11:41:03 +03:00
Marko Mäkelä
d5a2bc6a0f Merge 10.2 into 10.3 2019-04-04 19:41:12 +03:00
Galina Shalygina
ae15f91f22 MDEV-18769 Assertion `fixed == 1' failed in Item_cond_or::val_int
This bug is caused by pushdown from HAVING into WHERE.
    It appears because condition that is pushed wasn't fixed.

    It is also discovered that condition pushdown from HAVING into
    WHERE is done wrong. There is no need to build clones for some
    conditions that can be pushed. They can be simply moved from HAVING
    into WHERE without cloning.
    build_pushable_cond_for_having_pushdown(),
    remove_pushed_top_conjuncts_for_having() methods are changed.

    It is found that there is no transformation made for fields of
    pushed condition.
    field_transformer_for_having_pushdown transformer is added.

    New tests are added. Some comments are changed.
2019-04-04 18:06:56 +03:00
Marko Mäkelä
b30fb701cc Merge 10.1 into 10.2 2019-04-04 09:05:45 +03:00
Marko Mäkelä
6a9b216301 Fix clang -Wunused-private-field 2019-04-03 19:50:51 +03:00
Marko Mäkelä
0bc4260226 Merge 10.3 into 10.4 2019-03-26 17:43:59 +02:00
Marko Mäkelä
ffc69dbd05 Merge 10.2 into 10.3 2019-03-26 15:03:37 +02:00
Marko Mäkelä
226ca250ed Merge 10.1 into 10.2 2019-03-26 14:17:19 +02:00
Alexander Barkov
6fbbb0853e MDEV-18968 Both (WHERE 0.1) and (WHERE NOT 0.1) return empty set 2019-03-26 11:37:18 +04:00
Alexander Barkov
80c3fd184d Backporting MDEV-15597 Add class Load_data_outvar and avoid using Item::STRING_ITEM for Item_user_var_as_out_param detection
This is a part of "MDEV-18045 Backporting the MDEV-15497 changes to 10.2 branch"
2019-02-23 17:43:59 +04:00