Skip to main content
Expand a schema and Types sits beside Functions and Triggers, one row per enum, composite, domain and range the schema declares. Select a row and press Return, or double-click it, and the type’s CREATE statement opens in a tab.
Sidebar tree with the Types section expanded under a PostgreSQL schema, and a tab showing the rebuilt CREATE TYPE statementSidebar tree with the Types section expanded under a PostgreSQL schema, and a tab showing the rebuilt CREATE TYPE statement

An enum open from the Types section

Engine support

A table’s own row type, the array type created beside every type, the multirange created beside every range, and any type an extension installed are left out. A type in another schema is listed under that schema. On SQL Server the built-in types are left out too, so the section holds only what the database declares.

Reading a definition

The definition is rebuilt from the catalog rather than read back as typed: comments inside the original statement are gone, names are quoted, and a domain’s constraints appear in name order. The tab carries the same toolbar as a routine’s source, Copy, Export…, Open in Editor and Reload, and beside the statement sit the properties the catalog reports: a domain’s base type, a range’s subtype, the owner, and the comment. Hover a row in the sidebar for the same facts without opening it: an enum’s labels, a composite’s fields, a domain’s base type. On SQL Server nothing is stored to read back at all, because a type has no sys.sql_modules row. A table type’s statement is rebuilt from its columns and indexes, keeping identity, defaults, computed columns, inline indexes and any collation that differs from the database’s; an alias type’s is rebuilt from its base type and nullability. A CLR type names the assembly it came from, since its body is compiled .NET rather than T-SQL. A SQL Server table type is a table-valued parameter and cannot declare a column, so it is left out of the column type picker. Alias types appear there.

Changing or creating a type

The tab is read-only. Open in Editor puts the definition in a query tab; write the ALTER TYPE or CREATE TYPE there and run it, then choose Refresh on the Types section. On PostgreSQL, ALTER TYPE … ADD VALUE adds an enum label and, from PostgreSQL 10, RENAME VALUE renames one. No statement removes a label or moves an existing one.

Using a type in a column

In a table’s Structure tab, the column type picker opens with a User-Defined group listing the types of every schema the sidebar’s schema filter keeps, and of the table’s own schema, ahead of the engine’s. Every entry is schema-qualified and quoted where the name needs it, sales.status or app."Order Status", so the column definition names the type and never a built-in of the same name. See Table Structure.

Finding a type

The sidebar filter matches a type by name. File > Open Quickly… (Cmd+Shift+O) indexes types alongside tables, routines and triggers, and choosing one opens its definition.

When the definition is missing