Bug #85579 View validation when plugins are loaded/unloaded
Submitted: 22 Mar 2017 6:54 Modified: 13 Oct 2017 17:41
Reporter: Gopal Shankar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[22 Mar 2017 6:54] Gopal Shankar
Description:
The following test case demonstrates the problem:

...
create view v1 as
  (select * from information_schema.TP_THREAD_STATE);
create table t1 (f1 int);
create view v2 as (select * from t1);

show columns from v1;
Field  Type    Null    Key     Default Extra
TP_GROUP_ID    int(6) unsigned NO              0
TP_THREAD_NUMBER       int(6) unsigned NO              0
PROCESS_COUNT  bigint(20) unsigned     NO              0
WAIT_TYPE      varchar(30)     YES             NULL

show columns from v2;
Field  Type    Null    Key     Default Extra
f1     int(11) YES             NULL

UNINSTALL PLUGIN TP_THREAD_STATE;
drop table t1;

show columns from v1;
Field  Type    Null    Key     Default Extra
TP_GROUP_ID    int(6) unsigned NO              0
TP_THREAD_NUMBER       int(6) unsigned NO              0
PROCESS_COUNT  bigint(20) unsigned     NO              0
WAIT_TYPE      varchar(30)     YES             NULL

show columns from v2;
ERROR HY000: View 'test.v2' references invalid table(s) or
column(s) or function(s) or definer/invoker of view lack rights
to use them
...

SHOW COLUMNS on v1 above should have reported same error as that
of last SHOW COLUMNS.

- Views that are based on I_S plug-ins are not marked as invalid,
  if the I_S plugin is not available.

- This also means that view should be marked as valid, if the
  related I_S plugin is loaded.

- Note that a I_S plugin can also be loaded and unloaded while
  server restart, apart from INSTALL/UNINSTALL command. So, this
  bug should consider mark the view validity upon server restarts
  also.

How to repeat:
As described above.
[13 Oct 2017 17:41] Paul DuBois
Posted by developer:
 
Fixed in 8.0.4, 9.0.0.

Plugins can create or drop INFORMATION_SCHEMA tables, but views that
reference INFORMATION_SCHEMA tables were not validated when plugins
were unloaded or unloaded.