WH clause (CTE) in MariaDB in Docker for Windows environment error

Asked 2 years ago, Updated 2 years ago, 379 views

SQL statements using WITH clauses fail for MariaDB in the Docker for Windows environment.

For example,

SELECT* FROM table01;

↑ This is OK, but

 WITH t01 AS (SELECT* FROM table01)
SELECT* FROM t01;

Doing so will return an error of "#42S02Table`DatabaseName.table01`dosen't exist in engine".

試Tried version and result br
Docker Desktop for Windows
mariadb:10.4.24:error
mariadb:10.5.15:error
mysql:8.0.28:OK! No errors

Linux docker
mariadb:10.4.24: OK! No errors

In other words, only MariaDB in Docker Desktop for Windows will fail.

By the way,

 WITH t01 AS (SELECT* FROM DB name.table01)
SELECT* FROM t01;

and the table name in the WITH clause should be given a DB schema.

Does anyone know how to run Windows without errors just like Linux?

You indicated that you do not have accurate information about containers, images, and connectivity, so I will specify the steps to reproduce it.

 docker run -- name maria 10.5-it-e MARIADB_ROOT_PASSWORD = root-d mariadb: 10.5
 docker exec-it maria 10.5/bin/bash
mysql-p information_schema
Enter password:

This SQL statement is OK

MariaDB [information_schema] > select * from TABLES;

Problematic SQL Statements

MariaDB [information_schema] > with t01 as (select * from TABLES) select * from t01;

These steps were taken to try MariaDB 10.4, 10.5, MySQL 8.0, and MariaDB 10.4 on Linux.
Then MariaDB in Windows environment will not work.

sql mariadb

2022-09-30 22:02

1 Answers

UPDATE

For information_schema only, the Docker, Docker for Windows on Ubuntu both occurred in the question text.
It appears to be the following issue degre or something:

On the other hand, if it occurs outside of information_schema, both Docker and Docker for Windows on Ubuntu cannot be reproduced.

After all, I think we should accurately describe the steps to reproduce it.

mariadb:10.5

#mysql --version
mysql Ver15.1 Distrib 10.5.15 - MariaDB, for debian-linux-gnu(x86_64) using readline 5.2
MariaDB [information_schema] > select version();
+---------------------------------------+
| version()|
+---------------------------------------+
| 10.5.15-MariaDB-1: 10.5.15+maria~focal|
+---------------------------------------+
1 row in set (0.000 sec)

and
mariadb:10.4.24

#mysql --version
mysql Ver15.1 Distrib 10.4.24-MariaDB, for debian-linux-gnu(x86_64) using readline 5.2
MariaDB [information_schema] > select version();
+---------------------------------------+
| version()|
+---------------------------------------+
| 10.4.24-MariaDB-1: 10.4.24+maria~focal|
+---------------------------------------+
1 row in set (0.000 sec)

Viewed:

In order to give a specific answer, I think information such as which image is used and how it is connected is necessary, but I think the general answer should be one of the following:

  • Specify the DB name in the option ( --database) or the option file
  • Toggle the default DB after connecting using USE


2022-09-30 22:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.