Bug #101050 DESCRIBE returns no rows on temporary tables
Submitted: 4 Oct 2020 17:25 Modified: 6 Oct 2020 13:50
Reporter: Hanan Goldstein Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.21 OS:Ubuntu
Assigned to: CPU Architecture:Any

[4 Oct 2020 17:25] Hanan Goldstein
Description:
DESCRIBE, EXPLAIN, and SHOW COLUMNS FROM returns no rows on temporary tables unless the user has schema-wide SELECT privileges. This is problem for people trying to use temporary tables using SQLAlchemy and pandas.

How to repeat:
1. Create a user and grant it CREATE TEMPORARY TABLES.
2. Create a temporary table using that user.
3. Attempt to DESCRIBE that table. See that it returns no rows.
4. GRANT that user schema-wide SELECT privileges.
5. Repeat step 2.
6. DESCRIBE that temporary table. See that we now get rows.
[5 Oct 2020 12:31] MySQL Verification Team
Hi Mr. Goldstein,

Thank you for your bug report.

However, this is not a bug, but a part of the design. The purpose is to increase the security of your data.

Not a bug.
[5 Oct 2020 15:58] Hanan Goldstein
If you're supposed to have full privileges to the temporary table you create, how would being able to do DESCRIBE on it be a security issue?
[6 Oct 2020 11:59] MySQL Verification Team
Hi,

First of all, we do not see a version and release of our server that you are using. Make sure it is the latest release available for that version.

Second, SHOW CREATE TABLE should work on the temporary table, but only in the session where it is created !!!!!
[6 Oct 2020 13:48] Hanan Goldstein
My apologies for the lack of version/OS info. Besides Ubuntu 16.0.4, this also happens on macOS 10.15.6.
[6 Oct 2020 13:50] Hanan Goldstein
Correction: Ubuntu 16.04
[6 Oct 2020 16:06] MySQL Verification Team
Sorry, but CREATE is not sufficient privilege to view temporary tables.

This is described in our Reference Manual.