Navigation Menu

Skip to content

Commit

Permalink
skipping virtual columns when creating actual columns.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikdttr committed Nov 12, 2010
1 parent edd7260 commit 409ecd5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ha_mroonga.cc
Expand Up @@ -839,6 +839,10 @@ int ha_mroonga::create(const char *name, TABLE *table, HA_CREATE_INFO *info)
Field *field = table->s->field[i];
const char *col_name = field->field_name;
int col_name_size = strlen(col_name);

if (strncmp(MRN_ID_COL_NAME, col_name, col_name_size) == 0) continue;
if (strncmp(MRN_SCORE_COL_NAME, col_name, col_name_size) == 0) continue;

grn_obj_flags col_flags = GRN_OBJ_PERSISTENT | GRN_OBJ_COLUMN_SCALAR;
int mysql_field_type = field->type();
grn_builtin_type gtype = mrn_get_type(ctx, mysql_field_type);
Expand Down
12 changes: 12 additions & 0 deletions test/sql/r/create_table.result
Expand Up @@ -148,6 +148,18 @@ desc t1;
Field Type Null Key Default Extra
c1 set('A','B','AB','O') YES NULL
drop table t1;
create table t1 (c1 int, `_id` int) engine = groonga;
desc t1;
Field Type Null Key Default Extra
c1 int(11) YES NULL
_id int(11) YES NULL
drop table t1;
create table t1 (c1 int, `_score` float) engine = groonga;
desc t1;
Field Type Null Key Default Extra
c1 int(11) YES NULL
_score float YES NULL
drop table t1;
create table `_aaa` (c1 int) engine = groonga;
ERROR HY000: name can't start with '_' and 0-9, and contains only 0-9, A-Z, a-z, or _
create table t1 (c1 int, `_id` text) engine = groonga;
Expand Down
8 changes: 8 additions & 0 deletions test/sql/t/create_table.test
Expand Up @@ -115,6 +115,14 @@ create table t1 (c1 set("A","B","AB","O"));
desc t1;
drop table t1;

# virtual columns
create table t1 (c1 int, `_id` int) engine = groonga;
desc t1;
drop table t1;
create table t1 (c1 int, `_score` float) engine = groonga;
desc t1;
drop table t1;

# error
--error 1005
create table `_aaa` (c1 int) engine = groonga;
Expand Down

0 comments on commit 409ecd5

Please sign in to comment.