Skip to content

Warning 1356 is returned and result is empty by querying information_schema.columns when a scalar subquery is used as a column in view definition #54343

@pcqz

Description

@pcqz

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table t1(id int);
Query OK, 0 rows affected (0.06 sec)

mysql> create view v1 as select (select id from t1) as col from dual;
Query OK, 0 rows affected (0.07 sec)

mysql> select column_name, table_name from information_schema.columns where table_name='v1';
Empty set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+---------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                   |
+---------+------+---------------------------------------------------------------------------------------------------------------------------+
| Warning | 1356 | View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them |
+---------+------+---------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

2. What did you expect to see? (Required)

+-------------+------------+
| column_name | table_name |
+-------------+------------+
| col         | v1         |
+-------------+------------+

3. What did you see instead (Required)

The warning 1356 is reported.

4. What is your TiDB version? (Required)

v6.1.0 and above

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.report/communityThe community has encountered this bug.report/customerCustomers have encountered this bug.severity/majortype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions