Commit graph

2393 commits

Author SHA1 Message Date
WayneXia
a896bebfa6 MDEV-18844 Implement EXCEPT ALL and INTERSECT ALL operations 2019-08-24 21:44:41 +08: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
afe6eb499d Revert "MDEV-20342 Turn Field::flags from a member to a method"
This reverts commit e86010f909.

Reverting on Monty's request, as this change makes merging
things from 10.5 to 10.2 much harder.
2019-08-14 20:27:00 +04:00
Alexander Barkov
e86010f909 MDEV-20342 Turn Field::flags from a member to a method 2019-08-14 13:33:01 +04:00
Alexander Barkov
c1599821a5 Merge remote-tracking branch 'origin/10.4' into 10.5 2019-08-13 23:49:10 +04:00
Marko Mäkelä
624dd71b94 Merge 10.4 into 10.5 2019-08-13 18:57:00 +03:00
Monty
05619f6989 Fixes based on warnings from gcc/clang and valgrind
- Initialize variables that could be used uninitialized
- Added extra end space to DbugStringItemTypeValue to get rid of warnings
  from c_ptr()
- Session_sysvars_tracker::update() accessed unitialized memory if called
  with NULL value.
- get_schema_stat_record() accessed unitialized memory if HA_KEY_LONG_HASH
  was used
- parse_vcol_defs() accessed random memory for tables without keys.
2019-08-12 10:48:38 +03:00
Varun Gupta
60a37783ae MDEV-20224: main.derived crashes with ASAN with error use-after-poison
Make sure that the references in the GROUP BY clause that need to be considered for
pushdown from having to where are of Item_field objects
2019-08-01 12:26:36 +05:30
Oleksandr Byelkin
2792c6e7b0 Merge branch '10.3' into 10.4 2019-07-28 13:43:26 +02:00
Oleksandr Byelkin
d97342b6f2 Merge branch '10.2' into 10.3 2019-07-26 22:42:35 +02:00
Oleksandr Byelkin
cf8c2a3c3b Merge branch '10.1' into 10.2 2019-07-26 07:03:39 +02:00
Oleksandr Byelkin
ae476868a5 Merge branch '5.5' into 10.1 2019-07-25 13:27:11 +02:00
Oleksandr Byelkin
f90040fd9c MDEV-19429: Wrong query result with EXISTS and LIMIT 0
Check EXISTS LIMIT before rewriting.
2019-07-19 18:00:10 +02:00
Alexander Barkov
265a7d1613 MDEV-20009 Add CAST(expr AS pluggable_type) 2019-07-10 11:55:16 +04:00
Alexander Barkov
4dc85973b4 MDEV-19994 Add class Function_collection 2019-07-09 16:18:54 +04:00
Alexander Barkov
70c2bde931 MDEV-19996 Bison grammar: turn singe-character operators into <kwd> 2019-07-09 15:10:45 +04:00
Aleksey Midenkov
b0dd048edd MDEV-19175 Server crashes in ha_partition::vers_can_native upon INSERT DELAYED into versioned partitioned table
Uninitialized LEX::part_info on ha_partition::vers_can_native().
2019-07-09 10:01:54 +03:00
Aleksey Midenkov
af5b0dbab6 MDEV-19175 Server crashes in ha_partition::vers_can_native upon INSERT DELAYED into versioned partitioned table
Uninitialized LEX::part_info on ha_partition::vers_can_native().
2019-07-08 13:25:05 +03:00
Aleksey Midenkov
ed33a5df8b MDEV-19175 Server crashes in ha_partition::vers_can_native upon INSERT DELAYED into versioned partitioned table
Uninitialized LEX::part_info on ha_partition::vers_can_native().
2019-07-07 23:11:20 +03:00
Alexander Barkov
9c9e0ac73d MDEV-19944 Remove GIS data types from keyword list in lex.h 2019-07-04 07:48:46 +04:00
Alexander Barkov
3e7e87ddcc MDEV-19897 Rename source code variable names from utf8 to utf8mb3 2019-06-28 12:37:04 +04:00
Eugene Kosov
d36c107a6b imporve clang build
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug

