Get database DDL
get_database_ddlRetrieve the CREATE DATABASE DDL for a specified database using PostgreSQL 19's pg_get_databasedef function. Returns whether the database exists and its DDL.
Instructions
Return the CREATE DATABASE DDL for a named database using PG 19's pg_get_databasedef(oid) function. Returns found=false with an empty ddl when the database doesn't exist. Requires PG 19+. Returns an object with object_type ('database'), object_name, found, and ddl.
Example: get_database_ddl(database_name='analytics')
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. | |
| database_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ddl | Yes | ||
| found | Yes | ||
| object_name | Yes | ||
| object_type | Yes |