[PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement

From: Manni Wood <manni(dot)wood(at)enterprisedb(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement
Date: 2025-10-29 01:23:50
Message-ID: CAKWEB6rmnmGKUA87Zmq-s=b3Scsnj02C0kObQjnbL2ajfPWGEw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-Adds-pg_get_tablespace_ddl-function.patch text/x-patch 12.9 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2025-10-29 01:31:12 Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Previous Message Michael Paquier 2025-10-29 01:16:40 Re: Bug in pg_stat_statements