Re: [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement
Nishant Sharma <nishant.sharma@enterprisedb.com>
From: Nishant Sharma <nishant.sharma@enterprisedb.com>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Manni Wood <manni.wood@enterprisedb.com>, pgsql-hackers@postgresql.org
Date: 2025-11-04T10:37:14Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add infrastructure for pg_get_*_ddl functions
- 4881981f9202 19 (unreleased) landed
-
Add pg_get_tablespace_ddl() function
- b99fd9fd7f36 19 (unreleased) landed
-
Split out innards of pg_tablespace_location()
- 877a024902a7 19 (unreleased) landed
-
Remove spclocation field from pg_tablespace
- 16d8e594acd9 9.2.0 cited
Attachments
- v3-0001-Adds-pg_get_tablespace_ddl-function.patch (application/octet-stream) patch v3-0001
On Tue, Nov 4, 2025 at 1:58 PM Jim Jones <jim.jones@uni-muenster.de> wrote:
>
> Do you think that an overload in pg_proc.dat with oid as parameter would
> make sense here? e.g.
>
> { oid => '2322',
> descr => 'total disk space usage for the specified tablespace',
> proname => 'pg_tablespace_size', provolatile => 'v', prorettype =>
> 'int8',
> proargtypes => 'oid', prosrc => 'pg_tablespace_size_oid' },
> { oid => '2323',
> descr => 'total disk space usage for the specified tablespace',
> proname => 'pg_tablespace_size', provolatile => 'v', prorettype =>
> 'int8',
> proargtypes => 'name', prosrc => 'pg_tablespace_size_name' },
>
> Using name as parameter is more user friendly than OID.
Because users usually do not know the oids. Constructing
the DDL from the name appears better as it contains a name
in it. So, no gain in having an OID version of
pg_get_tablespace_ddl.
PFA, v3 patch set. It has some cosmetic changes and few
improvements in the new code added by Manni in v2. Also, the
new test case added did not have a DROP statement for the
tablespace created, which caused make-world failure. So, I
corrected that too.
Regards,
Nishant Sharma.
EDB, Pune.