[MDEV-10456] CHECK constraints appears with unquoted names in SHOW CREATE TABLE Created: 2016-07-28  Updated: 2017-01-17  Resolved: 2017-01-17

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.2.1
Fix Version/s: 10.2.3

Type: Bug Priority: Minor
Reporter: Anders Karlsson Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None


 Description   

When doing s SHOW TABLE on a tables with CHECK constraints, any names in the CHECK constraint appears unquoted, in difference to other names and constraints and also to the actual CHECK constraint name, this issue is only about the actual content of the check constraint:

DROP TABLE IF EXISTS foo2;
DROP TABLE IF EXISTS foo1;
 
CREATE TABLE foo1(bar INT NOT NULL PRIMARY KEY);
CREATE TABLE foo2(bar INT,
  FOREIGN KEY(bar) REFERENCES foo1(bar),
  CHECK(bar > 1));
 
SHOW CREATE TABLE foo2;
CREATE TABLE `foo2` (
  `bar` int(11) DEFAULT NULL,
  KEY `bar` (`bar`),
  CONSTRAINT `foo2_ibfk_1` FOREIGN KEY (`bar`) REFERENCES `foo1` (`bar`),
  CONSTRAINT `CONSTRAINT_1` CHECK (bar > 1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1



 Comments   
Comment by Elena Stepanova [ 2016-07-29 ]

It seems that the condition is quoted verbatim: if it was put with quoted names, it stays with quoted names, it it was without quotes, it stays without. Thus, it shouldn't be extremely harmful – at least I can't think right away of a scenario when we would end up with invalid table definition in SHOW CREATE because of this – but still something to look at.

Generated at Thu Feb 08 07:42:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.