TablePlus-Windows
TablePlus-Windows copied to clipboard
SQL error when updating columns with ENUMs type and a default value
Please answer the questions below, it helps us to track the issue.
-
Which driver are you using and version of it (Ex: PostgreSQL 10.0): MariaDB 10.4.1
-
Which TablePlus build number are you using (the number on the welcome screen, Ex: build 81): 186
-
The steps to reproduce this issue: Add or remove an option from an ENUM with a default value. The generated query does not wrap the default value in quotes and causes an error.
Example: The query generated when adding 'newvalue' to the enum of a field looks like:
ALTER TABLE `database`.`table`
CHANGE `enum_field` `enum_field` enum('a','b','c','newvalue') NOT NULL DEFAULT a COMMENT '';
-- You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'a COMMENT ''' at line 2
DEFAULT a should be DEFAULT 'a'
Hi @brodenbrett, sorry for late response. I could not reproduce this issue because it worked perfectly on my PC. Could you please me a piece of your data? It might help us easy to find out the problem. Thank you for you feedback.
@son11592 Sorry for the late reply haha. Here's a step by step with screenshots of what I see on my PC:
Step 1: I created a table with an enum column and inserted some data:

Step 2: I'm going into the structure tab of this table and changing the enum's 'type' column

Step 3: Error on save

Notice how the generated ALTER TABLE statement has not wrapped the default value in quotes:

Hi @brodenbrett, that's so weird! I still could not reproduce with your steps. I will investigate more into this issue. If any update, I will let you know as soon as possible. Thank you so much for your support.
Experienced the same issue. When I edit an ENUM column, the alter code that's ran is missing single quotes around the default value.
