Webyog provides monitoring and management tools for open source relational databases. We develop easy-to-use MySQL client tools for performance tuning and database management. Webyog's solutions include SQL Diagnostic Manager for MySQL performance optimization and SQLyog for MySQL administration. More than 35,000 companies (including Amazon, IBM, Salesforce, AT&T, eBay, and GE) and 2.5 million users rely on Webyog's solutions to provide valuable insights into their databases. Webyog is an Idera, Inc. company.
Create the below table using the SQLyog ‘Create Table’ option/grid, but do not type the parentheses for the CHECK condition (i.e., type the text highlighted `val` = 1 OR `val` IS NULL ).
CREATE TABLE `test` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`val` INT(11)COMMENT 'abcd' CHECK (`val` = 1 OR `val` IS NULL),
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
NB: SQLyog encloses the column level CHECK constraint's condition in parenthesis in the query generated.
Using the ‘Alter Table’ option, replace the entire column level check condition with `val` = 1. And save the changes.
It returns the syntax error since the check condition isn’t enclosed in parenthesis.
Server affected: MariaDB 11.1.3 and below
Steps to reproduce:
Create the below table using the SQLyog ‘Create Table’ option/grid, but do not type the parentheses for the CHECK condition (i.e., type the text highlighted
`val` = 1 OR `val` IS NULL
).NB: SQLyog encloses the column level CHECK constraint's condition in parenthesis in the query generated.
Using the ‘Alter Table’ option, replace the entire column level check condition with
`val` = 1
. And save the changes.It returns the syntax error since the check condition isn’t enclosed in parenthesis.