{"action":"created","issue":{"url":"https://api.github.com/repos/influxdb/influxdb/issues/2458","labels_url":"https://api.github.com/repos/influxdb/influxdb/issues/2458/labels{/name}","comments_url":"https://api.github.com/repos/influxdb/influxdb/issues/2458/comments","events_url":"https://api.github.com/repos/influxdb/influxdb/issues/2458/events","html_url":"https://github.com/influxdb/influxdb/issues/2458","id":72245216,"number":2458,"title":"create database shouldn't cause an error when the database already exists","user":{"login":"neonstalwart","id":84763,"avatar_url":"https://avatars.githubusercontent.com/u/84763?v=3","gravatar_id":"","url":"https://api.github.com/users/neonstalwart","html_url":"https://github.com/neonstalwart","followers_url":"https://api.github.com/users/neonstalwart/followers","following_url":"https://api.github.com/users/neonstalwart/following{/other_user}","gists_url":"https://api.github.com/users/neonstalwart/gists{/gist_id}","starred_url":"https://api.github.com/users/neonstalwart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neonstalwart/subscriptions","organizations_url":"https://api.github.com/users/neonstalwart/orgs","repos_url":"https://api.github.com/users/neonstalwart/repos","events_url":"https://api.github.com/users/neonstalwart/events{/privacy}","received_events_url":"https://api.github.com/users/neonstalwart/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/influxdb/influxdb/labels/category/error%20handling","name":"category/error handling","color":"bfd4f2"},{"url":"https://api.github.com/repos/influxdb/influxdb/labels/category/queries","name":"category/queries","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/influxdb/influxdb/milestones/43","html_url":"https://github.com/influxdb/influxdb/milestones/0.9.4","labels_url":"https://api.github.com/repos/influxdb/influxdb/milestones/43/labels","id":1172852,"number":43,"title":"0.9.4","description":"","creator":{"login":"otoolep","id":536312,"avatar_url":"https://avatars.githubusercontent.com/u/536312?v=3","gravatar_id":"","url":"https://api.github.com/users/otoolep","html_url":"https://github.com/otoolep","followers_url":"https://api.github.com/users/otoolep/followers","following_url":"https://api.github.com/users/otoolep/following{/other_user}","gists_url":"https://api.github.com/users/otoolep/gists{/gist_id}","starred_url":"https://api.github.com/users/otoolep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otoolep/subscriptions","organizations_url":"https://api.github.com/users/otoolep/orgs","repos_url":"https://api.github.com/users/otoolep/repos","events_url":"https://api.github.com/users/otoolep/events{/privacy}","received_events_url":"https://api.github.com/users/otoolep/received_events","type":"User","site_admin":false},"open_issues":86,"closed_issues":25,"state":"open","created_at":"2015-06-19T18:25:47Z","updated_at":"2015-08-27T22:03:25Z","due_on":"2015-09-10T07:00:00Z","closed_at":null},"comments":9,"created_at":"2015-04-30T18:39:00Z","updated_at":"2015-08-27T22:03:28Z","closed_at":"2015-08-27T22:03:25Z","body":"i have a number of clients trying to connect to a single database via HTTP.  each client queries `SHOW DATABASES` to see if the database exists already.  if the database does not exist the client should create it.\r\n\r\nthe problem is that if more than one of these clients start at the same time and discover that the database does not exist, they will each try to create the database.  the first one will succeed but the others will get an error.  i can look at the error message and ignore it if it indicates that the database already exists but it feels kind of brittle to rely simply on an error message to determine whether or not i should ignore this error - e.g. the error message may change over time.\r\n\r\ni'd rather have the server indicate a success even if the database exists.  in fact, i'd rather skip the `SHOW DATABASES` query and just blindly fire off `CREATE DATABASE foo` to ensure the database exists every time each client starts.  \r\n\r\nif there was some reason the database couldn't be created then that should be an error.\r\n\r\ni can take a crack at updating the code if there is consensus to change this behavior.  if there are good reasons not to do this, please explain - thanks."},"comment":{"url":"https://api.github.com/repos/influxdb/influxdb/issues/comments/135567826","html_url":"https://github.com/influxdb/influxdb/issues/2458#issuecomment-135567826","issue_url":"https://api.github.com/repos/influxdb/influxdb/issues/2458","id":135567826,"user":{"login":"beckettsean","id":6537329,"avatar_url":"https://avatars.githubusercontent.com/u/6537329?v=3","gravatar_id":"","url":"https://api.github.com/users/beckettsean","html_url":"https://github.com/beckettsean","followers_url":"https://api.github.com/users/beckettsean/followers","following_url":"https://api.github.com/users/beckettsean/following{/other_user}","gists_url":"https://api.github.com/users/beckettsean/gists{/gist_id}","starred_url":"https://api.github.com/users/beckettsean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beckettsean/subscriptions","organizations_url":"https://api.github.com/users/beckettsean/orgs","repos_url":"https://api.github.com/users/beckettsean/repos","events_url":"https://api.github.com/users/beckettsean/events{/privacy}","received_events_url":"https://api.github.com/users/beckettsean/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T22:03:28Z","updated_at":"2015-08-27T22:03:28Z","body":"Response is now `200` with an error. Seems reasonable.\r\n```\r\n$ curl -iG http://localhost:8086/query --data-urlencode \"db=droptest\"  --data-urlencode \"q=create database test\"; echo\r\nHTTP/1.1 200 OK\r\nContent-Type: application/json\r\nRequest-Id: 64ec1145-4d07-11e5-86ab-000000000000\r\nX-Influxdb-Version: 0.9.2\r\nDate: Thu, 27 Aug 2015 22:03:05 GMT\r\nContent-Length: 49\r\n\r\n{\"results\":[{\"error\":\"database already exists\"}]}\r\n```"}}