Bug #112423 select information_schema.columns use any result error
Submitted: 22 Sep 2023 2:26 Modified: 22 Sep 2023 11:27
Reporter: bear chen Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.32 OS:Any
Assigned to: CPU Architecture:Any

[22 Sep 2023 2:26] bear chen
Description:
SELECT Information_schema.columns, if where condition include any function irrelevant subquery result error

How to repeat:
First:
CREATE DATABASE hotdb_test;
Create 56 tables under this database;

Second:
use information_schema;
root@localhost:information_schema 8.0.32 10:16:10> select count(*) from columns where TABLE_SCHEMA='hotdb_test';
+----------+
| count(*) |
+----------+
|       56 |
+----------+
1 row in set (0.00 sec)

root@localhost:information_schema 8.0.32 10:25:02> select count(*) as total from columns where table_name=any(select table_name from tables WHERE TABLE_SCHEMA='hotdb_test');
+-------+
| total |
+-------+
| 43212 |
+-------+
1 row in set (0.27 sec)

the result should be 56. Now it is 43212

Suggested fix:

The result should be 56
[22 Sep 2023 11:27] MySQL Verification Team
HI Mr. chen,

Thank you for your bug report.

However, it is not a bug.

Counting columns is not the same as counting tables.

Not a bug.