[MDEV-31773] sys.table_exists results for temporary sequence differ Created: 2023-07-25  Updated: 2023-08-02  Resolved: 2023-08-02

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients, Server
Affects Version/s: N/A
Fix Version/s: 11.2.2

Type: Bug Priority: Minor
Reporter: Alice Sherepa Assignee: Anel Husakovic
Resolution: Not a Bug Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-12459 The information_schema tables for get... Closed

 Description   

sys.table_exists shows TEMPORARY SEQUENCE - for temporary sequence, but just TEMPORARY if there exist also base table with the same name:

MariaDB [db]> create temporary sequence s1;
Query OK, 0 rows affected (0,003 sec)
 
MariaDB [db]> create temporary sequence s2;
Query OK, 0 rows affected (0,004 sec)
 
MariaDB [db]> create  sequence s1;
Query OK, 0 rows affected (0,018 sec)
 
MariaDB [db]> show full tables;
+--------------+--------------------+
| Tables_in_db | Table_type         |
+--------------+--------------------+
| s2           | TEMPORARY SEQUENCE |
| s1           | TEMPORARY SEQUENCE |
| s1           | SEQUENCE           |
+--------------+--------------------+
3 rows in set (0,003 sec)
 
MariaDB [db]> CALL sys.table_exists('db', 's1', @table_type); SELECT @table_type;
Query OK, 0 rows affected (0,005 sec)
 
+-------------+
| @table_type |
+-------------+
| TEMPORARY   |
+-------------+
1 row in set (0,001 sec)
 
MariaDB [db]> CALL sys.table_exists('db', 's2', @table_type); SELECT @table_type;
Query OK, 0 rows affected (0,005 sec)
 
+--------------------+
| @table_type        |
+--------------------+
| TEMPORARY SEQUENCE |
+--------------------+
1 row in set (0,001 sec)

maybe we should change that procedure – currently there is:

SET v_table_type = (SELECT GROUP_CONCAT(TABLE_TYPE) FROM information_schema.TABLES WHERE
                            TABLE_SCHEMA = in_db AND TABLE_NAME = in_table);
    IF v_table_type LIKE '%,%' THEN
        SET out_exists = 'TEMPORARY';



 Comments   
Comment by Anel Husakovic [ 2023-08-02 ]

I think this is not the bug, it is per design, when temporary table shadows the base table, the same behavior as was before.

Generated at Thu Feb 08 10:26:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.