Commit graph

470 commits

Author SHA1 Message Date
Marko Mäkelä
d9d9c30b70 Merge 10.2 into 10.3 2020-09-22 21:12:48 +03:00
Marko Mäkelä
9d0ee2dcb7 Merge 10.1 into 10.2 2020-09-22 15:21:43 +03:00
Alexander Barkov
f0a57acb49 MDEV-23535 SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
This piece of the code in Item_func_or_sum::agg_item_set_converter:

 if (!conv && ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
   conv= new (thd->mem_root) Item_func_conv_charset(thd, *arg, coll.collation, 1);

was wrong because:

1. It could change Item_cache to Item_func_conv_charset
  (with the old Item_cache in args[0]).
  Such Item type change is not always supported, e.g.
  the code in Item_singlerow_subselect::reset() expects only Item_cache,
  to be able to call Item_cache::set_null(). So it erroneously
  reinterpreted Item_func_conv_charset to Item_cache and called
  a non-existing method set_null(), which crashed the server.

2. The 1 in the last parameter to Item_func_conv_charset() was also
  a problem. In MariaDB versions where the reported query did not crash,
  it erroneously returned "empty set" instead of one row, because
  the 1 made subselects execute too earlier and return NULL.

Fix:

1. Removing the above two lines from Item_func_or_sum::agg_item_set_converter()

2. Adding the repertoire test inside the constructor of Item_func_conv_charset,
   so it now detects itself as "safe" in more cases than before.
   This is needed to avoid new "Illegal mix of collations" after
   removing the wrong code in various scenarios when character set
   conversion from pure ASCII happens, including the reported scenario.

So now this sequence:

   Item_cache -> Item_func_concat

is replaced to this compatible sequence (the top Item is still Item_cache):

   new Item_cache -> Item_func_conv_charset -> Item_func_concat

Before the fix it was replaced to this incompatible sequence:

   Item_func_conv_charset -> old Item_cache -> Item_func_concat
2020-09-03 14:20:06 +04: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
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
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
Alexander Barkov
1c60f40868 Merge remote-tracking branch 'origin/10.2' into 10.3 2019-03-22 14:41:36 +04:00
Marko Mäkelä
031fa8f1d2 Merge 10.1 into 10.2 2019-03-22 11:15:21 +02:00
Alexander Barkov
3b98c65c4e MDEV-18881 Assertion `0' failed in make_sortkey upon SELECT with GROUP BY after LOAD DATA 2019-03-18 15:33:59 +04:00
Marko Mäkelä
b32bc70e34 Merge 10.2 into 10.3 2019-03-12 14:26:34 +02:00
Alexey Botchkov
acb4a87204 MDEV-18886 JSON_ARRAY() does not recognise JSON argument.
JSON_ARRAY and JSON_OBJECT functions with no arguments now get the
connection charset. Item_func_convert_charset returns the correct
is_json() flag.
2019-03-12 01:09:55 +04:00
Oleksandr Byelkin
083279f783 Merge commit '6b8802e8dd5467556a024d807a1df23940b00895' into bb-10.3-fix_len_dec 2018-06-19 14:51:50 +02:00
Oleksandr Byelkin
6b8802e8dd MDEV-11071: Assertion `thd->transaction.stmt.is_empty()' failed in Locked_tables_list::unlock_locked_table
fix_length_and_dec now return result (error/OK)
2018-06-15 10:31:30 +02:00
Sergei Golubchik
28dbdf3d79 MDEV-14551 Can't find record in table on multi-table update with ORDER BY
preserve positions if the multi-update join is using tmp table:

* store positions in the tmp table if needed
  JOIN::add_fields_for_current_rowid()

* take positions from the tmp table, not from file->position():
  multi_update::prepare2()
2018-05-17 15:13:47 +02:00
Sergei Golubchik
e17e798599 cleanup: simplify multi-update's juggling with positions
introduce Item_temptable_rowid() that is used to store
table->file->position() in the temporary table record
2018-05-17 15:13:47 +02:00
Marko Mäkelä
7396dfcca7 Merge 10.2 into 10.3 2018-04-24 20:59:57 +03:00
Marko Mäkelä
4cd7979c56 Merge 10.1 into 10.2 2018-04-24 09:39:45 +03:00
Marko Mäkelä
9c34a4124d Merge 10.0 into 10.1 2018-04-24 09:26:40 +03:00
Sergei Golubchik
587568b72a Merge branch '5.5' into 10.0 2018-04-20 14:33:24 +02:00
Vicențiu Ciorbaru
65eefcdc60 Merge remote-tracking branch '10.2' into 10.3 2018-04-12 12:41:19 +03:00
Vicențiu Ciorbaru
45e6d0aebf Merge branch '10.1' into 10.2 2018-04-10 17:43:18 +03:00
Vicențiu Ciorbaru
4c89cff558 Merge branch '10.0' into 10.1 2018-04-07 17:11:22 +03:00
Alexander Barkov
6beb08c7b6 MDEV-15624 Changing the default character set to utf8mb4 changes query evaluation in a very surprising way 2018-04-04 09:12:44 +04:00
Vicențiu Ciorbaru
6a72b9096a Merge branch '5.5' into 10.0 2018-04-03 18:08:30 +03:00
Alexander Barkov
606e21867c MDEV-15630 uuid() function evaluates at wrong time in query 2018-04-03 16:28:52 +04:00
halfspawn
94ecd2314d MDEV-15739 sql_mode=ORACLE: Make LPAD and RPAD return NULL instead of empty string 2018-04-03 14:00:19 +04:00
halfspawn
209375fdd0 MDEV-15664 : sql_mode=ORACLE: Make TRIM return NULL instead of empty string 2018-03-29 14:27:57 +04:00
Alexander Barkov
068450a382 MDEV-15689 Fix Item_func_set_collation to pass the collation using CHARSET_INFO instead of Item
Main changes:

- Changing the constructor to accept a CHARSET_INFO pointer, instead of an Item pointer
- Updating the bison grammar accordingly

Additional cleanups:

- Simplifying Item_func_set_collation::eq() by reusing Item_func::eq()
- Removing unused binary_keyword
2018-03-27 15:45:09 +04:00
Alexander Barkov
6aff5fa27a MDEV-15619 using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data 2018-03-26 10:33:58 +04:00
Alexander Barkov
d509981498 Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3 2018-03-15 13:39:26 +04:00
halfspawn
3e6893e29a MDEV-10574 / SUBSTR - sql_mode=Oracle: return null instead of empty string 2018-03-13 10:34:28 +01:00
Marko Mäkelä
b006d2ead4 Merge bb-10.2-ext into 10.3 2018-02-15 10:22:03 +02:00
Alexander Barkov
95d075a0e5 MDEV-15293 CAST(AS TIME) returns bad results for LAST_VALUE(),NAME_CONST(),SP variable 2018-02-13 20:37:31 +04:00
Alexander Barkov
3cad31f2a7 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2018-02-08 19:06:25 +04:00
Sergei Golubchik
4771ae4b22 Merge branch 'github/10.1' into 10.2 2018-02-06 14:50:50 +01:00
Sergei Golubchik
d4df7bc9b1 Merge branch 'github/10.0' into 10.1 2018-02-02 10:09:44 +01:00
Alexander Barkov
c4a908cb56 MDEV-13790 UNHEX() of a somewhat complicated CONCAT() returns NULL 2018-01-30 11:35:27 +04:00
Marko Mäkelä
866ccc8890 Merge bb-10.2-ext into 10.3 2017-12-14 11:34:30 +02:00
Marko Mäkelä
1b5f0cbd46 Merge 10.2 into bb-10.2-ext 2017-12-14 09:53:19 +02:00
Marko Mäkelä
ece9c54e10 Merge 10.1 into 10.2 2017-12-14 08:40:01 +02:00
Marko Mäkelä
ce07d09fd3 Merge 10.0 into 10.1 2017-12-12 19:28:26 +02:00
Michael Widenius
166056f744 Remove not used mem_root argument from build_clone(), get_copy() and get_item_copy()
TODO:
- Make get_thd_memroot() inline
  - To do this, we need to reduce dependence of include files, especially
    so that sql_class.h is not depending in item.h
2017-11-23 09:49:45 +02:00
Alexander Barkov
02e35ef5f2 MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1) 2017-11-15 15:52:03 +04:00
Oleksandr Byelkin
2913f615f0 MDEV-8949: COLUMN_CREATE unicode name breakage
Use utf-mb4 if it is possible.
2017-11-14 10:49:46 +01:00
Monty
0bb0d52221 Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Conflicts:
	mysql-test/r/cte_recursive.result
	mysql-test/r/derived_cond_pushdown.result
	mysql-test/t/cte_recursive.test
	mysql-test/t/derived_cond_pushdown.test
	sql/datadict.cc
	sql/handler.cc
2017-11-09 23:21:41 +02:00
Igor Babaev
343bcb152f Fixed mdev-14237 Server crash on query with regexp_substr
It's better to prohibit pushdown of conditions that involve
regexp_substr() and regexp_replace() into materialized derived
tables / views until proper implementations of the get_copy()
virtual method are provided for those functions.
2017-11-05 22:52:41 -08:00
halfspawn
34f36a335b MDEV-14012 - sql_mode=Oracle: substr(): treat position 0 as position 1 2017-10-06 09:23:06 +02:00