Skip to content

NAMESPACE CREATE

Creates a new namespace with the given hierarchical path.

NAMESPACE CREATE <namespace>
ParameterTypeRequiredDescription
namespacestringYesDot-separated hierarchical path for the namespace (e.g. production.users).

Returns OK on success.

Namespaces are hierarchical paths separated by dots (.). Creating a namespace like production.users.api automatically creates intermediate directories (production and production.users) in the FoundationDB directory layer.

The command uses an isolated one-off transaction to prevent consistency issues.

Before creating the namespace, a tombstone barrier check is performed. If the namespace was previously moved via NAMESPACE MOVE and not all cluster members have observed the tombstone, the creation is rejected. This prevents stale reads on members that still reference the old namespace path.

The maximum namespace depth is 10. For example, a.b.c.d.e.f.g.h.i.j is the deepest allowed path.

The __internal__ name is reserved at any level of the hierarchy and cannot be used.

Error CodeDescription
NAMESPACEALREADYEXISTSA namespace with the same path already exists.
NAMESPACEBEINGREMOVEDThe namespace was previously removed via NAMESPACE REMOVE but has not yet been purged via NAMESPACE PURGE.
ERRThe namespace path contains the reserved __internal__ leaf, the namespace depth exceeds the maximum allowed depth of 10, or the tombstone barrier is not satisfied after a prior NAMESPACE MOVE.

Create a namespace:

> NAMESPACE CREATE production.users
OK

Duplicate namespace:

> NAMESPACE CREATE production.users
OK
> NAMESPACE CREATE production.users
(error) NAMESPACEALREADYEXISTS Namespace already exists: production.users

Namespace being removed:

> NAMESPACE CREATE staging.orders
OK
> NAMESPACE REMOVE staging.orders
OK
> NAMESPACE CREATE staging.orders
(error) NAMESPACEBEINGREMOVED Namespace 'staging.orders' is being removed

Reserved name:

> NAMESPACE CREATE name.__internal__
(error) ERR Namespace 'name.__internal__' is reserved for internal use

Tombstone barrier isn’t satisfied:

> NAMESPACE CREATE old-namespace
(error) ERR Not all cluster members have observed the tombstone for namespace 'old-namespace'