Navigation Menu

Skip to content

Commit

Permalink
dump: fix a bug that no column table isn't dumped
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 3, 2015
1 parent 1e74140 commit 255576e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/proc.c
Expand Up @@ -2940,7 +2940,8 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
grn_table_cursor *cursor;
int i, ncolumns, n_use_columns;
grn_obj columnbuf, delete_commands, use_columns, column_name;
grn_bool have_only_index_column = GRN_TRUE;
grn_bool have_index_column = GRN_FALSE;
grn_bool have_data_column = GRN_FALSE;

switch (table->header.type) {
case GRN_TABLE_HASH_KEY:
Expand All @@ -2965,11 +2966,12 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
GRN_TEXT_INIT(&column_name, 0);
for (i = 0; i < ncolumns; i++) {
if (GRN_OBJ_INDEX_COLUMNP(columns[i])) {
have_index_column = GRN_TRUE;
continue;
}

if (columns[i]->header.type != GRN_ACCESSOR) {
have_only_index_column = GRN_FALSE;
have_data_column = GRN_TRUE;
}

GRN_BULK_REWIND(&column_name);
Expand All @@ -2993,7 +2995,7 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table)
GRN_PTR_PUT(ctx, &use_columns, columns[i]);
}

if (have_only_index_column) {
if (have_index_column && !have_data_column) {
goto exit;
}

Expand Down

0 comments on commit 255576e

Please sign in to comment.