You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create and edit PostgreSQL enums, domains and composite types #3606
The Types section lists a schema's enums, composites, domains and ranges and shows each one's CREATE statement, but the tab is read-only (features/user-defined-types.mdx:33-35). Adding an enum label, changing a domain's constraint or adding a field to a composite type means opening the definition in the editor, writing the ALTER TYPE or ALTER DOMAIN by hand, running it, and refreshing the section. #2484 shipped the section and the column type picker; editing an enum's labels, which it also asked for, did not ship.
Proposed solution
Enum: add a label at a chosen position (ALTER TYPE ... ADD VALUE ... BEFORE or AFTER) and rename one (RENAME VALUE, PostgreSQL 10 and later). Removing or moving a label stays impossible, so the editor says why rather than offering it.
Domain: set or drop the default, set or drop NOT NULL, add, drop and validate a CHECK constraint (ALTER DOMAIN).
Composite: add, drop and rename a field, and change a field's type (ALTER TYPE ... ADD, DROP, RENAME and ALTER ATTRIBUTE).
New Type… on the Types section for an enum, domain or composite, and Rename, Drop (with Cascade) and Comment on any type.
Changes queue in the type's tab with Preview SQL and Save Changes, the same way the Structure tab works (features/table-structure.mdx:213-222), and go through Safe Mode.
An error from the server, such as a domain constraint that existing rows violate, is shown on the change that caused it.
Done when: each change above round-trips on PostgreSQL 13 to 18, and the Types section and the column type picker show the result without a manual refresh.
Alternatives considered
Open in Editor, write the ALTER TYPE or ALTER DOMAIN by hand, run it, then Refresh the Types section.
Activity