Skip to content

Commit

Permalink
fixes influxdata#3939 by allowing t and f to be treated as booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
apriendeau committed Sep 18, 2015
1 parent a52cf6b commit dd2e9c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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]

Expand Down
8 changes: 8 additions & 0 deletions influxql/parser_test.go
Expand Up @@ -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")}},
Expand Down
2 changes: 2 additions & 0 deletions influxql/token.go
Expand Up @@ -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
}
Expand Down

0 comments on commit dd2e9c1

Please sign in to comment.