[MDEV-10473] Duplicate constraint names Created: 2016-08-01  Updated: 2016-08-01  Resolved: 2016-08-01

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.2
Fix Version/s: 10.2.2

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexey Botchkov
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-10421 duplicate CHECK CONSTRAINTs Closed

 Description   

This script:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT);
ALTER TABLE t1 ADD CONSTRAINT c1 CHECK (a > 0);
ALTER TABLE t1 ADD CONSTRAINT c1 CHECK (a > 0);
SHOW CREATE TABLE t1;

returns:

CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  CONSTRAINT `c1` CHECK (a > 0),
  CONSTRAINT `c1` CHECK (a > 0)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 

Notice, two constrains with a duplicate name are allowed.



 Comments   
Comment by Alexander Barkov [ 2016-08-01 ]

The same problem is repeatable in this script:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT, CONSTRAINT c1 CHECK (a>1), CONSTRAINT c1 CHECK (a>1));
SHOW CREATE TABLE t1;

CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  CONSTRAINT `c1` CHECK (a>1),
  CONSTRAINT `c1` CHECK (a>1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

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