Commit graph

245 commits

Author SHA1 Message Date
Aleksey Midenkov
c3f35ea55a MDEV-18501 Partition pruning doesn't work for historical queries (refactoring)
SYSTEM_TYPE partitioning: COLUMN properties removed. Partitioning is
now pure RANGE based on UNIX_TIMESTAMP(row_end).

DECIMAL type is now allowed as RANGE partitioning, we can partition by
UNIX_TIMESTAMP() (but not for DATETIME which depends on local timezone
of course).
2019-09-01 14:04:25 +03:00
Sergei Petrunia
a379f151b1 MDEV-20109: Optimizer ignores distinct key created for materialized...
Adjust the testcase according to the review input
2019-08-30 12:02:40 +03:00
Sergei Petrunia
ef76f81c98 MDEV-20109: Optimizer ignores distinct key created for materialized...
(Backported to 10.3, addressed review input)

Sj_materialization_picker::check_qep(): fix error in cost/fanout
calculations:
- for each join prefix, add #prefix_rows / TIME_FOR_COMPARE to the cost,
  like best_extension_by_limited_search does
- Remove the fanout produced by the subquery tables.
- Also take into account join condition selectivity

optimize_wo_join_buffering() (used by LooseScan and FirstMatch)
- also add #prefix_rows / TIME_FOR_COMPARE to the cost of each prefix.
- Also take into account join condition selectivity
2019-08-30 12:02:40 +03:00
Marko Mäkelä
1a3c365953 Merge 10.2 into 10.3 2019-08-29 12:00:12 +03:00
Marko Mäkelä
32ec5fb979 Merge 10.2 into 10.3 2019-08-21 15:23:45 +03:00
Anel Husakovic
888f685226 MDEV-20210 If you have an INVISIBLE VIRTUAL column, SHOW CREATE TABLE doesn't list it as INVISIBLE 2019-08-21 01:26:06 -07:00
Alexander Barkov
841294cfaa MDEV-20351 Window function BIT_OR() OVER (..) return a wrong data type 2019-08-15 10:32:42 +04:00
Marko Mäkelä
65d48b4a7b Merge 10.2 to 10.3 2019-08-13 19:28:51 +03:00
Aleksey Midenkov
22914ec793 MDEV-18154 Deadlock and assertion upon no-op ALTER under LOCK TABLES
1. Fix DBUG_ASSERT(!table->pos_in_locked_tables) in tc_release_table();
2. Fix access of prematurely freed MDL_ticket: don't close ticket if table was not closed;
3. Fix deadlock after erroneous ALTER.

