[PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement
Manni Wood <manni.wood@enterprisedb.com>
From: Manni Wood <manni.wood@enterprisedb.com>
To: pgsql-hackers@postgresql.org
Date: 2025-10-29T01:23:50Z
Lists: pgsql-hackers
Attachments
- v1-0001-Adds-pg_get_tablespace_ddl-function.patch (text/x-patch)
Hello!
I am submitting a patch as a part of a larger Retail DDL functions project
described by Andrew Dunstan here:
https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9%40dunslane.net
This patch creates a function pg_get_tablespace_ddl, designed to retrieve
the full DDL statement for a tablespace. Users can obtain the DDL by
providing the tablespace name, like so:
SELECT pg_get_tablespace_ddl('regress_owner_tblsp');
pg_get_tablespace_ddl
---------------------------------------------------------------------------------------------------
CREATE TABLESPACE regress_owner_tblsp OWNER regress_user LOCATION ''
WITH (random_page_cost = 3);
This patch includes documentation, comments, and regression tests, all of
which pass successfully.
--
Best,
Manni Wood
EnterpriseDB