Get tablespace DDL
get_tablespace_ddlGenerates the CREATE TABLESPACE DDL for a named tablespace using PostgreSQL 19's internal function. Returns found flag and empty DDL if the tablespace is missing.
Instructions
Return the CREATE TABLESPACE DDL for a named tablespace using PG 19's pg_get_tablespacedef(oid) function. Returns found=false with an empty ddl when the tablespace doesn't exist. Requires PG 19+. Returns an object with object_type ('tablespace'), object_name, found, and ddl.
Example: get_tablespace_ddl(tablespace_name='fast_ssd')
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. | |
| tablespace_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ddl | Yes | ||
| found | Yes | ||
| object_name | Yes | ||
| object_type | Yes |