Maintainer mode makes all warnings errors. This patch fix warnings. Mostly about
deprecated `register` keyword.

Too much warnings came from Mroonga and I gave up on it.
2019-06-25 13:21:36 +03:00
Marko Mäkelä
3c88ce4cd1 Merge 10.4 into 10.5 2019-06-18 11:30:06 +03:00
Oleksandr Byelkin
f66d1850ac Merge branch '10.3' into 10.4 2019-06-14 22:10:50 +02:00
Oleksandr Byelkin
4a3d51c76c Merge branch '10.2' into 10.3 2019-06-14 07:36:47 +02:00
Oleksandr Byelkin
50653e021f Merge branch '10.1' into 10.2 2019-06-13 16:42:21 +02:00
Oleksandr Byelkin
5b65d61d93 Merge branch '5.5' into 10.1 2019-06-12 22:54:46 +02:00
Alexander Barkov
bf5a144e16 MDEV-19639 + MDEV-19640 fix + preparatory changes for WL#4179
This patch includes:
- MDEV-19639 sql_mode=ORACLE: Wrong SHOW PROCEDURE output for sysvar:=expr
- MDEV-19640 Wrong SHOW PROCEDURE output for SET GLOBAL sysvar1=expr, sysvar2=expr
- Preparatory refactoring for MySQL WL#4179

Detailed change list:

1. Changing sp_create_assignment_lex() to accept the position
   in the exact query buffer instead of a "bool no_lookahead".
   This actually fixes MDEV-19639.
   In the previous reduction sp_create_assignment_lex() was
   called too late, when the parser went far the from beginning
   of the statement, so only a part of the statement got into
   sp_instr_stmt.

2. Generating "SET" or "SET GLOBAL" inside sp_create_assignment_instr()
   depending on the option type.
   This fixes MDEV-19640.
   In the previous reduction the code passed (through no_lookahead)
   the position of the
   word GLOBAL inside sp_create_assignment_lex(), which
   worked only for the left-most assignment.

3. Fixing the affected rules to use:
   - ident_cli instead of ident
   - ident_cli_set_usual_case instead of ident_set_usual_case

4. Changing the input parameter in:
   - LEX::set_system_variable()
   - LEX::call_statement_start()
   - LEX::set_variable()
   from just LEX_CSTRING to Lex_ident_sys_st for stricter data type constrol:
   to make sure that noone passes an ident_cli
   (a fragment of the original query in the client character set)
   instead of server-side identifier
   (utf8 identifier allocated on THD when needed).

5. Adding Lex_ident_sys() in places where the affected functions are called.

6. Moving all calls of sp_create_assignment_lex() to the places
   just before parsing set_expr_or_default.
   This makes the grammar clearer, because
   sp_create_assignment_lex() and sp_create_assignment_instr()
   now stay near each other, so the balance of LEX's push/pop
   can be read easier.
   This will also help to WL#4179.

7. Adding class sp_lex_set_var
   Moving the initialization code from
   sp_create_assignment_lex() to the constructor of sp_lex_set_var.
   This will also help to WL#4179.

8. Moving a part of the "set" grammar rule into a separate
   rule "set_param".
   This makes the grammar easier to read and removes
   one shift/reduce conflict.
2019-06-04 06:21:22 +04:00
Igor Babaev
cbb90f77cd MDEV-18479 Complement
This patch complements the patch that fixes bug MDEV-18479.
This patch takes care of possible overflow when calculating the
estimated number of rows in a materialized derived table / view.
2019-05-28 23:26:36 -07:00
Alexander Barkov
9f23f8e598 MDEV-19599 Change db_name, table_name to LEX_CSTRING in Item_ident and Send_field 2019-05-26 09:49:13 +04:00
Oleksandr Byelkin
1921df6697 MDEV-19540: 10.4 allow lock options with SELECT in brackets which previous version do not
Check locking options and brackets combinations.
2019-05-21 16:10:03 +02:00
Alexander Barkov
8164bd24a6 MDEV-19535 sql_mode=ORACLE: 'SELECT INTO @var FOR UPDATE' does not lock the table 2019-05-21 14:22:49 +04:00
Alexander Barkov
ed39181a27 MDEV-19533 Add methods make() and append_uniq() to Row_definition_list 2019-05-21 12:30:21 +04:00
Oleksandr Byelkin
dafe41edea Removing of dead code. 2019-05-20 09:38:08 +02:00
Oleksandr Byelkin
c07325f932 Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02: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
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
Marko Mäkelä
d3dcec5d65 Merge 10.3 into 10.4 2019-05-05 15:06:44 +03:00
Sergey Vojtovich
894df7edb6 Adieu find_sys_var_ex()
Only take LOCK_plugin for plugin system variables.

