Bug #90160 querying the KEYWORDS table fails unless there is a default database
Submitted: 21 Mar 2018 11:41 Modified: 17 Aug 2018 23:04
Reporter: Giuseppe Maxia (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Information schema Severity:S2 (Serious)
Version:8.0.11 OS:Linux
Assigned to: CPU Architecture:Any

[21 Mar 2018 11:41] Giuseppe Maxia
Description:
Querying the KEYWORDS table without having an active database gives an error.

mysql [localhost] {msandbox} ((none)) > select count(*) from information_schema.KEYWORDS;
ERROR 1046 (3D000): No database selected

When we set any database as active, we can query that table:

mysql [localhost] {msandbox} ((none)) > use test
Database changed
mysql [localhost] {msandbox} (test) > select count(*) from information_schema.KEYWORDS;
+----------+
| count(*) |
+----------+
|      675 |
+----------+
1 row in set (0.00 sec)

How to repeat:
run 
mysql -u username -p -e 'select count(*) from information_schema.KEYWORDS'
[21 Mar 2018 11:51] MySQL Verification Team
Hello Giuseppe,

Thank you for the report and feedback!

Thanks,
Umesh
[21 Mar 2018 13:07] MySQL Verification Team
Another testcase:   launch "mysql -uroot" without a default database....
----------------

drop view if exists test.t;
drop table if exists test.t;
create view test.t as 
select * from json_table('[{"a":"3"}]',"$[*]" columns(rowid for ordinality))q;
select * from test.t;
[17 Aug 2018 23:04] Jon Stephens
Documented fix in the MySQL 8.0.13 changelog as follows:

    Selecting from the INFORMATION_SCHEMA.KEYWORDS table failed when
    no default database had been selected.

Also updated the note about this issue in the I_S.KEYWORDS documentation.

Closed.