[Groonga-mysql-commit] mroonga/mroonga [master] [test][storage][index] add a test for create index/drop index for multiple column index.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 10月 27日 (木) 14:51:25 JST


Kouhei Sutou	2011-10-27 05:51:25 +0000 (Thu, 27 Oct 2011)

  New Revision: 4c5345ee816fdaae1580f2146a6568e1a67ad0fd

  Log:
    [test][storage][index] add a test for create index/drop index for multiple column index.

  Added files:
    test/sql/groonga_storage/r/multiple_column_index_recreate.result
    test/sql/groonga_storage/t/multiple_column_index_recreate.test

  Added: test/sql/groonga_storage/r/multiple_column_index_recreate.result (+39 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/groonga_storage/r/multiple_column_index_recreate.result    2011-10-27 05:51:25 +0000 (19ebf24)
@@ -0,0 +1,39 @@
+drop table if exists listing;
+set names utf8;
+create table listing (
+id int primary key auto_increment not null,
+last_name char(30) not null,
+first_name char(30) not null,
+index name (last_name, first_name)
+) default charset utf8;
+show create table listing;
+Table	Create Table
+listing	CREATE TABLE `listing` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `last_name` char(30) NOT NULL,
+  `first_name` char(30) NOT NULL,
+  PRIMARY KEY (`id`),
+  KEY `name` (`last_name`,`first_name`)
+) ENGINE=groonga DEFAULT CHARSET=utf8
+insert into listing (last_name, first_name) values("Taro", "Yamada");
+insert into listing (last_name, first_name) values("Taro", "Suzuki");
+insert into listing (last_name, first_name) values("Jiro", "Yamada");
+insert into listing (last_name, first_name) values("Taro", "Tanaka");
+select * from listing
+where last_name = "Taro" and (first_name >= "S" and first_name <= "Y");
+id	last_name	first_name
+2	Taro	Suzuki
+4	Taro	Tanaka
+drop index name on listing;
+select * from listing
+where last_name = "Taro" and (first_name >= "S" and first_name <= "Y");
+id	last_name	first_name
+2	Taro	Suzuki
+4	Taro	Tanaka
+create index new_name_index on listing (last_name, first_name);
+select * from listing
+where last_name = "Taro" and (first_name >= "S" and first_name <= "Y");
+id	last_name	first_name
+2	Taro	Suzuki
+4	Taro	Tanaka
+drop table listing;

  Added: test/sql/groonga_storage/t/multiple_column_index_recreate.test (+50 -0) 100644
===================================================================
--- /dev/null
+++ test/sql/groonga_storage/t/multiple_column_index_recreate.test    2011-10-27 05:51:25 +0000 (f432121)
@@ -0,0 +1,50 @@
+# Copyright(C) 2011 Kouhei Sutou <kou****@clear*****>
+#
+# 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 suite/groonga_include/groonga_init.inc
+
+--disable_warnings
+drop table if exists listing;
+--enable_warnings
+
+set names utf8;
+create table listing (
+  id int primary key auto_increment not null,
+  last_name char(30) not null,
+  first_name char(30) not null,
+  index name (last_name, first_name)
+) default charset utf8;
+show create table listing;
+
+insert into listing (last_name, first_name) values("Taro", "Yamada");
+insert into listing (last_name, first_name) values("Taro", "Suzuki");
+insert into listing (last_name, first_name) values("Jiro", "Yamada");
+insert into listing (last_name, first_name) values("Taro", "Tanaka");
+
+select * from listing
+  where last_name = "Taro" and (first_name >= "S" and first_name <= "Y");
+
+drop index name on listing;
+select * from listing
+  where last_name = "Taro" and (first_name >= "S" and first_name <= "Y");
+
+create index new_name_index on listing (last_name, first_name);
+select * from listing
+  where last_name = "Taro" and (first_name >= "S" and first_name <= "Y");
+
+drop table listing;
+
+--source suite/groonga_include/groonga_deinit.inc




Groonga-mysql-commit メーリングリストの案内
Back to archive index