From af5851d73197a582aa1199961f17dc5a8ba7581a Mon Sep 17 00:00:00 2001
From: Mark Wong <markwkm@gmail.com>
Date: Tue, 9 Dec 2025 11:51:39 -0800
Subject: [PATCH v6 6/6] Handle pg_get_triggerdef default args in
 system_functions.sql

Modernize pg_get_triggerdef to use proargdefaults to handle the optional
pretty argument.
---
 src/backend/utils/adt/ruleutils.c | 14 --------------
 src/include/catalog/pg_proc.dat   |  6 ++----
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 707f83d4310..249f4518f62 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -818,20 +818,6 @@ pg_get_viewdef_worker(Oid viewoid, int prettyFlags, int wrapColumn)
  */
 Datum
 pg_get_triggerdef(PG_FUNCTION_ARGS)
-{
-	Oid			trigid = PG_GETARG_OID(0);
-	char	   *res;
-
-	res = pg_get_triggerdef_worker(trigid, false);
-
-	if (res == NULL)
-		PG_RETURN_NULL();
-
-	PG_RETURN_TEXT_P(string_to_text(res));
-}
-
-Datum
-pg_get_triggerdef_ext(PG_FUNCTION_ARGS)
 {
 	Oid			trigid = PG_GETARG_OID(0);
 	bool		pretty = PG_GETARG_BOOL(1);
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 56d82af5c91..1d304d1e316 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -4003,9 +4003,6 @@
   proname => 'pg_get_partition_constraintdef', provolatile => 's',
   prorettype => 'text', proargtypes => 'oid',
   prosrc => 'pg_get_partition_constraintdef' },
-{ oid => '1662', descr => 'trigger description',
-  proname => 'pg_get_triggerdef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid', prosrc => 'pg_get_triggerdef' },
 { oid => '1665', descr => 'name of sequence for a serial column',
   proname => 'pg_get_serial_sequence', provolatile => 's', prorettype => 'text',
   proargtypes => 'text text', prosrc => 'pg_get_serial_sequence' },
@@ -8675,7 +8672,8 @@
   prosrc => 'pg_timezone_names' },
 { oid => '2730', descr => 'trigger description with pretty-print option',
   proname => 'pg_get_triggerdef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid bool', prosrc => 'pg_get_triggerdef_ext' },
+  proargtypes => 'oid bool', proargnames => '{trigger,pretty}',
+  proargdefaults => '{false}', prosrc => 'pg_get_triggerdef' },
 
 # asynchronous notifications
 { oid => '3035',
-- 
2.47.3

