Kouhei Sutou
null+****@clear*****
Wed Jan 14 18:04:15 JST 2015
Kouhei Sutou 2015-01-14 18:04:15 +0900 (Wed, 14 Jan 2015) New Revision: b4b030f1f7ae4f79a026adb1959b3589e8f94c4c https://github.com/mroonga/mroonga/commit/b4b030f1f7ae4f79a026adb1959b3589e8f94c4c Message: test: add a test for duplicate error by adding unique index Added files: mysql-test/mroonga/storage/alter_table/add_index/unique/multiple_column/r/duplicated.result mysql-test/mroonga/storage/alter_table/add_index/unique/multiple_column/t/duplicated.test Added: mysql-test/mroonga/storage/alter_table/add_index/unique/multiple_column/r/duplicated.result (+19 -0) 100644 =================================================================== --- /dev/null +++ mysql-test/mroonga/storage/alter_table/add_index/unique/multiple_column/r/duplicated.result 2015-01-14 18:04:15 +0900 (8ab7ef2) @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id1 INT, +id2 INT +) DEFAULT CHARSET=utf8mb4; +INSERT INTO ids (id1, id2) values (1, 2), (1, 2); +ALTER TABLE ids ADD UNIQUE INDEX (id1, id2); +ERROR 23000: Can't write, because of unique constraint, to table 'ids' +SHOW CREATE TABLE ids; +Table Create Table +ids CREATE TABLE `ids` ( + `id1` int(11) DEFAULT NULL, + `id2` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 +SELECT * FROM ids; +id1 id2 +1 2 +1 2 +DROP TABLE ids; Added: mysql-test/mroonga/storage/alter_table/add_index/unique/multiple_column/t/duplicated.test (+39 -0) 100644 =================================================================== --- /dev/null +++ mysql-test/mroonga/storage/alter_table/add_index/unique/multiple_column/t/duplicated.test 2015-01-14 18:04:15 +0900 (86aab83) @@ -0,0 +1,39 @@ +# Copyright(C) 2015 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../../../../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id1 INT, + id2 INT +) DEFAULT CHARSET=utf8mb4; + +INSERT INTO ids (id1, id2) values (1, 2), (1, 2); + +--error ER_DUP_UNIQUE +ALTER TABLE ids ADD UNIQUE INDEX (id1, id2); +SHOW CREATE TABLE ids; + +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../../../../../include/mroonga/have_mroonga_deinit.inc -------------- next part -------------- HTML����������������������������...Download