Skip to content

Commit

Permalink
Merge pull request #2228 from influxdb/fix-2215
Browse files Browse the repository at this point in the history
fix #2215: allow keyword default to be unquoted
  • Loading branch information
dgnorton committed Apr 9, 2015
2 parents 22cec96 + 33c7bdd commit 61cd463
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Bugfixes
- [#2225](https://github.com/influxdb/influxdb/pull/2225): Make keywords completely case insensitive
- [#2228](https://github.com/influxdb/influxdb/pull/2228): Accept keyword default unquoted in ALTER RETENTION POLICY statement

## v0.9.0-rc22 [2015-04-09]

Expand Down
15 changes: 9 additions & 6 deletions influxql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,19 +293,22 @@ func (p *Parser) parseAlterRetentionPolicyStatement() (*AlterRetentionPolicyStat
stmt := &AlterRetentionPolicyStatement{}

// Parse the retention policy name.
ident, err := p.parseIdent()
if err != nil {
return nil, err
tok, pos, lit := p.scanIgnoreWhitespace()
if tok == DEFAULT {
stmt.Name = "default"
} else if tok == IDENT {
stmt.Name = lit
} else {
return nil, newParseError(tokstr(tok, lit), []string{"identifier"}, pos)
}
stmt.Name = ident

// Consume the required ON token.
if tok, pos, lit := p.scanIgnoreWhitespace(); tok != ON {
if tok, pos, lit = p.scanIgnoreWhitespace(); tok != ON {
return nil, newParseError(tokstr(tok, lit), []string{"ON"}, pos)
}

// Parse the database name.
ident, err = p.parseIdent()
ident, err := p.parseIdent()
if err != nil {
return nil, err
}
Expand Down
5 changes: 5 additions & 0 deletions influxql/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,11 @@ func TestParser_ParseStatement(t *testing.T) {
s: `ALTER RETENTION POLICY policy1 ON testdb REPLICATION 4`,
stmt: newAlterRetentionPolicyStatement("policy1", "testdb", -1, 4, false),
},
// ALTER default retention policy unquoted
{
s: `ALTER RETENTION POLICY default ON testdb REPLICATION 4`,
stmt: newAlterRetentionPolicyStatement("default", "testdb", -1, 4, false),
},

// SHOW STATS
{
Expand Down

0 comments on commit 61cd463

Please sign in to comment.