Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CREATE DATABASE [IF NOT EXISTS] ... #3892

Merged
merged 5 commits into from
Aug 29, 2015
Merged

CREATE DATABASE [IF NOT EXISTS] ... #3892

merged 5 commits into from
Aug 29, 2015

Conversation

otoolep
Copy link
Contributor

@otoolep otoolep commented Aug 29, 2015

Add support for optional IF NOT EXISTS to CREATE DATABASE command. This is generally useful to ensure a database exists with a default retention policy, without having to bother with error checking.

It is also specifically useful for the upcoming monitoring functionality.

This was also requested in #2458 and follows the pattern of mysql and sqlite.

@otoolep
Copy link
Contributor Author

otoolep commented Aug 29, 2015

@dgnorton @beckettsean

@beckettsean
Copy link
Contributor

works for me. I think we need to add NOT to https://github.com/influxdb/influxdb/blob/master/influxql/INFLUXQL.md#keywords and to https://github.com/influxdb/influxdb.com/blob/master/content/docs/v0.9/query_language/spec.md#keywords, which is basically a copy of the former in the Docs repo.

Anyone have a better way to keep those two in sync than just manually copying?

@otoolep
Copy link
Contributor Author

otoolep commented Aug 29, 2015

@beckettsean -- I don' thave a better way, but I will update INFLUXQL.md as part of this PR.

@otoolep
Copy link
Contributor Author

otoolep commented Aug 29, 2015

@beckettsean -- we also need to update the documents around CREATE DATABASE too, of course.

@otoolep
Copy link
Contributor Author

otoolep commented Aug 29, 2015

Branch is green on Circle, as can be seen here https://circleci.com/gh/influxdb/influxdb/tree/if_not_exists

Final commit was docs only, so CI was skipped.

@otoolep
Copy link
Contributor Author

otoolep commented Aug 29, 2015

Added another test, so Circle should kick off again.

}
if tok, pos, lit := p.scanIgnoreWhitespace(); tok != EXISTS {
return nil, newParseError(tokstr(tok, lit), []string{"EXISTS"}, pos)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOT EXISTS parsing can be shortened to this...

if err := p.parseTokens([]Token{NOT, EXISTS}); err != nil {
   return nil, err
}

@dgnorton
Copy link
Contributor

@otoolep one minor thing but otherwise +1

@beckettsean yes, keeping those two in sync is something that needs to be automated. I'll look into it.

@otoolep
Copy link
Contributor Author

otoolep commented Aug 29, 2015

Thanks for the pointer @dgnorton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants