# ==== Purpose ====
#
# Verify that ADD PRIMARY KEY can report duplicate key value
#
# ==== References ====
#
# Bug #14219515    DUPLICATE VALUE NOT REPORTED FOR ADD PRIMARY KEY
#
--source include/have_innodb.inc

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1(a INT NOT NULL, b INT) ENGINE = INNODB;
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4);
--ERROR ER_DUP_ENTRY
ALTER TABLE t1 ADD PRIMARY KEY(b), ADD UNIQUE INDEX(a);
DROP TABLE t1;
