1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-12459 post-review fixes

* IS_USER_TEMP_TABLE() was misleading, name didn't match the code
* list of temp tables was rescanned number_of_databases times
* some temporary tables were not shown (from nonexistent databases)
* some temporary tables were shown more than once (e.g. after self-joins)
* sys.table_exists() - avoid querying I_S twice
* fix handling of temporary MERGE tables - it's pointless to fully open
  them, they're not in thd->temporary_tables, so they simply fail to
  open and are skipped. Relax the assertion instead.
This commit is contained in:
Sergei Golubchik
2023-06-17 13:17:18 +02:00
parent 1fb4828b28
commit 62decb5e8b
8 changed files with 119 additions and 105 deletions

View File

@ -200,17 +200,34 @@ show index in t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t 1 b 1 b A NULL NULL NULL YES BTREE NO
drop database mysqltest;
use test;
show full tables;
Tables_in_test Table_type
tmp_innodb_in_test TEMPORARY TABLE
select * from tmp_innodb_in_test, tmp_innodb_in_test x;
a a
show full tables;
Tables_in_test Table_type
tmp_innodb_in_test TEMPORARY TABLE
drop temporary tables tmp_innodb_in_test;
create temporary table foo.t1 (a int);
select table_schema, table_name from information_schema.tables where table_type='temporary';
table_schema table_name
foo t1
mysqltest tmp_table
mysqltest t
my_db t_temp
drop temporary table foo.t1;
#
# MDEV-28351 Assertion `this->file->children_attached' failed in ha_myisammrg::info
#
use test;
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
insert into t1 values (1);
CREATE TEMPORARY TABLE t2 (a INT) ENGINE=MERGE UNION=(t1);
CREATE TABLE t3 (a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
def test tmp_innodb_in_test TEMPORARY InnoDB 10 Dynamic 0 0 X X X X NULL X X NULL latin1_swedish_ci NULL X Y
def test t3 BASE TABLE MRG_MyISAM 10 Fixed 1 5 X X X X NULL X X NULL latin1_swedish_ci NULL X N
def test t1 BASE TABLE MyISAM 10 Fixed 1 7 X X X X NULL X X NULL latin1_swedish_ci NULL X N
def test t2 TEMPORARY MRG_MyISAM 10 Fixed 0 0 X X X X NULL X X NULL latin1_swedish_ci NULL X Y
def test t3 BASE TABLE MRG_MyISAM 10 Fixed 1 5 X X X X NULL X X NULL latin1_swedish_ci NULL X N
DROP TABLE t1,t2,t3;