[Groonga-mysql-commit] mroonga/mroonga at 450b262 [master] test: add a UNIQUE INDEX test for 0 value and NULL

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Nov 8 23:50:27 JST 2017


Kouhei Sutou	2017-11-08 23:50:27 +0900 (Wed, 08 Nov 2017)

  New Revision: 450b262061a5a458d4ddfa835b49dc8cdc792afb
  https://github.com/mroonga/mroonga/commit/450b262061a5a458d4ddfa835b49dc8cdc792afb

  Message:
    test: add a UNIQUE INDEX test for 0 value and NULL

  Added files:
    mysql-test/mroonga/storage/index/unique/r/null.result
    mysql-test/mroonga/storage/index/unique/t/null.test

  Added: mysql-test/mroonga/storage/index/unique/r/null.result (+19 -0) 100644
===================================================================
--- /dev/null
+++ mysql-test/mroonga/storage/index/unique/r/null.result    2017-11-08 23:50:27 +0900 (1799dfa2)
@@ -0,0 +1,19 @@
+DROP TABLE IF EXISTS numbers;
+CREATE TABLE numbers (
+value int,
+UNIQUE KEY (value)
+);
+INSERT INTO numbers (value) VALUES (0);
+INSERT INTO numbers (value) VALUES (1);
+INSERT INTO numbers (value) VALUES (NULL);
+ERROR 23000: Duplicate entry 'NULL' for key 'value'
+INSERT INTO numbers (value) VALUES (2);
+SELECT * FROM numbers;
+value
+0
+1
+2
+SELECT * FROM numbers WHERE value = 0;
+value
+0
+DROP TABLE numbers;

  Added: mysql-test/mroonga/storage/index/unique/t/null.test (+38 -0) 100644
===================================================================
--- /dev/null
+++ mysql-test/mroonga/storage/index/unique/t/null.test    2017-11-08 23:50:27 +0900 (f4e14f1c)
@@ -0,0 +1,38 @@
+# Copyright(C) 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+--source ../../../../include/mroonga/have_mroonga.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS numbers;
+--enable_warnings
+
+CREATE TABLE numbers (
+  value int,
+  UNIQUE KEY (value)
+);
+
+INSERT INTO numbers (value) VALUES (0);
+INSERT INTO numbers (value) VALUES (1);
+--error ER_DUP_ENTRY
+INSERT INTO numbers (value) VALUES (NULL);
+INSERT INTO numbers (value) VALUES (2);
+SELECT * FROM numbers;
+SELECT * FROM numbers WHERE value = 0;
+
+DROP TABLE numbers;
+
+--source ../../../../include/mroonga/have_mroonga_deinit.inc
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-mysql-commit/attachments/20171108/fcf51551/attachment-0001.htm 



More information about the Groonga-mysql-commit mailing list
Back to archive index