@@ -981,6 +981,38 @@ static void selection_error(struct tep_handle *tep,
test_field_exists(tep, sb, expr);
}
+static void compare_error(struct tep_handle *tep,
+ struct sqlhist_bison *sb, struct expr *expr)
+{
+ struct compare *compare = &expr->compare;
+
+ switch (errno) {
+ case ENODEV:
+ case EBADE:
+ break;
+ default:
+ /* System error */
+ return;
+ }
+
+ /* ENODEV means that an event or field does not exist */
+ if (errno == ENODEV) {
+ if (test_field_exists(tep, sb, compare->lval))
+ return;
+ if (test_field_exists(tep, sb, compare->rval))
+ return;
+ return;
+ }
+
+ /* fields exist, but values are not compatible */
+ sb->line_no = compare->lval->line;
+ sb->line_idx = compare->lval->idx;
+
+ parse_error(sb, compare->lval->field.raw,
+ "'%s' is not compatible to compare with '%s'\n",
+ compare->lval->field.raw, compare->rval->field.raw);
+}
+
static struct tracefs_synth *build_synth(struct tep_handle *tep,
const char *name,
struct sql_table *table)
@@ -1073,8 +1105,10 @@ static struct tracefs_synth *build_synth(struct tep_handle *tep,
ret = build_compare(synth, start_system, end_system,
&expr->compare);
- if (ret < 0)
+ if (ret < 0) {
+ compare_error(tep, table->sb, expr);
goto free;
+ }
}
for (expr = table->where; expr; expr = expr->next) {