agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use named boolean parameters for pg_get_*_ddl option arguments
Date: Sun, 28 Jun 2026 15:00:41 +0000
Message-ID: <E1wdqzy-000XNO-05@gemulon.postgresql.org> (raw)

Use named boolean parameters for pg_get_*_ddl option arguments

Replace the VARIADIC text[] alternating key/value option interface with
typed named boolean parameters for pg_get_role_ddl(), pg_get_tablespace_ddl(),
and pg_get_database_ddl(), as added by commit 4881981f920 and friends.
The new signatures are:

  pg_get_role_ddl(role regrole,
                  pretty boolean DEFAULT false,
                  memberships boolean DEFAULT true)

  pg_get_tablespace_ddl(tablespace oid/name,
                        pretty boolean DEFAULT false,
                        owner boolean DEFAULT true)

  pg_get_database_ddl(db regdatabase,
                      pretty boolean DEFAULT false,
                      owner boolean DEFAULT true,
                      tablespace boolean DEFAULT true)

This provides type safety at the SQL level, allows named-argument calling
syntax (pretty => true), removes the runtime string-parsing machinery
(DdlOption, parse_ddl_options) in favour of direct PG_GETARG_BOOL() calls,
and allows the functions to be marked STRICT.

While we're here, I added an extra TAP test for pg_get_database(owner =>
false, ...)

Catalog version bumped.

Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://postgr.es/m/DHM6C7SLS4BN.1WW9Z4PRPN0VJ@jeltef.nl
(and on Discord)

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d6ed87d19890b1cfa93d1f6e8957fa525834c0e2

Modified Files
--------------
doc/src/sgml/func/func-info.sgml             |  54 +++---
src/backend/utils/adt/ddlutils.c             | 260 +++------------------------
src/include/catalog/catversion.h             |   2 +-
src/include/catalog/pg_proc.dat              |  41 +++--
src/test/modules/test_misc/t/012_ddlutils.pl |  28 +--
5 files changed, 95 insertions(+), 290 deletions(-)



Message-ID: <E1wdqzy-000XNO-05@gemulon.postgresql.org>
Permalink:  ../E1wdqzy-000XNO-05@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wdqzy-000XNO-05@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Use named boolean parameters for pg_get_*_ddl option arguments
  In-Reply-To: <E1wdqzy-000XNO-05@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox