[MDEV-29769] CREATE .. PARTITION .. AS SELECT creates a partition, but non-partitioned table Created: 2022-10-11 Updated: 2023-11-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Partitioning |
| Affects Version/s: | 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10 |
| Fix Version/s: | 10.4, 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Alexey Botchkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
So, the partition got created, but SHOW CREATE TABLE does not show it, and the table appears to be non-partitioned. |
| Comments |
| Comment by Sergei Golubchik [ 2022-10-11 ] | ||||
|
This happens because partitioning stores the partitioning data on CREATE TABLE between the parser and build_frm_image() in thd->work_part_info. This is a fairly fragile hack and in this case it is broken by the discovery of seq_1_to_10 table. In particular, TABLE_SHARE::init_from_sql_statement_string() does
because partitioned tables cannot be discovered. There are two ways to fix it. A quick fix would be to save and restore thd->work_part_info in TABLE_SHARE::init_from_sql_statement_string(). A correct approach would be to get rid of thd->work_part_info. Perhaps it should be in LEX? That's where the parser puts everything else. |