Re: pg_get__*_ddl consolidation

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, "Zsolt Parragi" <zsolt(dot)parragi(at)percona(dot)com>, "Japin Li" <japinli(at)hotmail(dot)com>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_get__*_ddl consolidation
Date: 2026-03-24 15:43:00
Message-ID: 8ec9b67d-939e-4b22-8d56-a5129f92d32d@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 20, 2026, at 10:31 AM, Andrew Dunstan wrote:
>
> Oh, hmm, yes, I think we did. Will work on it.
>

Here is a new patchset (v2) including all suggested changes in this thread. It
fixes:

* DDLOptType: comma in the last element;
* union for boolval, textval, intval;
* va_list in a restricted scope;
* foreach_ptr + boolean in patches 0002 and 0004;
* list_nth instead of list_nth_cell in patches 0002 and 0004;
* OWNER = role typo. Add test;
* use pstrdup for dbname;
* output only database-specific GUCs;
* add ACL_CONNECT check as the original patch. I removed the pg_read_all_stats
case because it doesn't match the role description;

However, I didn't include the suggestion to explain that pg_get_role_ddl is
dependent on the DateStyle. I think it fits better in the CREATE ROLE [1] that
does not mention it in the VALID UNTIL clause. I'm not opposed to the idea of
adding a sentence to the function description but my suggestion is that this
new sentence points to CREATE ROLE page.

[1] https://www.postgresql.org/docs/current/sql-createrole.html

--
Euler Taveira
EDB https://www.enterprisedb.com/

Attachment Content-Type Size
v2-0001-Add-DDL-option-parsing-infrastructure-for-pg_get_.patch text/x-patch 8.5 KB
v2-0002-Add-pg_get_role_ddl-function.patch text/x-patch 22.0 KB
v2-0003-Add-pg_get_tablespace_ddl-function.patch text/x-patch 18.0 KB
v2-0004-Add-pg_get_database_ddl-function.patch text/x-patch 22.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jianghua Yang 2026-03-24 15:44:29 [PATCH] Fix wrong argument to SOFT_ERROR_OCCURRED in timestamptz_date
Previous Message Jim Jones 2026-03-24 15:35:39 VACUUM FULL, CLUSTER, and REPACK block on other sessions' temp tables