pgsql: Add infrastructure for pg_get_*_ddl functions

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add infrastructure for pg_get_*_ddl functions
Date: 2026-04-05 15:02:21
Message-ID: E1w9OzU-0035r4-1E@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add infrastructure for pg_get_*_ddl functions

Add parse_ddl_options(), append_ddl_option(), and append_guc_value()
helper functions in a new ddlutils.c file that provide common option
parsing and output formatting for the pg_get_*_ddl family of functions
which will follow in later patches. These accept VARIADIC text
arguments as alternating name/value pairs.

Callers declare an array of DdlOption descriptors specifying the
accepted option names and their types (boolean, text, or integer).
parse_ddl_options() matches each supplied pair against the array,
validates the value, and fills in the result fields. This
descriptor-based scheme is based on an idea from Euler Taveira.

This is placed in a new ddlutils.c file which will contain the
pg_get_*_ddl functions.

Author: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
Co-authored-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Co-authored-by: Euler Taveira <euler(at)eulerto(dot)com>
Discussion: https://postgr.es/m/CAKWEB6rmnmGKUA87Zmq-s=b3Scsnj02C0kObQjnbL2ajfPWGEw@mail.gmail.com
Discussion: https://postgr.es/m/4c5f895e-3281-48f8-b943-9228b7da6471@gmail.com
Discussion: https://postgr.es/m/CANxoLDc6FHBYJvcgOnZyS+jF0NUo3Lq_83-rttBuJgs9id_UDg@mail.gmail.com
Discussion: https://postgr.es/m/e247c261-e3fb-4810-81e0-a65893170e94@dunslane.net

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4881981f92024e4db6249bd3dc96a3859638a665

Modified Files
--------------
src/backend/utils/adt/Makefile | 1 +
src/backend/utils/adt/ddlutils.c | 275 ++++++++++++++++++++++++++++++++++++++
src/backend/utils/adt/meson.build | 1 +
src/tools/pgindent/typedefs.list | 4 +-
4 files changed, 280 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-04-05 18:11:33 pgsql: Check that the tranche name is unique in RequestNamedLWLockTranc
Previous Message Álvaro Herrera 2026-04-05 11:34:38 pgsql: Allow index_create to suppress index_build progress reporting