Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-31773

sys.table_exists results for temporary sequence differ

    XMLWordPrintable

Details

    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';
      

      Attachments

        Issue Links

          Activity

            People

              anel Anel Husakovic
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.