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

Álvaro Herrera <alvherre@kurilemu.de>

From: Álvaro Herrera <alvherre@kurilemu.de>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Manni Wood <manni.wood@enterprisedb.com>, Nishant Sharma <nishant.sharma@enterprisedb.com>, pgsql-hackers@postgresql.org
Date: 2025-11-04T19:26:48Z
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 →
  1. Add infrastructure for pg_get_*_ddl functions

  2. Add pg_get_tablespace_ddl() function

  3. Split out innards of pg_tablespace_location()

  4. Remove spclocation field from pg_tablespace

On 2025-Nov-04, Jim Jones wrote:

> That's the way I see it too. Of course it's always easier to use the
> tablespace's name, but there might be cases where you only have the oid
> -- in which case you'd need to do a JOIN with pg_tablespace to find the
> name. It's just for convenience.

The other DDL-producing patches that are being posted, all depend on a
reg* type for their argument, which means they will work correctly with
either an OID or an object name.  Tablespaces are one of the few object
types for which no "regtablespace" exists, so I think it's fair to
require both forms.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
[…] indem ich in meinem Leben oft an euch gedacht, euch glücklich zu machen. Seyd es!
A menudo he pensado en vosotros, en haceros felices. ¡Sedlo, pues!
		Heiligenstädter Testament, L. v. Beethoven, 1802
		https://de.wikisource.org/wiki/Heiligenstädter_Testament