agora inbox for [email protected]
help / color / mirror / Atom feedFrom: Mark Wong <[email protected]>
Subject: [PATCH v7 3/6] Handle pg_get_indexdef default args in system_functions.sql
Date: Tue, 9 Dec 2025 10:02:15 -0800
Modernize pg_get_indexdef to use proargdefaults to handle the optional
column and pretty argument.
---
src/backend/utils/adt/ruleutils.c | 20 --------------------
src/include/catalog/pg_proc.dat | 8 +++-----
2 files changed, 3 insertions(+), 25 deletions(-)
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 1202cb07c07..55926ec15e0 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -1125,26 +1125,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 8d81dcdc2f6..dfedf5c2851 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3984,9 +3984,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',
@@ -8603,9 +8600,10 @@
prorettype => 'text', proargtypes => 'oid int4',
prosrc => 'pg_get_viewdef_wrap' },
{ oid => '2507',
- descr => 'index description (full create statement or single expression) with pretty-print option',
+ descr => 'index description',
proname => 'pg_get_indexdef', provolatile => 's', prorettype => 'text',
- proargtypes => 'oid int4 bool', prosrc => 'pg_get_indexdef_ext' },
+ proargtypes => 'oid int4 bool', proargnames => '{index,column,pretty}',
+ proargdefaults => '{0,false}', 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.52.0
--GzYugJnip6WHHvTk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v7-0004-Handle-pg_get_constraintdef-default-args-in-syste.patch
view thread (4262+ 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 3/6] Handle pg_get_indexdef default args in system_functions.sql
In-Reply-To: <no-message-id-611414@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