mysql_alter_table() leaves dirty table->m_needs_reopen in case of
error exit which then incorrectly treated by mysql_lock_tables().
2019-08-11 12:32:08 +03:00
Alexander Barkov
43882e764d MDEV-20303 SPACE(-1) returns a wrong data type 2019-08-09 14:18:13 +04:00
Alexander Barkov
c3d67c17c1 MDEV-20292 REPEAT(x,-1) returns a wrong data type 2019-08-08 17:08:56 +04:00
Alexander Barkov
e555df648c MDEV-20285 Wrong result on INSERT..SELECT when converting from SIGNED to UNSIGNED 2019-08-08 13:47:50 +04:00
Alexander Barkov
7fc86a73d8 MDEV-20272 PERCENTILE_DISC() crashes on a temporal type input 2019-08-07 22:44:54 +04:00
Alexander Barkov
d70dac2079 MDEV-20278 PERCENTILE_DISC() returns a wrong data type 2019-08-07 21:01:22 +04:00
Alexander Barkov
6b48bdf269 MDEV-18456 Assertion `item->maybe_null' failed in Type_handler_temporal_result::make_sort_key
Adding tests only.

This problem was earlier fixed in 10.4 by MDEV-17325 and backported to 10.3
with this commit:

  f4019f5b35
2019-08-05 15:25:31 +04:00
Alexey Botchkov
c6efbc543d MDEV-17544 No warning when trying to name a primary key constraint.
Warning added.
2019-07-30 21:57:48 +04:00
Oleksandr Byelkin
d97342b6f2 Merge branch '10.2' into 10.3 2019-07-26 22:42:35 +02:00
Anel Husakovic
55d8ff0de8 MDEV-19948 SHOW GRANTS FOR user return privileges individually 2019-07-24 23:19:43 -07:00
Marko Mäkelä
70b226d966 Merge 10.2 into 10.3 2019-07-22 17:37:04 +03:00
Marko Mäkelä
ef44ec4afa Merge 10.2 into 10.3 2019-07-19 12:31:56 +03:00
Eugene Kosov
0f83c8878d Merge 10.2 into 10.3 2019-07-16 18:39:21 +03:00
Marko Mäkelä
e82fe21e3a Merge 10.2 into 10.3 2019-07-02 17:46:22 +03:00
Monty
9053047f3d MDEV-17551 assert or crashed table when using blobs
The bug was that when long item-strings was converted to VARCHAR,
type_handler::string_type_handler() didn't take into account max
VARCHAR length.  The resulting Aria temporary table was created with
a VARCHAR field of length 1 when it should have been 65537. This caused
MariaDB to send impossible records to ma_write() and Aria reported
eventually the table as crashed.

Fixed by updating Type_handler::string_type_handler() to not create too long
VARCHAR fields. To make things extra safe, I also added checks in when
writing dynamic Aria records to ensure we find the wrong record during write
instead of during read.
2019-06-27 19:01:51 +03:00
Anel Husakovic
620f4f8af9 MDEV-17429 mysqldump uses 10.3 options with pre-10.3 servers and breaks 2019-06-24 02:40:06 -07:00
Marko Mäkelä
192aa295b4 Merge 10.2 into 10.3 2019-06-19 08:56:10 +03:00
Alexander Barkov
5352e9687a MDEV-17363 - Compressed columns cannot be restored from dump
In collaboration with Sergey Vojtovich <svoj@mariadb.org>

The COMPRESSED clause is now a part of the data type and goes immediately
after the data type and length, but before the CHARACTER SET clause,
and before column attributes such as DEFAULT, COLLATE, ON UPDATE,
SYSTEM VERSIONING, engine specific column attributes.

In the old reduction, the COMPRESSED clause was a column attribute.

New syntax:
  <varchar or text data type> <length> <compression> <character set> <column attributes>
  <varbinary or blob data type> <length> <compression> <column attributes>

New syntax examples:
  VARCHAR(1000) COMPRESSED CHARACTER SET latin1 DEFAULT ''
  BLOB COMPRESSED DEFAULT ''

Deprecate syntax examples:
  VARCHAR(1000) CHARACTER SET latin1 COMPRESSED DEFAULT ''
  TEXT          CHARACTER SET latin1 DEFAULT '' COMPRESSED
  VARBINARY(1000) DEFAULT '' COMPRESSED

As a side effect:
- COMPRESSED is not valid as an SP label name in SQL/PSM routines any more
  (but it's still valid as an SP label name in sql_mode=ORACLE)

- COMPRESSED is now allowed in combination with GENERATED ALWAYS AS:

  TEXT COMPRESSED GENERATED ALWAYS AS REPEAT('a',1000)
2019-06-18 07:48:08 +04:00
Oleksandr Byelkin
4a3d51c76c Merge branch '10.2' into 10.3 2019-06-14 07:36:47 +02:00
Marko Mäkelä
b42dbdbccd Merge 10.2 into 10.3 2019-06-11 13:00:18 +03:00
Sergei Petrunia
f7579518e2 MDEV-19600: The optimizer should be able to produce rows=1 estimate for unique index with NULLable columns
Modify best_access_path() to produce rows=1 estimate for null-rejecting
lookups on unique NULL keys.
2019-06-05 14:00:45 +03:00
Marko Mäkelä
90a9193685 Merge 10.2 into 10.3 2019-05-29 11:32:46 +03:00
Monty
617d34ae80 Fixed wrong reset of join_cache_level in join_outer*test 2019-05-27 16:30:40 +03:00
Varun Gupta
7056812ed1 MDEV-16214: Incorrect plan taken by the optimizer , uses INDEX instead of ref access with ORDER BY
The issue in this case is that we take in account the estimates from quick keys instead of rec_per_key.
The estimates for quick keys are better than rec_per_key only if we have ref(const), so we need to check
that all keyparts in the ref key are of the type ref(const).
2019-05-20 01:42:38 +05:30
Sergei Golubchik
c1fd027115 Merge branch '10.2' into 10.3 2019-05-17 17:23:01 +02:00
Marko Mäkelä
3d56adbfac Merge 10.2 into 10.3 2019-05-16 14:24:29 +03:00
Alexander Barkov
b7d22a843e MDEV-16872 Add CAST(expr AS FLOAT) 2019-05-16 10:16:32 +04:00
Alexander Barkov
462d689397 MDEV-19468 Hybrid type expressions return wrong format for FLOAT 2019-05-15 07:21:00 +04:00
Marko Mäkelä
73e038520f Merge 10.2 into 10.3 2019-05-14 18:10:06 +03:00
Oleksandr Byelkin
c51f85f882 Merge branch '10.2' into 10.3 2019-05-12 17:20:23 +02:00
Igor Babaev
09aa5d3f69 MDEV-17894 Assertion `(thd->lex)->current_select' failed in MYSQLparse(),
query with VALUES()

