Querious Help 5

Postgres Schema Types

PostgreSQL enum, composite, range, and domain types.

The Types subview of Schema Structure lists the user-defined types in a PostgreSQL schema. Select a type to see and edit its definition.

An enum type in the Types subview

Editing a Type #

What you can edit depends on the kind of type:

Kind Editable Read-only
Enum Labels The order of existing labels.
Composite Attributes
Range, Multirange Owner and comment only Subtype and range functions.
Domain Check constraints Base type, default, and NOT NULL.

For every kind, the Owner and Comment can be changed, and changes are applied automatically.

Changes to labels, attributes, and constraints are collected until you click Apply, or Revert.

To change a type's definition

  1. Select the type in the list.
  2. In the detail pane, add, rename, or remove labels, attributes, or check constraints. Nothing is sent to the server yet.
  3. Click Apply to run the changes, or Revert to discard them.

You'll be asked to apply or discard pending changes before switching to another type.

Adding and Removing Types #

The and buttons below the list create and drop types.

Kind Choose when creating
Enum, Composite Just the Name. Add the labels or attributes afterward.
Range The Name and the Subtype whose values it spans.
Domain The Name and the Base Type it builds on. Add check constraints afterward.

To create a type

  1. Click below the list.
  2. Enter a Name. Choose the Kind.
  3. For a range or domain, also choose its Subtype or Base Type.
  4. Click "Add Type"
  5. For an enum, composite, or domain, you would next add its labels, attributes, or check constraints in the detail pane, then click Apply.

To drop a type

  1. Select the type in the list.
  2. Click .
  3. Confirm the alert.