Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion databases/mariadb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mariadb://user:password@localhost/database?socket=%2Ftmp%2Fmysql.sock
- Virtual and persistent columns are detected on every version, including the bare `VIRTUAL` and `PERSISTENT` spelling that 10.1 and older report, and are left out of generated INSERT and UPDATE statements.
- A query timeout goes in as `SET SESSION max_statement_time`, counted in seconds. MySQL takes `max_execution_time` in milliseconds.
- 10.2.1 to 10.2.21 and 10.3.0 to 10.3.9 enforce check constraints without publishing an `information_schema.CHECK_CONSTRAINTS` to read them from. The [Constraints tab](/features/table-structure#constraints-tab) takes them out of `SHOW CREATE TABLE` on those releases and out of the catalog everywhere else.
- Sequences appear in the sidebar's Tables section as their own kind, read-only, with **Drop Sequence** on the menu. See [Sequences and system-versioned tables](/features/table-operations#sequences-and-system-versioned-tables).
- Sequences appear in the sidebar's **Sequences** section, read-only, with **Drop Sequence** on the menu. See [Sequences](/features/table-operations#sequences).
- A table declared `WITH SYSTEM VERSIONING` is listed as an ordinary table and loses **Truncate** alone, which the server refuses with error 4137.
- A temporary table shadowing a base table of the same name is left out of the listing, so the name appears once.

Expand Down
4 changes: 4 additions & 0 deletions databases/postgresql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ A value the list cannot represent opens the text editor instead: a multi-dimensi

`box[]` is the one column whose elements are not separated by a comma. PostgreSQL uses a semicolon there, because a box's own text contains commas, and the list reads it that way.

## Sequences

Each schema lists its sequences under **Sequences**, with the owning column on hover. **Set Next Value…** realigns a sequence with the highest value in its column, and **Edit Sequence…** changes its increment, bounds, cache and cycling. See [Sequences](/features/table-operations#sequences).

## User-defined types

Enums, composites, domains and ranges are listed under **Types** in each schema, the `CREATE` statement rebuilt from `pg_type`. The structure editor's type picker offers the schema's types under **User-Defined**. See [User-Defined Types](/features/user-defined-types).
Expand Down
19 changes: 17 additions & 2 deletions features/table-operations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,24 @@ Comments are edited per object. Right-click a table or view and choose **Edit Co

Engines installed as plugins need their latest plugin version.

## Sequences and system-versioned tables
## Sequences

A MariaDB sequence carries a number icon in the sidebar and reads as **Sequence**. It is a read-only kind, so its menu drops **Truncate** and **Import**, the drop item reads **Drop Sequence**, and the Structure tab offers no edit. MariaDB refuses `UPDATE`, `DELETE` and `TRUNCATE` on one with error 1031, and `ALTER TABLE … ADD COLUMN` with error 4086. Rename still works, through `RENAME TABLE`. Read the current value with `SELECT * FROM seq_name`, and change it with `SETVAL` in the query editor.
PostgreSQL and MariaDB sequences are listed under **Sequences** in each schema, with a number icon. Hover one to see the column that owns it, such as `orders.id` for a `serial` or identity column. The sidebar filter and Open Quickly find sequences by name.

Double-click a sequence to open it. On PostgreSQL the grid shows `last_value`, `log_cnt` and `is_called`, and the DDL tab of **Show Structure** holds the `CREATE SEQUENCE` statement with the data type, start, increment, minimum, maximum and cache, followed by `OWNED BY` and the `setval` that restores its position. On MariaDB the grid shows every setting.

A sequence is a read-only kind: its menu drops **Truncate** and **Import**, the Structure tab offers no edit, and the drop item reads **Drop Sequence**. **Rename** works on both engines.

On PostgreSQL, right-click a sequence for two more commands, also under **Database > Set Next Value…** and **Database > Edit Sequence…**:

- **Set Next Value…** sets what the next `nextval` returns. For a sequence a column owns, **After the values already in** moves it one step past that column's highest value, or its lowest for a descending sequence, which repairs a sequence that fell behind its table after a bulk load or a restore. It never moves a sequence back, and it holds inserts into the table until it is done. To move a sequence back, type the value.
- **Edit Sequence…** shows the data type, start, next value and owner, and changes the increment, minimum, maximum, cache and cycling through `ALTER SEQUENCE`.

Both sheets show the SQL before it runs and go through [Safe Mode](/features/safe-mode). **New Sequence…** under the **+** button at the foot of the sidebar, or **Database > New Sequence…**, opens a `CREATE SEQUENCE` template in a query tab.

MariaDB refuses `UPDATE`, `DELETE` and `TRUNCATE` on a sequence with error 1031, and `ALTER TABLE … ADD COLUMN` with error 4086. Rename goes through `RENAME TABLE`. Change a MariaDB sequence's value with `SETVAL` in the query editor.

## System-versioned tables

A MariaDB table declared `WITH SYSTEM VERSIONING` stays an ordinary table: row editing, **Import**, index edits, comments, rename and drop all work. **Truncate** alone is withheld, because the server refuses it with error 4137. Delete the history with `DELETE HISTORY FROM table_name` instead. On iPhone and iPad the listing reports such a table as a plain one, so **Truncate** is offered there and the server's refusal comes back as an alert.

Expand Down
Loading