[MDEV-26999] Misleading results upon querying INFORMATION_SCHEMA for broken tables/views Created: 2021-11-08 Updated: 2023-04-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Information Schema |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5, 10.6, 10.7 |
| Fix Version/s: | 10.4, 10.5, 10.6 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | upstream | ||
| Description |
|
Note: InnoDB is only needed to avoid extra warnings upon querying I_S
The first query selects all columns from the I_S table, and it returns the expected row, with a warning:
The second query, with the same WHERE condition, attempts to select certain fields (table name in this case), and it returns an empty result set, no warnings:
Same is true for views which suffer from "references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them". It probably can be explained by the internals of I_S, but it's still misleading and potentially problematic. In my somewhat realistic use case, I am trying to take periodic mysqldump from the schema. When broken views or merge tables exist (which can easily happen if an underlying table is carelessly dropped), the whole dump will fail. So, before creating the dump, I check the schema for such broken ("widow") views and tables and drop them. And it appears that I can easily find them via a query from I_S, but when my periodic job selects the table_schema/table_name, it comes up with nothing. It is of course easy to work around when you know the problem (select all and then only use the columns you need), but one would have to know that a workaround is needed. Reproducible on all of 10.x and MySQL 5.7. MySQL 8.0 doesn't seem to return anything even to the SELECT * query. |