Skip to content

MySQL 8.0 table structure KEY expression not recognized #347

@StephenAtty

Description

@StephenAtty

Describe the bug

Export of table structure is broken when an index contains a function

To Reproduce

Steps to reproduce the behavior:
create a table with the following structure (this is from a mysql dump):

CREATE TABLE `page_rebuild_control` (
  `proc_row_number` int DEFAULT NULL,
  `place_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `place_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `place_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `waterway_id` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cache_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `place_active` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `alias_type` int NOT NULL DEFAULT '0',
  `status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `time_taken` float DEFAULT NULL,
  PRIMARY KEY (`place_id`,`place_type`) USING BTREE,
  KEY `place_type_idx` (`place_type`),
  KEY `cached_time_idx` (`cache_updated`),
  KEY `active_idx` (`place_active`),
  KEY `status_idx` (`status`),
  KEY `waterway_idx` (`waterway_id`),
  KEY `time_taken_idx` (`time_taken`),
  KEY `alias_type_idx` (`alias_type`),
  KEY `updated_tz_ind` ((convert_tz(`cache_updated`,_utf8mb4'GMT',_utf8mb4'GB')))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

From within phpmyadmin export the table

CREATE TABLE `page_rebuild_control` (
  `proc_row_number` int DEFAULT NULL,
  `place_id` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `place_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `place_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `waterway_id` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cache_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `place_active` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `alias_type` int NOT NULL DEFAULT '0',
  `status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `time_taken` float DEFAULT NULL
) ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `page_rebuild_control`
--
ALTER TABLE `page_rebuild_control`
  ADD PRIMARY KEY (`place_id`,`place_type`) USING BTREE,
  ADD KEY `place_type_idx` (`place_type`),
  ADD KEY `cached_time_idx` (`cache_updated`),
  ADD KEY `active_idx` (`place_active`),
  ADD KEY `status_idx` (`status`),
  ADD KEY `waterway_idx` (`waterway_id`),
  ADD KEY `time_taken_idx` (`time_taken`),
  ADD KEY `alias_type_idx` (`alias_type`),
  ADD KEY `updated_tz_ind` (``(GB));
COMMIT;

image

Expected behavior

key updated_tz_ind should not lose its stucture.

all keys to complete.

Screenshots

If applicable, add screenshots to help explain your problem.

Server configuration

  • Operating system: Ubuntu 20.04.2
  • Web server: Apache/2.4.48
  • Database version: 8.0.26-0ubuntu0.20.04.2 - (Ubuntu)
  • PHP version: 7.4.22
  • phpMyAdmin version: 5.1.1

Client configuration

  • Browser: Firefox 91.0.1
  • Operating system: Windows 10

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions