Bug #107135 | “create temporary table like” failed for the same table | ||
---|---|---|---|
Submitted: | 27 Apr 2022 7:24 | Modified: | 5 May 2022 8:41 |
Reporter: | Xlong Li (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 8.0.28, 8.0.29 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[27 Apr 2022 7:24]
Xlong Li
[27 Apr 2022 8:09]
MySQL Verification Team
Hello Xlong Li, Thank you for the report and test case. regards, Umesh
[5 May 2022 8:18]
huahua xu
Hi, Xlong Li: You may have a good idea to fix the bug, After reading this commit: https://github.com/mysql/mysql-server/commit/18dc75bdecb1b0598d8dbc8ba9bfd4b418032209
[5 May 2022 8:30]
huahua xu
InnoDB has specified that: All temporary tables are created in a session temporary tablespace. TABLESPACE=%s option is deprecated and will be removed in a future release so, the tablespace option should not be kept when target is temporary table. diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b60844a71ac..e70f12238e6 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10810,9 +10810,10 @@ bool mysql_create_like_table(THD *thd, TABLE_LIST *table, TABLE_LIST *src_table, /* Keep tablespace, only if it was specified explicitly in CREATE - TABLE when source table was created. + TABLE when source table was created and target object is not temporary table. */ - if (src_table_obj && !src_table_obj->is_explicit_tablespace()) { + if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) + || (src_table_obj && !src_table_obj->is_explicit_tablespace())) { local_create_info.tablespace = nullptr; }
[5 May 2022 8:41]
Xlong Li
@huahua xu thanks a lot for your suggestions it's very reasonable that session level explicit temporary tablespace is discard