mariadb/mysql-test/suite
Aleksey Midenkov 16069eb4de MDEV-29155 CREATE OR REPLACE with self-referencing CHECK hangs
forever, cannot be killed

Virtual_column_info::fix_and_check_expr() first does fix_expr() which
finds all fields in query tables and then check_vcol_func_processor()
which prohibits SELECT expression. So before we get the error
prohibiting SELECT in vcol expression we must satisfy fix_expr() with
all the opened tables. The patch achieves this by iterating
query_tables from parsed vcol expression and by assigning opened
tables from the main parser context (as they are already preopened if
the parser sees some SELECT expressions).

But the problem is, we cannot use these TABLE objects fully for vcol
expression, at least the comment about MERGE tables states so:

  /* MERGE tables need to access parent and child TABLE_LISTs. */
  DBUG_ASSERT(tables->table->pos_in_table_list == tables);

Therefore after we have done vcol check we should revert back
TABLE_LISTs to the original TABLE-less state.

As CREATE OR REPLACE first drops the original table (at least prior to
MDEV-25292) we can use the above hack from the currently opening
table. And that is possible only after bitmaps initialized, so we move
their execution to a little earlier stage, before vcol parsing. But
partitioning depends on uninitialized bitmaps, so we temporarily
revert some to make partitioning initialization happy.

Note that plain CREATE TABLE just fails this case in parser with
NO_SUCH_TABLE, CREATE OR REPLACE doesn't fail in parser as the old
table still exists.

Now to the hang, mysql_rm_table_no_locks() does TDC_RT_REMOVE_ALL
which waits while share is closed. The table normally is open only as
OPEN_STUB, this is what parser does for CREATE TABLE. But for SELECT
the table is opened not as a stub. If it is the same table name we
anyway have two TABLE_LIST objects: stub and not stub. So for "not
stub" TDC_RT_REMOVE_ALL sees open count and decides to wait until it
is closed. And of course it hangs, because that was opened in the same
thread. Now we force close such TABLE objects before
mysql_rm_table_no_locks().

And the third, condition for sequences was wrong: we have to check
TABLE_LIST::sequence property to make sure we processing sequence.
2025-04-21 13:47:47 +03:00
..
archive MDEV-22964: archive.archive and main.mysqlbinlog_{row,stmt}_compressed) 2024-12-16 10:04:07 +11:00
binlog MDEV-33658 1/2 Refactoring: extract Key length initialization 2025-01-26 16:15:46 +01:00
binlog_encryption Add --source include/long_test.inc to some tests 2025-03-15 11:15:54 +01:00
client
compat MDEV-27769 Assertion failed in Field::ptr_in_record upon UPDATE in ORACLE mode 2025-01-26 16:15:46 +01:00
csv Backporting bugs fixes fixed by MDEV-31340 from 11.5 2024-05-21 14:58:01 +04:00
encryption MDEV-35869 Wrong result using degenerated subquery with window function 2025-01-23 13:50:29 -08:00
engines MDEV-31005: Make working cursor-protocol 2024-09-18 18:39:26 +07:00
federated MDEV-29968 Functions in default values in tables with some character sets break SHOW CREATE (and mysqldump) 2025-01-17 15:39:55 +04:00
funcs_1 MDEV-34716 Fix mysql.servers socket max length too short 2024-12-17 10:40:57 +11:00
funcs_2 Add --source include/long_test.inc to some tests 2025-03-15 11:15:54 +01:00
galera MDEV-36116: correction for error codes 2025-04-14 18:20:25 +02:00
galera_3nodes galera tests: corrections for garbd-related tests 2025-04-02 04:29:40 +02:00
galera_3nodes_sr galera: synchronization changes to stop random test failures 2025-04-02 04:29:34 +02:00
galera_sr MDEV-36393 Test failure on galera_sr.GCF-572 2025-04-02 04:29:40 +02:00
gcol MDEV-36613 Incorrect undo logging for indexes on virtual columns 2025-04-16 15:55:45 +03:00
handler MDEV-30263 Assertion failure in Protocol::end_statement upon HANDLER READ with invalid timestamp 2024-12-13 16:27:14 +01:00
heap MDEV-28130 MariaDB SEGV issue at tree_search_next 2025-01-14 18:56:14 +03:00
innodb Add --source include/long_test.inc to some tests 2025-03-15 11:15:54 +01:00
innodb_fts Correct cursor protocol tests main.{loaddata,grant_plugin} & innodb_fts.fulltext 2024-11-21 21:43:44 +11:00
innodb_gis MDEV-35420 Server aborts while deleting the record in spatial index 2025-03-21 15:26:21 +01:00
innodb_i_s Merge remote-tracking branch '10.4' into 10.5 2023-03-31 21:32:41 +02:00
innodb_zip MDEV-33658 1/2 Refactoring: extract Key length initialization 2025-01-26 16:15:46 +01:00
jp MDEV-29446 Change SHOW CREATE TABLE to display default collation 2022-09-12 22:10:39 +04:00
json MDEV-31005: Make working cursor-protocol 2024-09-18 18:39:26 +07:00
large_tests MDEV-16944 Fix file sharing issues on Windows in mysqltest 2024-04-17 16:52:37 +02:00
maria MDEV-22935 Erroneous Aria Index / Optimizer behaviour 2024-06-05 10:29:49 +03:00
mariabackup MDEV-36270 mariabackup.incremental_compressed fails in 10.11+ 2025-03-25 11:56:35 +01:00
mtr/t
mtr2
multi_source Merge from 10.4 to 10.5 2024-04-15 17:46:49 +02:00
optimizer_unfixed_bugs MDEV-29710: Disable some slow tests on Valgrind 2022-10-06 08:42:26 +03:00
parts Add --source include/long_test.inc to some tests 2025-03-15 11:15:54 +01:00
perfschema MDEV-33978 P_S.THREADS is not showing all server threads 2025-01-27 12:11:47 +02:00
perfschema_stress
period MDEV-31005: Make working cursor-protocol 2024-09-18 18:39:26 +07:00
plugins MDEV-36245 review changes 2025-04-19 10:16:19 +02:00
roles MDEV-29968 Functions in default values in tables with some character sets break SHOW CREATE (and mysqldump) 2025-01-17 15:39:55 +04:00
rpl Add --source include/long_test.inc to some tests 2025-03-15 11:15:54 +01:00
s3 MDEV-29968 update test results 2025-01-18 08:10:49 +01:00
sql_sequence MDEV-36380 User has unauthorized access to a sequence through a view with security invoker 2025-04-17 17:18:55 +02:00
storage_engine
stress MDEV-29710: Skip some more tests on Valgrind 2022-10-05 20:37:54 +03:00
sys_vars MDEV-29775 : Assertion `0' failed in void Protocol::end_statement() when adding data to the MyISAM table after setting wsrep_mode=replicate_myisam 2025-02-02 04:16:05 +01:00
unit
vcol MDEV-29155 CREATE OR REPLACE with self-referencing CHECK hangs 2025-04-21 13:47:47 +03:00
versioning MDEV-36115 InnoDB: assertion: node->pcur->rel_pos == BTR_PCUR_ON 2025-04-01 19:45:30 +02:00
wsrep galera: synchronization changes to stop random test failures 2025-04-02 04:29:34 +02:00