Skip to content

Commit

Permalink
Detect arithmetic operator against relation expression result
Browse files Browse the repository at this point in the history
If it's detected, the expression is an invalid expression. This is the
same behavior as before supporting arithmetic operator with index search.
  • Loading branch information
kou committed Nov 3, 2014
1 parent 7222c2b commit f1bb9c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4450,6 +4450,7 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
case GRN_OP_MOD :
if (stat < SCAN_COL1 || SCAN_CONST < stat) { return NULL; }
stat = SCAN_START;
if (m != o + 1) { return NULL; }
break;
case GRN_OP_AND :
case GRN_OP_OR :
Expand Down
1 change: 1 addition & 0 deletions lib/mrb/scripts/scan_info_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def valid?
return false if status < Status::COL1
return false if status > Status::CONST
status = Status::START
return false if n_relation_expressions != (n_logical_expressions + 1)
when *LOGICAL_OPERATORS
return false if status != Status::START
n_logical_expressions += 1
Expand Down

0 comments on commit f1bb9c2

Please sign in to comment.