Skip to content

Commit

Permalink
Remove and add note about IF NOT EXISTS; Fixes #254
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnaraasen committed Feb 24, 2016
1 parent ef62740 commit 8bbe290
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
9 changes: 3 additions & 6 deletions content/influxdb/v0.10/query_language/database_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,15 @@ The `CREATE DATABASE` query takes the following form:
CREATE DATABASE [IF NOT EXISTS] <database_name> [WITH [DURATION <duration>] [REPLICATION <n>] [NAME <retention-policy-name>]]
```

> **Note:** The `IF NOT EXISTS` clause does nothing, is deprecated, and will be removed in InfluxDB version 0.12.
The `CREATE DATABASE` query will return successfully with no error when a new database is created or if the database already exists.

Create the database ` NOAA_water_database`:
```bash
> CREATE DATABASE NOAA_water_database
>
```

Create the database `NOAA_water_database` only if it doesn't exist:
```bash
> CREATE DATABASE IF NOT EXISTS NOAA_water_database
>
```

Create the database `NOAA_water_database` with a new retention policy called `liquid`:
```bash
> CREATE DATABASE NOAA_water_database WITH DURATION 3d REPLICATION 3 NAME liquid
Expand Down
5 changes: 1 addition & 4 deletions content/influxdb/v0.10/query_language/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,13 @@ END;
### CREATE DATABASE

```
create_database_stmt = "CREATE DATABASE" ["IF NOT EXISTS"] db_name
create_database_stmt = "CREATE DATABASE" db_name
```

#### Examples:

```sql
CREATE DATABASE foo

-- create a database if it doesn't already exist
CREATE DATABASE IF NOT EXISTS foo
```

### CREATE RETENTION POLICY
Expand Down
2 changes: 1 addition & 1 deletion content/influxdb/v0.10/tools/shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Example:
File (`datarrr.txt`):
```
# DDL
CREATE DATABASE IF NOT EXISTS pirates
CREATE DATABASE pirates
CREATE RETENTION POLICY oneday ON pirates DURATION 1d REPLICATION 1
# DML
Expand Down

0 comments on commit 8bbe290

Please sign in to comment.