Re: pg_get__*_ddl consolidation
Jelte Fennema <postgres@jeltef.nl>
From: "Jelte Fennema-Nio" <postgres@jeltef.nl>
To: "Andrew Dunstan" <andrew@dunslane.net>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, "Japin Li" <japinli@hotmail.com>, "Zsolt Parragi" <zsolt.parragi@percona.com>, "Euler Taveira" <euler@eulerto.com>, Álvaro Herrera <alvherre@kurilemu.de>, "PostgreSQL Hackers" <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-06T15:24:06Z
Lists: pgsql-hackers
Attachments
- v5-0001-Use-named-arguments-for-pg_get_-_ddl-functions.patch (text/x-patch) patch v5-0001
On Mon, 6 Apr 2026 at 13:55, Andrew Dunstan <andrew@dunslane.net> wrote: > There was quite a deal of discussion around this mechanism. See Euler's > review at [1] and follow-up at [2] for the original discussion of the > VARIADIC option-parsing design and the use cases it was meant to > address. I'm prepared to revisit it is there's a strong consensus on the > point. Thanks for those links. I had not seen that part of the discussion. But I only see an explanation of why these functions are configurable with optional key+value pairs in their arguments. I think that makes sense, and I totally agree that we should do that. The thing I'm questioning is whether we need a new way of providing key+value pairs as optional arguments to functions. IMO we already had a perfectly fine one. Introducing another adds complexity (both to the code and to the user) and I don't see any compelling reason to do so. Attached is a patch with roughly what I have in mind instead. By doing this we can also make the functinos STRICT, so that we don't have to worry about handling NULL values for the first argument. Afaict this named parameter approach only has benefits over the VARIADIC argument one. But if I'm wrong about that, please let me know.
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Use named boolean parameters for pg_get_*_ddl option arguments
- d6ed87d19890 19 (unreleased) landed
-
Convert ddlutils regression tests to TAP tests.
- c529ee38b9eb 19 (unreleased) landed
-
Fix pfree crash in pg_get_role_ddl() and pg_get_database_ddl().
- 1f108fc02ece 19 (unreleased) landed
-
Fixups for a4f774cf1c7
- 6c7bce28c83f 19 (unreleased) landed
-
Add infrastructure for pg_get_*_ddl functions
- 4881981f9202 19 (unreleased) landed
-
Add pg_get_database_ddl() function
- a4f774cf1c7e 19 (unreleased) landed
-
Add pg_get_role_ddl() function
- 76e514ebb4b5 19 (unreleased) landed
-
Add pg_get_tablespace_ddl() function
- b99fd9fd7f36 19 (unreleased) landed