Details
-
New Feature
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Run a check of metadata
This is request to add feature to identify invalid objects like views, procedures etc.
Database objects can be invalid when base table altered/drop
Could be some information_schema query would be helpful
Note that invalid views can be identified with:
select * from information_schema.tables where table_schema not in ('INFORMATION_SCHEMA','performance_schema','mysql','sys') and table_type='VIEW' and table_comment like '%invalid%';
For completeness, this is a full list of standard _USAGE views:
CHECK_CONSTRAINT_ROUTINE_USAGE
COLUMN_COLUMN_USAGE
COLUMN_DOMAIN_USAGE
COLUMN_UDT_USAGE
CONSTRAINT_COLUMN_USAGE
CONSTRAINT_PERIOD_USAGE
CONSTRAINT_TABLE_USAGE
KEY_COLUMN_USAGE
KEY_PERIOD_USAGE
ROUTINE_COLUMN_USAGE
ROUTINE_PERIOD_USAGE
ROUTINE_ROUTINE_USAGE
ROUTINE_SEQUENCE_USAGE
ROUTINE_TABLE_USAGE
TRIGGER_COLUMN_USAGE
TRIGGER_PERIOD_USAGE
TRIGGER_ROUTINE_USAGE
TRIGGER_SEQUENCE_USAGE
TRIGGER_TABLE_USAGE
VIEW_COLUMN_USAGE
VIEW_PERIOD_USAGE
VIEW_ROUTINE_USAGE
VIEW_TABLE_USAGE
For the purpose of this task it's tempting to implement all ROUTINE_ views, but selecting them all to find missing objects would be rather inefficient, as they all will go through all rows in mysql.proc, parse and compile stored routines, etc.
It would be better if all of these views would print warnings for missing objects in routines, then it'll be enough to select from one of these views to get the complete list. Let's try to do that. Meaning, it'll be enough to implement just one view, let's say, ROUTINE_COLUMN_USAGE.