Reverted optimisation that was originally done for session tracker: it
makes much less sense now. Specifically only if connections would want to
track plugin session variables changes and these changes would actually
happen frequently. If this ever becomes an issue, there're much better
ways to optimise this workload.

Part of MDEV-14984 - regression in connect performance
2019-05-03 16:46:11 +04:00
Igor Babaev
2b7e080fae MDEV-19363 Assertion `select_lex' failed in LEX::pop_select
This patch corrects the patch for MDEV-19324. The latter did not
work properly in the cases when the transformation
  (SELECT ... ORDER BY ...) LIMIT ... =>
   SELECT ... ORDER BY ... LIMIT ...
was applied to the operands of a set operation.
2019-05-01 18:20:06 -07:00
Igor Babaev
5dee4a99d9 MDEV-19324 Wrong results from query, using brackets with ORDER BY ..LIMIT
If a select query was of the form (SELECT ... ORDER BY ...) LIMIT ...
then in most cases it returned incorrect result. It happened because
SELECT ... ORDER BY ... was wrapped into a select with materialized
derived table:
  SELECT ... ORDER BY ... =>
  SELECT * FROM (SELECT ... ORDER BY ...) dt.
Yet for any materialized derived table ORDER BY without LIMIT is ignored.
This patch resolves the problem by the conversion
  (SELECT ... ORDER BY ...) LIMIT ... =>
  SELECT ... ORDER BY ... LIMIT ...
at the parser stage.

Similarly
  ((SELECT ... UNION ...) ORDER BY ...) LIMIT ...
is converted to
  (SELECT ... UNION ...) ORDER BY ... LIMIT ...
This conversion optimizes execution of the query because the result of
(SELECT ... UNION ...) ORDER BY ... is not materialized into a temporary
table anymore.
2019-04-26 17:56:26 -07:00
Marko Mäkelä
e6bdf77e4b Merge 10.3 into 10.4
In is_eits_usable(), we disable an assertion that fails due to
MDEV-19334.
2019-04-25 16:05:20 +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
Igor Babaev
59ed5f3aa4 MDEV-19164 Assertion `fixed' failed in Item_func_inet_aton::val_int
When pushing a condition from HAVING into WHERE the function
st_select_lex::pushdown_from_having_into_where() transforms column
references in the pushed condition then performs cleanup of
items of the condition and finally calls fix_fields() for the condition
items. The cleanup is performed by a call of the method walk() with
cleanup_processor as the first parameter. Unfortunately this sequence
of calls does not work if the condition contains cached items, because
fix_fields() cannot go through Item_cache items and this leaves
underlying items unfixed.
The solution of this problem used in this patch is just does not allow
to process Item_cache objects when performing cleanup of the pushed
condition. In order to let the traversal procedure walk() not to process
Item_cache objects the third parameter of the used call of walk()
is set to a fictitious pointer (void *) 1. And Item_cache::walk() is
changed to prevent any action when it gets such value as the third
parameter.
2019-04-17 21:37:29 -07:00
Alexander Barkov
c2a2e72164 MDEV-19142 sql_mode=MSSQL: Bracket identifiers 2019-04-15 09:39:28 +04:00
Igor Babaev
d2013e7328 MDEV-18982 Partition pruning with column list causes syntax error in 10.4
A syntax error was reported for any INSERT statement with explicit
partition selection it if i used a column list.
Fixed by saving the parsing place before parsing the clause for explicit
partition selection and restoring it when the clause has been parsed.
2019-04-04 16:36:26 -07: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