A table value constructor can be used in all contexts where a select
can be used. In particular an ORDER BY clause or a LIMIT clause or both
of them can be attached to a table value constructor to produce a new
query. Unfortunately execution of such queries was not supported.
This patch fixes the problem.
2019-05-08 09:45:24 -07:00
Sergei Golubchik
88961a28e2 MDEV-17710 "unknown error" with FLUSH LOGS if log directory is not writeable 2019-05-07 18:40:36 +02:00
Varun Gupta
879878e43d MDEV-18943: Group Concat with limit not working with views
Adjusted the Item_func_group_concat::print function to take into account
limit if present with GROUP_CONCAT
2019-05-03 08:50:40 +05:30
Marko Mäkelä
158247d3bd Merge 10.2 into 10.3 2019-05-02 21:43:24 +03:00
Aleksey Midenkov
d46ffaf6af MDEV-17655 Inconsistent grant-name usage between grant-statement and privilege tables
Closes #1044
2019-05-02 11:40:06 +02:00
Varun Gupta
0fd5ecb03c Adjust the result for join_cache.test 2019-05-02 10:12:35 +05:30
Varun Gupta
cb9fa1a08b MDEV-9959: A serious MariaDB server performance bug
If a derived table has SELECT DISTINCT, provide index statistics for it so that the join optimizer in the
upper select knows that ref access to the table will produce one row.
2019-04-30 21:07:25 +05:30
Alexander Barkov
8c8bee0a56 MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warning 2019-04-30 15:51:49 +04:00
Marko Mäkelä
4d59f45260 Merge 10.2 into 10.3 2019-04-27 20:41:31 +03:00
Marko Mäkelä
acf6f92aa9 Merge 10.2 into 10.3 2019-04-25 09:05:52 +03:00
Alexander Barkov
765ae6e821 MDEV-19239 ERROR 1300 (HY000): Invalid utf8 character string in 10.3.13-MariaDB
A sequence of <digits>e<mbhead><mbtail>, e.g.:

  SELECT 123eXYzzz FROM t1;

was not scanned correctly (where XY is a multi-byte character).

The multi-byte head byte X was appended to 123e separately from
the multi-byte tail byte Y, so a pointer to "Yzzz" was passed
into scan_ident_start(), which failed on a bad multi-byte sequence.

After this change, scan_ident_start() gets a pointer to "XYzzz",
so it correctly sees the whole multi-byte character.
2019-04-21 12:07:30 +04:00
Alexander Barkov
f4019f5b35 Backporting from 10.4 to 10.3: MDEV-17325 NULL-ability problems with LEAST() in combination with NO_ZERO_DATE and NO_ZERO_IN_DATE
This also fixes:
MDEV-17299 Assertion `maybe_null' failed in make_sortkey

Note, during merge of the 10.1 version of MDEV-17299,
please use the 10.3 version of the code (i.e. null merge the 10.1 version).
2019-04-20 00:11:50 +04:00