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 <[email protected]>
EDB https://enterprisedb.com
>From 90229923b475af0169be5cea8819e71425b6a332 Mon Sep 17 00:00:00 2001
From: Mark Wong <[email protected]>
Date: Mon, 8 Dec 2025 15:41:07 -0800
Subject: [PATCH v1 1/6] Handle pg_get_ruledef default args in
 system_functions.sql

Modernize pg_get_ruledef to use CREATE OR REPLACE FUNCTION to handle the
optional pretty argument.
---
 src/backend/catalog/system_functions.sql |  7 +++++++
 src/backend/utils/adt/ruleutils.c        | 18 ------------------
 src/include/catalog/pg_proc.dat          |  5 +----
 3 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/src/backend/catalog/system_functions.sql 
b/src/backend/catalog/system_functions.sql
index 2d946d6d9e9..febed53c9fa 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -657,6 +657,13 @@ LANGUAGE INTERNAL
 STRICT VOLATILE PARALLEL UNSAFE
 AS 'pg_replication_origin_session_setup';
 
+CREATE OR REPLACE FUNCTION
+  pg_get_ruledef(rule oid, pretty bool DEFAULT false)
+RETURNS TEXT
+LANGUAGE INTERNAL
+PARALLEL SAFE
+AS 'pg_get_ruledef';
+
 --
 -- The default permissions for functions mean that anyone can execute them.
 -- A number of functions shouldn't be executable by just anyone, but rather
