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

From: Manni Wood <manni(dot)wood(at)enterprisedb(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: Nishant Sharma <nishant(dot)sharma(at)enterprisedb(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement
Date: 2025-11-07 22:38:32
Message-ID: CAKWEB6psuA9S5oWwLsDLWgnCjGwQxNfUTqNkXPY81G3nm5-EAQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 7, 2025 at 10:16 AM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:

>
>
> On 07/11/2025 02:27, Manni Wood wrote:
> > Attached v7 fixes problems in tests due to whitespace.
>
>
> Since get_tablespace_loc_string returns a palloc'd string, I guess you
> could pfree it after the if block. The same applies for spcowner, since
> you're calling GetUserNameFromId() with noerr = false.
>
> For reference, see pg_get_indexdef_worker():
>
> ...
> /*
> * If it has options, append "WITH (options)"
> */
> str = flatten_reloptions(indexrelid);
> if (str)
> {
> appendStringInfo(&buf, " WITH (%s)", str);
> pfree(str);
> }
> ...
>
>
> Thanks
>
> Best, Jim
>

Hello, Álvaro and Jim!

I have incorporated both of your suggestions into this pair of v8 patches.

Let me know what you think.
--
-- Manni Wood EDB: https://www.enterprisedb.com

Attachment Content-Type Size
v8-0002-Adds-pg_get_tablespace_ddl-function.patch text/x-patch 14.5 KB
v8-0001-Supporting-changes-for-pg_get_tablespace_ddl-func.patch text/x-patch 9.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-11-07 22:49:46 Re: Missing calls to UnlockBuffers() - unify error handling?
Previous Message Corey Huinker 2025-11-07 22:28:50 Re: Extended Statistics set/restore/clear functions.