-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
works for me. I think we need to add Anyone have a better way to keep those two in sync than just manually copying? |
@beckettsean -- I don' thave a better way, but I will update |
@beckettsean -- we also need to update the documents around |
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. |
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) | ||
} |
There was a problem hiding this comment.
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
}
@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. |
Thanks for the pointer @dgnorton |
CREATE DATABASE [IF NOT EXISTS] ...
Add support for optional
IF NOT EXISTS
toCREATE 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.