summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.3' into 10.4bb-10.4-MDEV-23468Oleksandr Byelkin2020-12-251-24/+12
|\
| * Merge branch '10.2' into 10.3Oleksandr Byelkin2020-12-231-24/+12
| |\
| | * MDEV-24019 Assertion is hit for query using recursive CTE with no default DBIgor Babaev2020-12-081-24/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the query using a recursive CTE whose definition contained wildcard symbols in the recursive part was processed at the prepare stage an assertion was hit if the query was executed without any default database set. The failure happened when the function insert_fields() tried to check column privileges for the temporary table created for a recursive reference to the CTE. No acl checks are needed for any CTE. That's why this check should be blocked as well. The patch formulates a stricter condition at which this check is to be blocked that covers the case when a query using recursive CTEs is executed with no default database set. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| | * MDEV-24314 Unexpected error message when selecting from view that usesIgor Babaev2020-12-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | mergeable derived table Do not check privileges for derived tables/CTEs and their fields. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* | | Merge 10.3 into 10.4Marko Mäkelä2020-12-011-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-12-011-1/+1
| |\ \ | | |/
| | * MDEV 15532 Assertion `!log->same_pk' failed in row_log_table_apply_deleteMonty2020-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for the failure is that thd->mdl_context.release_transactional_locks() was called after commit & rollback even in cases where the current transaction is still active. For 10.2, 10.3 and 10.4 the fix is simple: - Replace all calls to thd->mdl_context.release_transactional_locks() with thd->release_transactional_locks(). The thd function will only call the mdl_context function if there are no active transactional locks. In 10.6 we will better fix where we will change the return value for some trans_xxx() functions to indicate if transaction did close the transaction or not. This will avoid the need of the indirect call. Other things: - trans_xa_commit() and trans_xa_rollback() will automatically call release_transactional_locks() if the transaction is closed. - We can't do that for the other functions as the caller of many of these are doing additional work (like close_thread_tables) before calling release_transactional_locks(). - Added missing abort_result_set() and missing DBUG_RETURN in select_create::send_eof() - Fixed wrong indentation in injector::transaction::commit()
* | | Merge 10.3 into 10.4Marko Mäkelä2020-11-031-1/+1
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-10-301-1/+1
| |\ \ | | |/
| | * MDEV-22707 : galera got stuck after flush tablesJan Lindström2020-10-281-1/+1
| | | | | | | | | | | | | | | Remove unnecessary condition and add necessary include for non debug Galera library.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-10-291-0/+5
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-10-281-0/+5
| |\ \ | | |/
| | * MDEV-22707: galera got stuck after flush tablesmkaruza2020-10-271-0/+5
| | | | | | | | | | | | | | | | | | | | | Deadlock is possible between applier thread and local committing thread with active FLUSH TABLE. Applier thread should skip table share checks and locks when opening table. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
* | | Merge branch '10.3' into 10.4Sujatha2020-09-281-0/+7
|\ \ \ | |/ /
| * | MDEV-23823 Crash in SELECT NEXT VALUE on locked viewVladislav Vaintroub2020-09-281-0/+7
| | | | | | | | | | | | | | | Make open_table() fail if sequence should be opened, but it turns out to be locked view.
* | | MDEV-21470 ASAN heap-use-after-free in my_hash_sort_binMonty2020-09-251-8/+11
| | | | | | | | | | | | | | | | | | | | | The problem was that the server was calling virtual functions on a record that was not initialized with new data. This happened when fill_record() was aborted in the middle because an error in save_val() or save_in_field()
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2020-08-031-9/+5
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-08-031-9/+5
| |\ \ | | |/
| | * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-9/+5
| | |\
| | | * cleanup: reduce code duplicationSergei Golubchik2020-07-291-8/+4
| | | |
| | | * MDEV-18496 Crash when Aria encryption is enabled but plugin not availableSergei Golubchik2020-07-291-1/+1
| | | | | | | | | | | | | | | | wait_while_table_is_used() should return an error if handler::extra() fails
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-07-311-17/+26
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2020-07-311-17/+26
| |\ \ \ | | |/ /
| | * | MDEV-16039 Crash when selecting virtual columns generated using functions ↵Nikita Malyavin2020-07-211-17/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with DAYNAME() * Allocate items on thd->mem_root while refixing vcol exprs * Make vcol tree changes register and roll them back after the statement is executed. Explanation: Due to collation implementation specifics an Item tree could change while fixing. The tricky thing here is to make it on a proper arena. It's usually not a problem when a field is deterministic, however, makes a pain vice-versa, during allocation allocating. A non-deterministic field should be refixed on each statement, since it depends on the environment state. Changing the tree will be temporary and therefore it should be reverted after the statement execution.
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-06-051-4/+4
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2020-06-051-4/+4
| |\ \ \ | | |/ /
| | * | MDEV-22339 - Assertion `str_length < len' failedSergey Vojtovich2020-06-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When acquiring SNW/SNRW/X MDL lock DDL/admin statements may abort pending thr lock in concurrent connection with open HANDLER (or delayed insert thread). This may lead to a race condition when table->alias is accessed concurrently by such threads. Either assertion failure or memory leak is a practical consequence of this race condition. Specifically HANDLER is opening a table and issuing alias.copy(), while DDL executing get_lock_data()/alias.c_ptr()/realloc()/realloc_raw(). Fixed by perforimg table->init() before it is published via thd->open_tables.
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-05-261-17/+60
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2020-05-251-17/+60
| |\ \ \ | | |/ /
| | * | Fixed deadlock with LOCK TABLES and ALTER TABLEMonty2020-05-231-17/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-21398 Deadlock (server hang) or assertion failure in Diagnostics_area::set_error_status upon ALTER under lock This failure could only happen if one locked the same table multiple times and then did an ALTER TABLE on the table. Major change is to change all instances of table->m_needs_reopen= true; to table->mark_table_for_reopen(); The main fix for the problem was to ensure that we mark all instances of the table in the locked_table_list and when we reopen the tables, we first close all tables before reopening and locking them. Other things: - Don't call thd->locked_tables_list.reopen_tables if there are no tables marked for reopen. (performance)
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-05-181-16/+10
|\ \ \ \ | |/ / /
| * | | Merge remote-tracking branch 'origin/10.2' into 10.3Alexander Barkov2020-05-161-16/+10
| |\ \ \ | | |/ /
| | * | Merge remote-tracking branch 'origin/10.1' into 10.2Alexander Barkov2020-05-161-14/+8
| | |\ \ | | | |/ | | | | | | | | Also, adding 10.2 related changes for MDEV-22579
| | | * MDEV-22579 No error when inserting DEFAULT(non_virtual_column) into a ↵Alexander Barkov2020-05-151-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | virtual column The code erroneously allowed both: INSERT INTO t1 (vcol) VALUES (DEFAULT); INSERT INTO t1 (vcol) VALUES (DEFAULT(non_virtual_column)); The former is OK, but the latter is not. Adding a new virtual method in Item: virtual bool vcol_assignment_allowed_value() const { return false; } Item_null, Item_param and Item_default_value override it. Item_default_value overrides it in the way to: - allow DEFAULT - disallow DEFAULT(col)
* | | | Merge branch '10.3' into 10.4Sergei Golubchik2020-05-091-0/+9
|\ \ \ \ | |/ / /
| * | | Merge branch '10.2' into 10.3mariadb-10.3.23Sergei Golubchik2020-05-091-0/+9
| |\ \ \ | | |/ /
| | * | Merge branch '10.1' into 10.2mariadb-10.2.32Oleksandr Byelkin2020-05-081-0/+9
| | |\ \ | | | |/
| | | * MDEV-22180 Planner opens unnecessary tables when updated table is referenced ↵Sergei Golubchik2020-05-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | by foreign keys under LOCK TABLES we still have to open everything, otherwise DML prelocking will try to take an MDL on a table that wasn't in the LOCK TABLES list.
* | | | Merge 10.3 into 10.4Marko Mäkelä2020-04-271-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2020-04-271-2/+2
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2020-04-271-2/+2
| | |\ \ | | | |/
| | | * MDEV-22203: WSREP_ON is unnecessarily expensive to evaluateMarko Mäkelä2020-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a backport of the applicable part of commit 93475aff8de80a0ef53cbee924bcb70de6e86f2c and commit 2c39f69d34e64a5cf94720e82e78c0ee91bd4649 from 10.4. Before 10.4 and Galera 4, WSREP_ON is a macro that points to a global Boolean variable, so it is not that expensive to evaluate, but we will add an unlikely() hint around it. WSREP_ON_NEW: Remove. This macro was introduced in commit c863159c320008676aff978a7cdde5732678f975 when reverting WSREP_ON to its previous definition. We replace some use of WSREP_ON with WSREP(thd), like it was done in 93475aff8de80a0ef53cbee924bcb70de6e86f2c. Note: the macro WSREP() in 10.1 is equivalent to WSREP_NNULL() in 10.4. Item_func_rand::seed_random(): Avoid invoking current_thd when WSREP is not enabled.
* | | | MDEV-22203: WSREP_ON is unnecessarily expensive to evaluateJan Lindström2020-04-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Replaced WSREP_ON macro by single global variable WSREP_ON that is then updated at server statup and on wsrep_on and wsrep_provider update functions.
* | | | Merge 10.3 into 10.4Marko Mäkelä2019-11-011-9/+19
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-10-181-0/+1
| |\ \ \ | | |/ /
| | * | MDEV-10748 Server crashes in ha_maria::implicit_commitMonty2019-10-151-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem was in a combination of LOCK TABLES on several Aria tables followed by an ALTER TABLE. After the ALTER TABLE there was a force close + reopen of the alter table. The close failed because the table was still part of a transaction. Fixed by calling extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE) as part of closing the table, which ensures that the table is not anymore part of the current transaction.
| * | | MDEV-20074: Lost connection on update triggerOleksandr Byelkin2019-10-171-9/+18
| | | | | | | | | | | | | | | | | | | | Instead of checking lex->sql_command which does not corect in case of triggers mark tables for insert.
* | | | Merge 10.3 into 10.4Marko Mäkelä2019-10-101-26/+0
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-10-091-26/+0
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-10-091-26/+0
| | |\ \ | | | |/