summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-20009 Add CAST(expr AS pluggable_type)Alexander Barkov2019-07-101-0/+18
|
* MDEV-19994 Add class Function_collectionAlexander Barkov2019-07-091-0/+14
|
* MDEV-19175 Server crashes in ha_partition::vers_can_native upon INSERT ↵Aleksey Midenkov2019-07-071-1/+1
| | | | | | DELAYED into versioned partitioned table Uninitialized LEX::part_info on ha_partition::vers_can_native().
* MDEV-19944 Remove GIS data types from keyword list in lex.hAlexander Barkov2019-07-041-0/+3
|
* MDEV-19897 Rename source code variable names from utf8 to utf8mb3Alexander Barkov2019-06-281-31/+32
|
* Merge 10.4 into 10.5Marko Mäkelä2019-06-181-1/+4
|\
| * Merge branch '10.3' into 10.4Oleksandr Byelkin2019-06-141-1/+4
| |\
| | * Merge branch '10.2' into 10.3Oleksandr Byelkin2019-06-141-1/+4
| | |\
| | | * Merge branch '10.1' into 10.2Oleksandr Byelkin2019-06-131-1/+4
| | | |\
| | | | * Merge branch '5.5' into 10.1Oleksandr Byelkin2019-06-121-1/+4
| | | | |\
| | | | | * MDEV-18479 ComplementIgor Babaev2019-05-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | MDEV-19639 + MDEV-19640 fix + preparatory changes for WL#4179Alexander Barkov2019-06-041-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | MDEV-19599 Change db_name, table_name to LEX_CSTRING in Item_ident and ↵Alexander Barkov2019-05-261-26/+23
|/ / / / / | | | | | | | | | | | | | | | Send_field
* | | | | MDEV-19540: 10.4 allow lock options with SELECT in brackets which previous ↵bb-10.4-MDEV-19540Oleksandr Byelkin2019-05-211-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | version do not Check locking options and brackets combinations.
* | | | | MDEV-19535 sql_mode=ORACLE: 'SELECT INTO @var FOR UPDATE' does not lock the ↵Alexander Barkov2019-05-211-0/+6
| | | | | | | | | | | | | | | | | | | | table
* | | | | MDEV-19533 Add methods make() and append_uniq() to Row_definition_listAlexander Barkov2019-05-211-0/+16
| | | | |
* | | | | Removing of dead code.mariadb-10.4.5Oleksandr Byelkin2019-05-201-32/+0
| | | | |
* | | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-3/+29
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\ \ \ | | | |/ /
| | | * | Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |\ \ | | | | |/
| | | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | * Update wrong zip-code
| * | | | MDEV-17894 Assertion `(thd->lex)->current_select' failed in MYSQLparse(),Igor Babaev2019-05-081-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-05-051-3/+2
|\ \ \ \ \ | |/ / / /
| * | | | Adieu find_sys_var_ex()Sergey Vojtovich2019-05-031-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | MDEV-19363 Assertion `select_lex' failed in LEX::pop_selectIgor Babaev2019-05-011-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | MDEV-19324 Wrong results from query, using brackets with ORDER BY ..LIMITIgor Babaev2019-04-261-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-04-251-1/+19
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | In is_eits_usable(), we disable an assertion that fails due to MDEV-19334.
| * | | | MDEV-19239 ERROR 1300 (HY000): Invalid utf8 character string in 10.3.13-MariaDBAlexander Barkov2019-04-211-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | MDEV-19164 Assertion `fixed' failed in Item_func_inet_aton::val_intIgor Babaev2019-04-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | MDEV-19142 sql_mode=MSSQL: Bracket identifiersAlexander Barkov2019-04-151-3/+6
| | | | |
* | | | | MDEV-18982 Partition pruning with column list causes syntax error in 10.4Igor Babaev2019-04-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | MDEV-18769 Assertion `fixed == 1' failed in Item_cond_or::val_intGalina Shalygina2019-04-041-271/+290
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-03-251-1/+0
|\ \ \ \ \ | |/ / / /
| * | | | remove dead codeEugene Kosov2019-03-221-1/+0
| | | | |
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-03-201-14/+0
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MDEV-17262 commit 26432e49d37a37d09b862bb49a021e44bdf4789c was skipped. In Galera 4, the implementation would seem to require changes to the streaming replication. In the tests archive.rnd_pos main.profiling, disable_ps_protocol for SHOW STATUS and SHOW PROFILE commands until MDEV-18974 has been fixed.
| * | | | Merge branch '10.2' into 10.3Sergei Golubchik2019-03-171-14/+0
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '10.1' into 10.2Sergei Golubchik2019-03-151-13/+0
| | |\ \ \ | | | |/ /
| | | * | pass the slow logging information in thd->query_plan_flagsSergei Golubchik2019-03-121-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This solves the following issues: * unlike lex->m_sql_cmd and lex->sql_command, thd->query_plan_flags is not reset in Prepared_statement::execute, it survives till the log_slow_statement(), so slow logging behaves correctly in --ps * using thd->query_plan_flags for both slow_log_filter and log_slow_admin_statements means the definition of "admin" statements for the slow log is the same no matter how it is filtered out.
* | | | | MDEV-18701: Wrong result from query that uses INTERSECT after UNION ALLOleksandr Byelkin2019-03-111-12/+7
| | | | | | | | | | | | | | | | | | | | Recalculate distinct pointer if we cut chain of SELECTs
* | | | | MDEV-18813 PROCEDURE and anonymous blocks silently ignore FETCH GROUP NEXT ROWAlexander Barkov2019-03-071-13/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part#2 (final): rewritting the code to pass the correct enum_sp_aggregate_type to the sp_head constructor, so sp_head never changes its aggregation type later on. The grammar has been simplified and defragmented. This allowed to check aggregate specific instructions right after a routine body has been scanned, by calling new LEX methods: sp_body_finalize_{procedure|function|trigger|event}() Moving some C++ code from *.yy to a few new helper methods in LEX.
* | | | | MDEV-18813 PROCEDURE and anonymous blocks silently ignore FETCH GROUP NEXT ROWAlexander Barkov2019-03-071-0/+16
| | | | | | | | | | | | | | | | | | | | Part#1: moving opt_if_not_exists from "sf_tail" and "sp_tail" to "create".
* | | | | Merge 10.3 into 10.4Marko Mäkelä2019-03-061-14/+22
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2019-03-051-12/+20
| |\ \ \ \ | | |/ / / | | | | | | | | | | | | | | | | | | | | FIXME: Properly resolve conflicts between MDEV-18883 and MDEV-7742/MDEV-8305, and record the correct result for main.log_slow
| | * | | Merge 10.1 into 10.2Marko Mäkelä2019-03-041-11/+19
| | |\ \ \ | | | |/ /
| | | * | MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned offAlexander Barkov2019-03-041-0/+14
| | | | |
| | | * | Merge branch '10.0' into 10.1Oleksandr Byelkin2019-03-011-11/+5
| | | |\ \
| | | | * \ Merge branch '5.5' into 10.0Oleksandr Byelkin2019-02-281-11/+5
| | | | |\ \ | | | | | |/
| | | | | * MDEV-17055: Server crashes in find_order_in_list upon 2nd (3rd) execution of ↵Oleksandr Byelkin2019-02-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SP with UPDATE 1. Always drop merged_for_insert flag on cleanup (there could be errors which prevent TABLE to be assigned) 2. Make more precise cleanup of select parts which was touched
| | | | | * A cleanup in derived table handling: removing duplicate code from ↵Alexander Barkov2019-02-281-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | st_select_lex::handle_derived() st_select_lex::handle_derived() and mysql_handle_list_of_derived() had exactly the same implementations. - Adding a new method LEX::handle_list_of_derived() instead - Removing public function mysql_handle_list_of_derived() - Reusing LEX::handle_list_of_derived() in st_select_lex::handle_derived()