generating function default settings from pg_proc.dat

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: generating function default settings from pg_proc.dat
Date: 2026-02-16 17:31:37
Message-ID: 183292bb-4891-4c96-a3ca-e78b5e0e1358@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Motivated by Bug 19409 [1] I decided to do something about a wart that
has bugged me for a while, namely the requirement to write stuff in
system_views.sql if you need to specify default values for function
arguments. Here's my attempt. The first patch here sets up the required
infrastructure. genbki.pl creates a file called function_defaults.sql
which is run by initdb at the appropriate time. There are two new fields
in pg_proc.dat entries: proargdflts,and provariadicdflt. These are
parsed and the appropriate CREATE OR REPLACE statement is generated and
placed in function_defaults.sql. The second patch applies this treatment
to 37 function definitions and removes the corresponding statements from
system_views.sql. This gets us closer to having pg_proc.dat as a single
source of truth.

cheers

andrew

[1]
https://www.postgresql.org/message-id/19409-e16cd2605e59a4af%40postgresql.org

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachment Content-Type Size
0001-Add-infrastructure-for-proargdflts-in-pg_proc.dat.patch text/x-patch 11.9 KB
0002-Move-function-defaults-from-system_functions.sql-to-.patch text/x-patch 25.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-02-16 17:32:18 Re: Better shared data structure management and resizable shared data structures
Previous Message Tom Lane 2026-02-16 17:24:09 Re: AIX support