updates for handling optional argument in system functions

From: Mark Wong <markwkm(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: updates for handling optional argument in system functions
Date: 2025-12-09 23:28:59
Message-ID: aTiwu9o8vBkLreAL@ltdrgnflg2
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi everyone,

I noticed how it was preferred to define optional arguments with the
system functions in system_functions.sql instead of defining them in
pg_proc.dat.

I took a gross stab at updating the ones that ended in _ext, which
turned out to be 7 declarations across 6 system functions, and created a
patch per system function, hoping it would be easier to review.

Perhaps the most interesting thing to share is the total reduction of
the lines of code, although system_functions.sql only grows:

src/backend/catalog/system_functions.sql | 49 ++++++++
src/backend/utils/adt/ruleutils.c | 130 ----------------------
src/include/catalog/pg_proc.dat | 36 ++----
3 files changed, 56 insertions(+), 159 deletions(-)

Is that something we want?

Regards,
Mark
--
Mark Wong <markwkm(at)gmail(dot)com>
EDB https://enterprisedb.com

Attachment Content-Type Size
v1-0001-Handle-pg_get_ruledef-default-args-in-system_func.patch text/plain 3.1 KB
v1-0002-Handle-pg_get_viewdef-default-args-in-system_func.patch text/plain 4.5 KB
v1-0003-Handle-pg_get_indexdef-default-args-in-system_fun.patch text/plain 3.3 KB
v1-0004-Handle-pg_get_constraintdef-default-args-in-syste.patch text/plain 3.2 KB
v1-0005-Handle-pg_get_expr-default-args-in-system_functio.patch text/plain 3.2 KB
v1-0006-Handle-pg_get_triggerdef-default-args-in-system_f.patch text/plain 3.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2025-12-09 23:30:47 Re: Add a greedy join search algorithm to handle large join problems
Previous Message Masahiko Sawada 2025-12-09 23:24:51 Re: Assertion failure in SnapBuildInitialSnapshot()