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

WITH clause does not work with information_schema as default database

    XMLWordPrintable

Details

    Description

      I tried to play with simple CTEs in test schema (or without default schema at all):

      MariaDB [test]> show tables;
      +----------------+
      | Tables_in_test |
      +----------------+
      | t1             |
      +----------------+
      1 row in set (0.14 sec)
       
      MariaDB [test]> with t as (select 1 as t) select * from t;
      +---+
      | t |
      +---+
      | 1 |
      +---+
      1 row in set (0.13 sec)
      

      Everything works as expected and documented in https://mariadb.com/kb/en/library/with/. But as soon as I change default schema to information_schema the same query fails:

      MariaDB [test]> use information_schema
      Database changed
      MariaDB [information_schema]> with t as (select 1 as t) select * from t;
      ERROR 1109 (42S02): Unknown table 't' in information_schema
      MariaDB [information_schema]> select version();
      +----------------------------------------+
      | version()                              |
      +----------------------------------------+
      | 10.3.13-MariaDB-1:10.3.13+maria~bionic |
      +----------------------------------------+
      1 row in set (0.14 sec)
      

      I do not understand why this happens. It does not seem to be expected or documented.

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              valerii Valerii Kravchuk
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.