Add infrastructure for pg_get_*_ddl functions
Andrew Dunstan <andrew@dunslane.net>
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.joshi@enterprisedb.com> Co-authored-by: Andrew Dunstan <andrew@dunslane.net> Co-authored-by: Euler Taveira <euler@eulerto.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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/ddlutils.c | added | +275 −0 |
| src/backend/utils/adt/Makefile | modified | +1 −0 |
| src/backend/utils/adt/meson.build | modified | +1 −0 |
| src/tools/pgindent/typedefs.list | modified | +3 −1 |
Discussion
- pg_get__*_ddl consolidation 36 messages · 2026-03-19 → 2026-06-28
- [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement 36 messages · 2025-10-29 → 2025-11-26
- [PATCH] Add pg_get_role_ddl() functions for role recreation 16 messages · 2025-10-24 → 2026-01-20
- [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement 49 messages · 2025-11-12 → 2026-03-11