CREATE DATABASE

Creates a new database.

Synopsis

  1. CREATE DATABASE <database_name> [s[WITH] <database_attribute>=<value> [ ... ]]

where is:

  1. [OWNER=<database_owner>]
  2. [TEMPLATE=<template>]
  3. [ENCODING=<encoding>]
  4. [TABLESPACE=<tablespace>]
  5. [CONNECTION LIMIT=<connection_limit>]

Description

CREATE DATABASE creates a new database. To create a database, you must be a superuser or have the special CREATEDB privilege.

The creator becomes the owner of the new database by default. Superusers can create databases owned by other users by using the OWNER clause. They can even create databases owned by users with no special privileges. Non-superusers with CREATEDB privilege can only create databases owned by themselves.

By default, the new database is created by cloning the standard system database template named template1. You can specify a different template by including the WITH TEMPLATE=<template> clause in the CREATE DATABASE command. In particular, specifying WITH TEMPLATE=template0 creates a clean database containing only the standard objects predefined by HAWQ. This is useful if you wish to avoid copying any installation-local objects that may have been added to template1.

Parameters

The name of a database to create.

Note: HAWQ reserves the database name hcatalog for system use.

OWNER=

The name of the database user who will own the new database, or DEFAULT to use the default owner (the user executing the command).

TEMPLATE=