From dd2e9c1776d4b8cea091dbf780bf810be9347a6b Mon Sep 17 00:00:00 2001 From: Austin Riendeau Date: Thu, 17 Sep 2015 22:03:42 -0600 Subject: [PATCH] fixes #3939 by allowing `t` and `f` to be treated as booleans --- CHANGELOG.md | 1 + influxql/parser_test.go | 8 ++++++++ influxql/token.go | 2 ++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 509b108f25a..a1e22fbe9a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - [#4111](https://github.com/influxdb/influxdb/pull/4111): Update pre-commit hook for go vet composites - [#4136](https://github.com/influxdb/influxdb/pull/4136): Return an error-on-write if target retention policy does not exist. Thanks for the report @ymettier - [#4124](https://github.com/influxdb/influxdb/issues/4124): Missing defer/recover/panic idiom in HTTPD service +- [#3939](https://github.com/influxdb/influxdb/issues/3939): [0.9.3] Acceptable boolean syntax differs for data writes and data queries thanks @apriendeau ## v0.9.4 [2015-09-14] diff --git a/influxql/parser_test.go b/influxql/parser_test.go index 94944398a75..c42d03d8e0c 100644 --- a/influxql/parser_test.go +++ b/influxql/parser_test.go @@ -1590,7 +1590,15 @@ func TestParser_ParseExpr(t *testing.T) { {s: `100`, expr: &influxql.NumberLiteral{Val: 100}}, {s: `'foo bar'`, expr: &influxql.StringLiteral{Val: "foo bar"}}, {s: `true`, expr: &influxql.BooleanLiteral{Val: true}}, + {s: `True`, expr: &influxql.BooleanLiteral{Val: true}}, + {s: `TRUE`, expr: &influxql.BooleanLiteral{Val: true}}, + {s: `t`, expr: &influxql.BooleanLiteral{Val: true}}, + {s: `T`, expr: &influxql.BooleanLiteral{Val: true}}, {s: `false`, expr: &influxql.BooleanLiteral{Val: false}}, + {s: `False`, expr: &influxql.BooleanLiteral{Val: false}}, + {s: `FALSE`, expr: &influxql.BooleanLiteral{Val: false}}, + {s: `f`, expr: &influxql.BooleanLiteral{Val: false}}, + {s: `F`, expr: &influxql.BooleanLiteral{Val: false}}, {s: `my_ident`, expr: &influxql.VarRef{Val: "my_ident"}}, {s: `'2000-01-01 00:00:00'`, expr: &influxql.TimeLiteral{Val: mustParseTime("2000-01-01T00:00:00Z")}}, {s: `'2000-01-01 00:00:00.232'`, expr: &influxql.TimeLiteral{Val: mustParseTime("2000-01-01T00:00:00.232Z")}}, diff --git a/influxql/token.go b/influxql/token.go index 795c7b169e8..77da55c399c 100644 --- a/influxql/token.go +++ b/influxql/token.go @@ -246,6 +246,8 @@ func init() { for _, tok := range []Token{AND, OR} { keywords[strings.ToLower(tokens[tok])] = tok } + keywords["t"] = TRUE + keywords["f"] = FALSE keywords["true"] = TRUE keywords["false"] = FALSE }