Re: pg_get__*_ddl consolidation

Jelte Fennema <postgres@jeltef.nl>

From: Jelte Fennema-Nio <postgres@jeltef.nl>
To: Euler Taveira <euler@eulerto.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, "David G. Johnston" <david.g.johnston@gmail.com>, japin <japinli@hotmail.com>, Zsolt Parragi <zsolt.parragi@percona.com>, Álvaro Herrera <alvherre@kurilemu.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-06T20:24:32Z
Lists: pgsql-hackers
On Mon, 6 Apr 2026 at 19:10, Euler Taveira <euler@eulerto.com> wrote:
> although we already use this style
> in some of the backend functions -- e.g. pg_logical_slot_*_changes()).

Thanks for the additional context. I didn't know about
pg_logical_slot_*_changes using this style. I searched the docs
locally and cannot find any other functions that use this style. I
think what makes pg_logical_slot_*_changes special, is that it passes
these options to the plugin. The plugin can define any valid options,
and postgres core cannot know what they are. I think this approach
makes sense for those functions because of that, but the ddl functions
don't pass the options to a plugin, so that argument does not apply
here.

> I also consider your approach but decided not to use it. The argument against
> named arguments is that you cannot add new argument *without* a DEFAULT value;
> if you do, all existing functions will fail.

I'm not sure what kind of change you're referring to here. I don't
understand how variadic options allow you to add a required argument
to an existing function without breaking existing callers. Could you
give a concrete example of a change that the VARIADIC allows, but the
named arguments don't?

> You also need to create another
> function with a different list of arguments to support a new option.

I don't understand this either. We often add new optional arguments to
existing functions in a new major release. e.g. pg_start_backup got
the exclusive argument in PG9.6. Or do you mean something else here?



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Use named boolean parameters for pg_get_*_ddl option arguments

  2. Convert ddlutils regression tests to TAP tests.

  3. Fix pfree crash in pg_get_role_ddl() and pg_get_database_ddl().

  4. Fixups for a4f774cf1c7

  5. Add infrastructure for pg_get_*_ddl functions

  6. Add pg_get_database_ddl() function

  7. Add pg_get_role_ddl() function

  8. Add pg_get_tablespace_ddl() function