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/cassandra.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Both verifying modes need a **CA Certificate** path, and refuse to connect witho

- A page far into a large table is slow, because every row before it is read first. Filter the table down, or query it in the CQL editor with a `WHERE` on the partition key.
- Counter columns cannot be set with a plain `UPDATE`. The grid will edit one and the server rejects the statement it generates. Use `UPDATE … SET c = c + 1` in the CQL editor.
- Materialized views and UDTs do not appear in the sidebar. Query `system_schema` in the CQL editor to see them. UDFs and UDAs are listed under Functions; see [Procedures, functions, and triggers](/features/routines-triggers).
- Materialized views do not appear in the sidebar. Query `system_schema.views` in the CQL editor to see them. UDFs and UDAs are listed under Functions; see [Procedures, functions, and triggers](/features/routines-triggers). User-defined types are listed under Types; see [User-Defined Types](/features/user-defined-types).
- The DDL tab reconstructs `CREATE TABLE` from the column list, so table options (compaction, compression, `gc_grace_seconds`), clustering order, and the split between partition and clustering key are all missing from it. Read the real definition with `DESCRIBE TABLE` in `cqlsh`.
- DataStax Astra DB does not connect. The Secure Connect Bundle it requires cannot be loaded, and there is no way around it.
- The connect timeout comes from the connection's **Options** section. The CQL request timeout
Expand Down
2 changes: 1 addition & 1 deletion developers/mcp-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ The two `switch_` tools move what the user sees in TablePro. To run one statemen

`get_database_statistics` leaves out a field the engine does not report. On PostgreSQL, `table_count` comes back only when `database` names the database the connection is browsing, and `size_bytes` only for a database the role has `CONNECT` on.

`list_routines` takes `kind` as `procedure` or `function`, omitted for both, and its `signature` is the argument list, not the return type. `list_triggers` takes `table` to scope to one table, omitted for every trigger in the schema. `list_types` takes `kind` as `enum`, `composite`, `domain` or `range`, omitted for all four; `labels` is set for an enum, `fields` for a composite and `base_type` for a domain or range, and only PostgreSQL and PGlite answer with rows.
`list_routines` takes `kind` as `procedure` or `function`, omitted for both, and its `signature` is the argument list, not the return type. `list_triggers` takes `table` to scope to one table, omitted for every trigger in the schema. `list_types` takes `kind` as `enum`, `composite`, `domain`, `range`, `aliasType`, `tableType`, `clrType` or `udt`, omitted for every kind; `labels` is set for an enum, `fields` for a composite or a `udt`, and `base_type` for a domain or range. PostgreSQL and PGlite answer with the first four kinds, SQL Server with `aliasType`, `tableType` and `clrType`, Cassandra and ScyllaDB with `udt`, and every other engine with no rows.

### `search_schema`

Expand Down
13 changes: 11 additions & 2 deletions features/user-defined-types.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: User-Defined Types
description: Browse a schema's enums, composites, domains and ranges and read each definition
description: Browse the types a schema or keyspace declares, read each definition, and drop one
---

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.
Expand a schema, or a keyspace on Cassandra and ScyllaDB, and **Types** sits beside **Functions** and **Triggers**, one row per type it declares. Select a row and press Return, or double-click it, and the type's `CREATE` statement opens in a tab.

<Frame caption="An enum open from the Types section">
<img className="block dark:hidden" src="/images/user-defined-types-sidebar.png" alt="Sidebar tree with the Types section expanded under a PostgreSQL schema, and a tab showing the rebuilt CREATE TYPE statement" />
Expand All @@ -16,6 +16,7 @@ Expand a schema and **Types** sits beside **Functions** and **Triggers**, one ro
|---|---|
| PostgreSQL, PGlite | Enums, composites, domains, ranges |
| SQL Server | Alias types, table types, CLR types |
| Cassandra, ScyllaDB | User-defined types |
| Every other engine | None |

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.
Expand All @@ -30,14 +31,22 @@ On SQL Server nothing is stored to read back at all, because a type has no `sys.

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.

On Cassandra the statement is rebuilt from `system_schema.types`: the fields in declaration order, each with the type the server reports.

## 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.

## Dropping a type

Right-click a type and choose **Drop Type…**. The `DROP TYPE` statement (`DROP DOMAIN` for a PostgreSQL domain) is shown for confirmation before it runs, and the **Types** section refreshes once it has. The server refuses while a table, or another type, still uses the type, and its reason is shown. A read-only connection has no **Drop Type…**.

## 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](/features/connection-window#filtering-schemas) 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](/features/table-structure#columns-tab).

On Cassandra and ScyllaDB the group lists the types of the table's own keyspace, the only one a column can use, by name, quoted where the name needs it. An entry comes wrapped as `frozen<address>` where a plain column cannot hold the type: when a field is a collection that is not frozen, on Cassandra before 3.6, and on ScyllaDB.

## 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.
Expand Down
Loading