agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Mark Wong <[email protected]>
Subject: [PATCH v7 1/6] Handle pg_get_ruledef default args in system_functions.sql
Date: Mon, 8 Dec 2025 15:41:07 -0800

Modernize pg_get_ruledef to use proargdefaults for optional pretty
argument.
---
 src/backend/utils/adt/ruleutils.c | 18 ------------------
 src/include/catalog/pg_proc.dat   |  8 +++-----
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 35083fcc733..6a4c7e4822d 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -569,24 +569,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 fa9ae79082b..954f611de5b 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3981,9 +3981,6 @@
 { oid => '8302', descr => 'source text of a property graph',
   proname => 'pg_get_propgraphdef', provolatile => 's', prorettype => 'text',
   proargtypes => 'oid', prosrc => 'pg_get_propgraphdef' },
-{ 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',
@@ -8591,9 +8588,10 @@
   prosrc => 'macaddr8_send' },
 
 # System-view support functions with pretty-print option
-{ oid => '2504', descr => 'source text of a rule with pretty-print option',
+{ oid => '2504', descr => 'source text of a rule',
   proname => 'pg_get_ruledef', provolatile => 's', prorettype => 'text',
-  proargtypes => 'oid bool', prosrc => 'pg_get_ruledef_ext' },
+  proargtypes => 'oid bool', proargnames => '{rule,pretty}',
+  proargdefaults => '{false}',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.52.0


--GzYugJnip6WHHvTk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v7-0002-Handle-pg_get_viewdef-default-args-in-system_func.patch



view thread (4193+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v7 1/6] Handle pg_get_ruledef default args in system_functions.sql
  In-Reply-To: <no-message-id-560236@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox