[Groonga-commit] groonga/groonga [master] [shcema][table-create] show key type name on big key size error.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 12月 19日 (月) 17:16:14 JST


Kouhei Sutou	2011-12-19 08:16:14 +0000 (Mon, 19 Dec 2011)

  New Revision: 2557b211ad99e27c17bbe26f9e1be30933859a2d

  Log:
    [shcema][table-create] show key type name on big key size error.
    
    refs #915
    refs #1210

  Modified files:
    lib/db.c
    test/unit/http/test-http-schema.rb

  Modified: lib/db.c (+8 -2)
===================================================================
--- lib/db.c    2011-12-19 08:13:11 +0000 (58ddcf4)
+++ lib/db.c    2011-12-19 08:16:14 +0000 (58719ed)
@@ -720,9 +720,15 @@ grn_table_create(grn_ctx *ctx, const char *name, unsigned name_size,
         flags |= t->header.flags;
         key_size = GRN_TYPE_SIZE(t);
         if (key_size > GRN_TABLE_MAX_KEY_SIZE) {
+          int type_name_size;
+          char type_name[GRN_TABLE_MAX_KEY_SIZE];
+          type_name_size = grn_obj_name(ctx, key_type, type_name,
+                                        GRN_TABLE_MAX_KEY_SIZE);
           ERR(GRN_INVALID_ARGUMENT,
-              "[table][create] key size too big: <%.*s> (%u) (max:%u)",
-              name_size, name, key_size, GRN_TABLE_MAX_KEY_SIZE);
+              "[table][create] key size too big: <%.*s> <%.*s>(%u) (max:%u)",
+              name_size, name,
+              type_name_size, type_name,
+              key_size, GRN_TABLE_MAX_KEY_SIZE);
           GRN_API_RETURN(NULL);
         }
       }

  Modified: test/unit/http/test-http-schema.rb (+2 -2)
===================================================================
--- test/unit/http/test-http-schema.rb    2011-12-19 08:13:11 +0000 (1dcdd72)
+++ test/unit/http/test-http-schema.rb    2011-12-19 08:16:14 +0000 (f6f2d4f)
@@ -326,7 +326,7 @@ class HTTPSchemaTest < Test::Unit::TestCase
       assert_error_response(Result::INVALID_ARGUMENT,
                             "[table][create] " +
                               "key size too big: " +
-                              "<users> (65536) (max:4096)",
+                              "<users> <Text>(65536) (max:4096)",
                             response,
                             :content_type => "application/json")
 
@@ -454,7 +454,7 @@ class HTTPSchemaTest < Test::Unit::TestCase
       assert_error_response(Result::INVALID_ARGUMENT,
                             "[table][create] " +
                               "key size too big: " +
-                              "<users> (65536) (max:4096)",
+                              "<users> <Text>(65536) (max:4096)",
                             response,
                             :content_type => "application/json")
 




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