antares
antares copied to clipboard
Cannot show tables with a SQL query which uses a LIKE clause
Describe the bug Trying to execute a SHOW TABLES query like the following, I get the following error
"Error: Table 'mydb.tables' doesn't exist"
The SQL looks like:
SHOW TABLES LIKE 'foo_%'
In the console I notice the following queries:
SHOW TABLES LIKE 'foo_%'
SELECT * FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = 'mydb' AND `TABLE_NAME` = 'tables' ORDER BY `ORDINAL_POSITION` ASC
SHOW CREATE TABLE `mydb`.`tables`
SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = 'mydb AND `TABLE_NAME` = 'tables' AND `REFERENCED_TABLE_NAME` IS NOT NULL
SELECT * FROM `information_schema`.`REFERENTIAL_CONSTRAINTS` WHERE `CONSTRAINT_SCHEMA` = 'mydb' AND `TABLE_NAME` = 'tables' AND `REFERENCED_TABLE_NAME` IS NOT NULL
To Reproduce Steps to reproduce the behavior:
- Create a database mydb
- Create one or several tables having a neme beginning with foo_
- Open a new tab to write and execute the query SHOW TABLES LIKE 'foo_%'
- see the error, and see the console log
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Application (please complete the following information):
- App client MySQL
- App version 0.5.16
- Installation source: snap package
Environment (please complete the following information):
- OS name: Ubuntu
- OS version 22.04
- DB name Mysql
- DB version 8.0.30
Additional context Add any other context about the problem here.
Hi @btry ,
In Antares every tab targets a schema. In your case you are probably targeting mydb
schema.
If you target information_schema
everything should work.
Hi
Thanks for your reply.
If i switch to informations_schema the query works, but I want to see the tables in the DB mydb. It looks like Antares tries to get some metadata for a table having a name picked from the SQL query. With SHOW TABLES it seems to me not relevant as the table name is usually not present, or in my case only a prefix string.
This issue is probably related to https://github.com/antares-sql/antares/issues/461 and should be fixed with 88408da745e45c70de977bc4270e5f61825be65f.
From next release please let me know if you continue to notice the problem.
Hi,
With version 0.5.19 it now works as expected. Thank you.