Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move columns with ENUM() & DEFAULT causes invalid SQL #18962

Closed
ChrisHSandN opened this issue Jan 31, 2024 · 2 comments
Closed

Move columns with ENUM() & DEFAULT causes invalid SQL #18962

ChrisHSandN opened this issue Jan 31, 2024 · 2 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Milestone

Comments

@ChrisHSandN
Copy link

Describe the bug

Move columns fails to generate a valid ALTER TABLE statement when used on an ENUM field with a default value.

To Reproduce

Steps to reproduce the behavior:

CREATE TABLE `test` (
  `id` int(11) NOT NULL,
  `enum` enum('yes','no') NOT NULL DEFAULT 'no',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
  1. Go to "Structure"
  2. Click on "Move columns"
  3. Drag enum above id
  4. Click Go
  5. Error:

# 1067 - Invalid default value for 'enum'

ALTER TABLE `test` 
CHANGE `enum` `enum` ENUM('yes','no') 
CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL 
DEFAULT '\'no\'' FIRST

Note the extraneous double quoting of the DEFAULT 'no'

Expected behavior

The move columns feature should produce valid SQL for ENUM fields with a default value.

Screenshots

image

image

Server configuration

  • Operating system: Rocky 8
  • Web server: Apache
  • Database version: 10.4.32-MariaDB-
  • PHP version: 8.1.26
  • phpMyAdmin version: 5.2.1-1
@hesammoosapour
Copy link

Same issue here.

@johnson361
Copy link
Contributor

Can anyone please review my PR ?

@williamdes williamdes self-assigned this Apr 28, 2024
@williamdes williamdes added this to the 5.2.2 milestone Apr 28, 2024
@williamdes williamdes added Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete labels Apr 28, 2024
williamdes added a commit that referenced this issue Apr 28, 2024
Signed-off-by: William Desportes <williamdes@wdes.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
None yet
Development

No branches or pull requests

4 participants