Documentation

SQL Manage Sequences

SQL Manage Sequences

The Sequences activity manages number-generator objects on PostgreSQL, MariaDB, SQL Server, and Oracle (SQLite is intentionally unsupported and shows an empty state). Use it to create, edit, drop, and audit sequences with a dual form/script editor and a live CREATE SEQUENCE preview.

Quick Start

  1. Open the Sequences activity from the database context menu.
  2. Browse existing sequences; click a row to preview the DDL, or double-click to edit.
  3. Click New to open the editor. Set Name, Start With, and Increment By.
  4. Configure Min Value, Max Value, Cache, and Cycle as needed.
  5. Review the auto-generated preview and click Execute.

List Mode

The default view lists every sequence in the current database:

  • Search filters by name.
  • Refresh re-queries the server.
  • New switches to the editor (hidden on SQLite).
  • Rows expose Edit, Show DDL, and Drop on hover. Double-click opens the editor; right-click opens a context menu with the same actions.
  • Clicking a row expands it and lazily loads the sequence's full CREATE SEQUENCE definition.

Editor Mode

The editor toggles between Form and Script. Form mode surfaces every option the target dialect supports:

FieldMeaningDialects
NameSequence identifier (read-only when editing).All
Data TypeSMALLINT, INT, BIGINT, NUMERIC, etc.PostgreSQL, SQL Server
Start With / Restart WithInitial value on create; re-anchor point on edit.All
Increment ByStep between generated values (may be negative).All
Min ValueNO MINVALUE or explicit lower bound.All
Max ValueNO MAXVALUE or explicit upper bound.All
CacheNumber of values pre-allocated per session for performance.All
CycleWrap around after hitting max/min.All
OrderGuarantee ordered allocation across RAC nodes.Oracle
Owned ByBind the sequence's lifecycle to table.column.PostgreSQL

Live Preview

Every change updates the read-only preview at the bottom of the form. A typical PostgreSQL sequence:

CREATE SEQUENCE public.invoice_number_seq
    AS BIGINT
    START WITH 1000
    INCREMENT BY 1
    MINVALUE 1
    NO MAXVALUE
    CACHE 20
    NO CYCLE
    OWNED BY invoices.number;

Editing an existing sequence emits ALTER SEQUENCE statements:

ALTER SEQUENCE public.invoice_number_seq
    RESTART WITH 5000
    INCREMENT BY 1
    CACHE 50;

Script Mode

Paste a hand-written CREATE SEQUENCE or ALTER SEQUENCE statement, then hit Execute. Use script mode when the form does not cover a niche clause (e.g. schema-qualified owners or dialect-specific extensions).

Dropping a Sequence

Use the row's Drop action or right-click menu. VisuaLeaf confirms, then issues DROP SEQUENCE. On PostgreSQL, sequences bound via OWNED BY are dropped automatically when their owning column is dropped.

Dialect Notes

  • PostgreSQL — supports SERIAL/BIGSERIAL shortcuts and OWNED BY.
  • Oracle — offers ORDER (RAC-safe ordering) and supports NOCACHE.
  • SQL Server — sequences are first-class objects; combine with NEXT VALUE FOR in DEFAULT.
  • MariaDB — sequences are storage-engine objects; the editor emits the correct ENGINE=SEQUENCE clause.
  • SQLite — not supported; the activity shows an inline notice.

Ready to try VisuaLeaf?

Download and start managing your MongoDB databases with ease.

Download Free Trial