diff --git a/src/backend/utils/adt/ruleutils.c 
b/src/backend/utils/adt/ruleutils.c
index 556ab057e5a..de063d63b4f 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -558,24 +558,6 @@ static void get_json_table_nested_columns(TableFunc *tf, 
JsonTablePlan *plan,
  */
 Datum
 pg_get_ruledef(PG_FUNCTION_ARGS)
-{
-       Oid                     ruleoid = PG_GETARG_OID(0);
-       int                     prettyFlags;
-       char       *res;
-
-       prettyFlags = PRETTYFLAG_INDENT;
-
-       res = pg_get_ruledef_worker(ruleoid, prettyFlags);
-
-       if (res == NULL)
-               PG_RETURN_NULL();
-
-       PG_RETURN_TEXT_P(string_to_text(res));
-}
-
-
-Datum
-pg_get_ruledef_ext(PG_FUNCTION_ARGS)
 {
        Oid                     ruleoid = 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 5cf9e12fcb9..c215d47f2d8 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3952,9 +3952,6 @@
   proargtypes => 'oid oid', prosrc => 'oidge' },
 
 # System-view support functions
-{ oid => '1573', descr => 'source text of a rule',
-  proname => 'pg_get_ruledef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid', prosrc => 'pg_get_ruledef' },
 { oid => '1640', descr => 'select statement of a view',
   proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
   prorettype => 'text', proargtypes => 'text',
@@ -8492,7 +8489,7 @@
 # System-view support functions with pretty-print option
 { oid => '2504', descr => 'source text of a rule with pretty-print option',
   proname => 'pg_get_ruledef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid bool', prosrc => 'pg_get_ruledef_ext' },
+  proargtypes => 'oid bool', prosrc => 'pg_get_ruledef' },
 { oid => '2505',
   descr => 'select statement of a view with pretty-print option',
   proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
-- 
2.51.2

>From f27d37a1689f2060c50d59ce1043e2710433c5c8 Mon Sep 17 00:00:00 2001
From: Mark Wong <[email protected]>
Date: Tue, 9 Dec 2025 09:33:21 -0800
Subject: [PATCH v1 2/6] Handle pg_get_viewdef default args in
 system_functions.sql

Modernize pg_get_viewdef to use CREATE OR REPLACE FUNCTION to handle the
optional pretty argument for both versions that use OID or view name.
---
 src/backend/catalog/system_functions.sql | 14 ++++++++
 src/backend/utils/adt/ruleutils.c        | 44 ------------------------
 src/include/catalog/pg_proc.dat          | 11 ++----
 3 files changed, 16 insertions(+), 53 deletions(-)

diff --git a/src/backend/catalog/system_functions.sql 
b/src/backend/catalog/system_functions.sql
index febed53c9fa..c7adfad0e05 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -664,6 +664,20 @@ LANGUAGE INTERNAL
 PARALLEL SAFE
 AS 'pg_get_ruledef';
 
+CREATE OR REPLACE FUNCTION
+  pg_get_viewdef(view text, pretty bool DEFAULT false)
+RETURNS TEXT
+LANGUAGE INTERNAL
+PARALLEL RESTRICTED
+AS 'pg_get_viewdef_name';
+
+CREATE OR REPLACE FUNCTION
+  pg_get_viewdef(view oid, pretty bool DEFAULT false)
+RETURNS TEXT
+LANGUAGE INTERNAL
+PARALLEL RESTRICTED
+AS 'pg_get_viewdef';
+
 --
 -- The default permissions for functions mean that anyone can execute them.
 -- A number of functions shouldn't be executable by just anyone, but rather
diff --git a/src/backend/utils/adt/ruleutils.c 
b/src/backend/utils/adt/ruleutils.c
index de063d63b4f..7d576834d5c 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -658,25 +658,6 @@ pg_get_ruledef_worker(Oid ruleoid, int prettyFlags)
  */
 Datum
 pg_get_viewdef(PG_FUNCTION_ARGS)
-{
-       /* By OID */
-       Oid                     viewoid = PG_GETARG_OID(0);
-       int                     prettyFlags;
-       char       *res;
-
-       prettyFlags = PRETTYFLAG_INDENT;
-
-       res = pg_get_viewdef_worker(viewoid, prettyFlags, WRAP_COLUMN_DEFAULT);
-
-       if (res == NULL)
-               PG_RETURN_NULL();
-
-       PG_RETURN_TEXT_P(string_to_text(res));
-}
-
-
-Datum
-pg_get_viewdef_ext(PG_FUNCTION_ARGS)
 {
        /* By OID */
        Oid                     viewoid = PG_GETARG_OID(0);
@@ -716,31 +697,6 @@ pg_get_viewdef_wrap(PG_FUNCTION_ARGS)
 
 Datum
 pg_get_viewdef_name(PG_FUNCTION_ARGS)
-{
-       /* By qualified name */
-       text       *viewname = PG_GETARG_TEXT_PP(0);
-       int                     prettyFlags;
-       RangeVar   *viewrel;
-       Oid                     viewoid;
-       char       *res;
-
-       prettyFlags = PRETTYFLAG_INDENT;
-
-       /* Look up view name.  Can't lock it - we might not have privileges. */
-       viewrel = makeRangeVarFromNameList(textToQualifiedNameList(viewname));
-       viewoid = RangeVarGetRelid(viewrel, NoLock, false);
-
-       res = pg_get_viewdef_worker(viewoid, prettyFlags, WRAP_COLUMN_DEFAULT);
-
-       if (res == NULL)
-               PG_RETURN_NULL();
-
-       PG_RETURN_TEXT_P(string_to_text(res));
-}
-
-
-Datum
-pg_get_viewdef_name_ext(PG_FUNCTION_ARGS)
 {
        /* By qualified name */
        text       *viewname = PG_GETARG_TEXT_PP(0);
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index c215d47f2d8..2d1aa50dac6 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3952,13 +3952,6 @@
   proargtypes => 'oid oid', prosrc => 'oidge' },
 
 # System-view support functions
-{ oid => '1640', descr => 'select statement of a view',
-  proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
-  prorettype => 'text', proargtypes => 'text',
-  prosrc => 'pg_get_viewdef_name' },
-{ oid => '1641', descr => 'select statement of a view',
-  proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
-  prorettype => 'text', proargtypes => 'oid', prosrc => 'pg_get_viewdef' },
 { oid => '1642', descr => 'role name by OID (with fallback)',
   proname => 'pg_get_userbyid', provolatile => 's', prorettype => 'name',
   proargtypes => 'oid', prosrc => 'pg_get_userbyid' },
@@ -8494,12 +8487,12 @@
   descr => 'select statement of a view with pretty-print option',
   proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
   prorettype => 'text', proargtypes => 'text bool',
-  prosrc => 'pg_get_viewdef_name_ext' },
+  prosrc => 'pg_get_viewdef_name' },
 { oid => '2506',
   descr => 'select statement of a view with pretty-print option',
   proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
   prorettype => 'text', proargtypes => 'oid bool',
-  prosrc => 'pg_get_viewdef_ext' },
+  prosrc => 'pg_get_viewdef' },
 { oid => '3159',
   descr => 'select statement of a view with pretty-printing and specified line 
wrapping',
   proname => 'pg_get_viewdef', provolatile => 's', proparallel => 'r',
-- 
2.51.2

>From 9c5f218eaa85c05e173919582d431f166c9c9bdb Mon Sep 17 00:00:00 2001
From: Mark Wong <[email protected]>
Date: Tue, 9 Dec 2025 10:02:15 -0800
Subject: [PATCH v1 3/6] Handle pg_get_indexdef default args in
 system_functions.sql

Modernize pg_get_indexdef to use CREATE OR REPLACE FUNCTION to handle
the optional column and pretty argument.
---
 src/backend/catalog/system_functions.sql |  7 +++++++
 src/backend/utils/adt/ruleutils.c        | 20 --------------------
 src/include/catalog/pg_proc.dat          |  5 +----
 3 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/src/backend/catalog/system_functions.sql 
b/src/backend/catalog/system_functions.sql
index c7adfad0e05..f7b9d26089a 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -678,6 +678,13 @@ LANGUAGE INTERNAL
 PARALLEL RESTRICTED
 AS 'pg_get_viewdef';
 
+CREATE OR REPLACE FUNCTION
+  pg_get_indexdef(view oid, "column" int DEFAULT 0, pretty bool DEFAULT false)
+RETURNS TEXT
+LANGUAGE INTERNAL
+PARALLEL SAFE
+AS 'pg_get_indexdef';
+
 --
 -- The default permissions for functions mean that anyone can execute them.
 -- A number of functions shouldn't be executable by just anyone, but rather
diff --git a/src/backend/utils/adt/ruleutils.c 
b/src/backend/utils/adt/ruleutils.c
index 7d576834d5c..92e2f987074 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1114,26 +1114,6 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
  */
 Datum
 pg_get_indexdef(PG_FUNCTION_ARGS)
-{
-       Oid                     indexrelid = PG_GETARG_OID(0);
-       int                     prettyFlags;
-       char       *res;
-
-       prettyFlags = PRETTYFLAG_INDENT;
-
-       res = pg_get_indexdef_worker(indexrelid, 0, NULL,
-                                                                false, false,
-                                                                false, false,
-                                                                prettyFlags, 
true);
-
-       if (res == NULL)
-               PG_RETURN_NULL();
-
-       PG_RETURN_TEXT_P(string_to_text(res));
-}
-
-Datum
-pg_get_indexdef_ext(PG_FUNCTION_ARGS)
 {
        Oid                     indexrelid = PG_GETARG_OID(0);
        int32           colno = PG_GETARG_INT32(1);
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 2d1aa50dac6..62b997a1653 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3955,9 +3955,6 @@
 { oid => '1642', descr => 'role name by OID (with fallback)',
   proname => 'pg_get_userbyid', provolatile => 's', prorettype => 'name',
   proargtypes => 'oid', prosrc => 'pg_get_userbyid' },
-{ oid => '1643', descr => 'index description',
-  proname => 'pg_get_indexdef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid', prosrc => 'pg_get_indexdef' },
 { oid => '3415', descr => 'extended statistics object description',
   proname => 'pg_get_statisticsobjdef', provolatile => 's',
   prorettype => 'text', proargtypes => 'oid',
@@ -8501,7 +8498,7 @@
 { oid => '2507',
   descr => 'index description (full create statement or single expression) 
with pretty-print option',
   proname => 'pg_get_indexdef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid int4 bool', prosrc => 'pg_get_indexdef_ext' },
+  proargtypes => 'oid int4 bool', prosrc => 'pg_get_indexdef' },
 { oid => '2508', descr => 'constraint description with pretty-print option',
   proname => 'pg_get_constraintdef', provolatile => 's', prorettype => 'text',
   proargtypes => 'oid bool', prosrc => 'pg_get_constraintdef_ext' },
-- 
2.51.2

>From b8595b568acfafede830d1b9d9d1cbfee8c6612f Mon Sep 17 00:00:00 2001
From: Mark Wong <[email protected]>
Date: Tue, 9 Dec 2025 10:59:41 -0800
Subject: [PATCH v1 4/6] Handle pg_get_constraintdef default args in
 system_functions.sql

Modernize pg_get_constraintdef to use CREATE OR REPLACE FUNCTION to
handle the optional pretty argument.
---
 src/backend/catalog/system_functions.sql |  7 +++++++
 src/backend/utils/adt/ruleutils.c        | 17 -----------------
 src/include/catalog/pg_proc.dat          |  5 +----
 3 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/src/backend/catalog/system_functions.sql 
b/src/backend/catalog/system_functions.sql
index f7b9d26089a..1f89dcc7908 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -685,6 +685,13 @@ LANGUAGE INTERNAL
 PARALLEL SAFE
 AS 'pg_get_indexdef';
 
+CREATE OR REPLACE FUNCTION
+  pg_get_constraintdef("constraint" oid, pretty bool DEFAULT false)
+RETURNS TEXT
+LANGUAGE INTERNAL
+PARALLEL SAFE
+AS 'pg_get_constraintdef';
+
 --
 -- The default permissions for functions mean that anyone can execute them.
 -- A number of functions shouldn't be executable by just anyone, but rather
diff --git a/src/backend/utils/adt/ruleutils.c 
b/src/backend/utils/adt/ruleutils.c
index 92e2f987074..416144c49f5 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -2061,23 +2061,6 @@ pg_get_partconstrdef_string(Oid partitionId, char 
*aliasname)
  */
 Datum
 pg_get_constraintdef(PG_FUNCTION_ARGS)
-{
-       Oid                     constraintId = PG_GETARG_OID(0);
-       int                     prettyFlags;
-       char       *res;
-
-       prettyFlags = PRETTYFLAG_INDENT;
-
-       res = pg_get_constraintdef_worker(constraintId, false, prettyFlags, 
true);
-
-       if (res == NULL)
-               PG_RETURN_NULL();
-
-       PG_RETURN_TEXT_P(string_to_text(res));
-}
-
-Datum
-pg_get_constraintdef_ext(PG_FUNCTION_ARGS)
 {
        Oid                     constraintId = 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 62b997a1653..a9431ea4037 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3977,9 +3977,6 @@
 { oid => '1662', descr => 'trigger description',
   proname => 'pg_get_triggerdef', provolatile => 's', prorettype => 'text',
   proargtypes => 'oid', prosrc => 'pg_get_triggerdef' },
-{ oid => '1387', descr => 'constraint description',
-  proname => 'pg_get_constraintdef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid', prosrc => 'pg_get_constraintdef' },
 { oid => '1716', descr => 'deparse an encoded expression',
   proname => 'pg_get_expr', provolatile => 's', prorettype => 'text',
   proargtypes => 'pg_node_tree oid', prosrc => 'pg_get_expr' },
@@ -8501,7 +8498,7 @@
   proargtypes => 'oid int4 bool', prosrc => 'pg_get_indexdef' },
 { oid => '2508', descr => 'constraint description with pretty-print option',
   proname => 'pg_get_constraintdef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid bool', prosrc => 'pg_get_constraintdef_ext' },
+  proargtypes => 'oid bool', prosrc => 'pg_get_constraintdef' },
 { oid => '2509',
   descr => 'deparse an encoded expression with pretty-print option',
   proname => 'pg_get_expr', provolatile => 's', prorettype => 'text',
-- 
2.51.2

>From fff7def908696f9147a62a1cd365abbad63c2e4a Mon Sep 17 00:00:00 2001
From: Mark Wong <[email protected]>
Date: Tue, 9 Dec 2025 11:17:56 -0800
Subject: [PATCH v1 5/6] Handle pg_get_expr default args in
 system_functions.sql

Modernize pg_get_expr to use CREATE OR REPLACE FUNCTION to handle the
optional pretty argument.
---
 src/backend/catalog/system_functions.sql |  7 +++++++
 src/backend/utils/adt/ruleutils.c        | 17 -----------------
 src/include/catalog/pg_proc.dat          |  5 +----
 3 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/src/backend/catalog/system_functions.sql 
b/src/backend/catalog/system_functions.sql
index 1f89dcc7908..81d210a9c45 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -692,6 +692,13 @@ LANGUAGE INTERNAL
 PARALLEL SAFE
 AS 'pg_get_constraintdef';
 
+CREATE OR REPLACE FUNCTION
+  pg_get_expr(expr pg_node_tree, relation oid, pretty bool DEFAULT false)
+RETURNS TEXT
+LANGUAGE INTERNAL
+PARALLEL SAFE
+AS 'pg_get_expr';
+
 --
 -- The default permissions for functions mean that anyone can execute them.
 -- A number of functions shouldn't be executable by just anyone, but rather
diff --git a/src/backend/utils/adt/ruleutils.c 
b/src/backend/utils/adt/ruleutils.c
index 416144c49f5..9effa02fa2e 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -2573,23 +2573,6 @@ decompile_column_index_array(Datum column_index_array, 
Oid relId,
  */
 Datum
 pg_get_expr(PG_FUNCTION_ARGS)
-{
-       text       *expr = PG_GETARG_TEXT_PP(0);
-       Oid                     relid = PG_GETARG_OID(1);
-       text       *result;
-       int                     prettyFlags;
-
-       prettyFlags = PRETTYFLAG_INDENT;
-
-       result = pg_get_expr_worker(expr, relid, prettyFlags);
-       if (result)
-               PG_RETURN_TEXT_P(result);
-       else
-               PG_RETURN_NULL();
-}
-
-Datum
-pg_get_expr_ext(PG_FUNCTION_ARGS)
 {
        text       *expr = PG_GETARG_TEXT_PP(0);
        Oid                     relid = PG_GETARG_OID(1);
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index a9431ea4037..10c5286bd7d 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3977,9 +3977,6 @@
 { oid => '1662', descr => 'trigger description',
   proname => 'pg_get_triggerdef', provolatile => 's', prorettype => 'text',
   proargtypes => 'oid', prosrc => 'pg_get_triggerdef' },
-{ oid => '1716', descr => 'deparse an encoded expression',
-  proname => 'pg_get_expr', provolatile => 's', prorettype => 'text',
-  proargtypes => 'pg_node_tree oid', prosrc => 'pg_get_expr' },
 { 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' },
@@ -8502,7 +8499,7 @@
 { oid => '2509',
   descr => 'deparse an encoded expression with pretty-print option',
   proname => 'pg_get_expr', provolatile => 's', prorettype => 'text',
-  proargtypes => 'pg_node_tree oid bool', prosrc => 'pg_get_expr_ext' },
+  proargtypes => 'pg_node_tree oid bool', prosrc => 'pg_get_expr' },
 { oid => '2510', descr => 'get the prepared statements for this session',
   proname => 'pg_prepared_statement', prorows => '1000', proretset => 't',
   provolatile => 's', proparallel => 'r', prorettype => 'record',
-- 
2.51.2

>From 37e5e8017acf5d2ac5789cea4e13c08bf771b5d2 Mon Sep 17 00:00:00 2001
From: Mark Wong <[email protected]>
Date: Tue, 9 Dec 2025 11:51:39 -0800
Subject: [PATCH v1 6/6] Handle pg_get_triggerdef default args in
 system_functions.sql

Modernize pg_get_triggerdef to use CREATE OR REPLACE FUNCTION to handle
the optional pretty argument.
---
 src/backend/catalog/system_functions.sql |  7 +++++++
 src/backend/utils/adt/ruleutils.c        | 14 --------------
 src/include/catalog/pg_proc.dat          |  5 +----
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/src/backend/catalog/system_functions.sql 
b/src/backend/catalog/system_functions.sql
index 81d210a9c45..c9c011ea5c1 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -699,6 +699,13 @@ LANGUAGE INTERNAL
 PARALLEL SAFE
 AS 'pg_get_expr';
 
+CREATE OR REPLACE FUNCTION
+  pg_get_triggerdef(trigger oid, pretty bool DEFAULT false)
+RETURNS TEXT
+LANGUAGE INTERNAL
+PARALLEL SAFE
+AS 'pg_get_triggerdef';
+
 --
 -- The default permissions for functions mean that anyone can execute them.
 -- A number of functions shouldn't be executable by just anyone, but rather
diff --git a/src/backend/utils/adt/ruleutils.c 
b/src/backend/utils/adt/ruleutils.c
index 9effa02fa2e..45a35f823e8 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -807,20 +807,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 10c5286bd7d..146963c254b 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3974,9 +3974,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' },
@@ -8535,7 +8532,7 @@
   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', prosrc => 'pg_get_triggerdef' },
 
 # asynchronous notifications
 { oid => '3035',
-- 
2.51.2

Reply via email to