|
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.
|