Re: updates for handling optional argument in system functions

From: Mark Wong <markwkm(at)gmail(dot)com>
To: Tristan Partin <tristan(at)partin(dot)io>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: updates for handling optional argument in system functions
Date: 2026-06-11 14:47:37
Message-ID: airKicKeRJaaoMF5@ltdrgnflg2
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 05, 2026 at 09:04:34PM +0000, Tristan Partin wrote:
> > Patch 1
> >
> > - proargtypes => 'oid bool', prosrc => 'pg_get_ruledef_ext' },
> > + proargtypes => 'oid bool', proargnames => '{rule,pretty}',
> > + proargdefaults => '{false}',prosrc => 'pg_get_ruledef' },
>
> There is a space missing before prosrc in the added line.
>
> Other than that one comment, this looks good to me.

Oops, v8.1 attached to correct that white space.

> I am a little confused how proargdefaults works given the function takes
> two arguments, but you only defined one default, so how does the parser
> know that the false default is in reference to "pretty". I do see there
> is other precedent for this pattern, so it is correct.

I believe that's handled in InsertOneProargdefaultsValue() in
src/backend/bootstrap/bootstrap.c, right below the comment:

/* The values should correspond to the last N argtypes */

Regards,
Mark

Attachment Content-Type Size
v8.1-0001-Handle-pg_get_ruledef-default-args-in-system_fu.patch text/plain 2.6 KB
v8.1-0002-Handle-pg_get_viewdef-default-args-in-system_fu.patch text/plain 4.1 KB
v8.1-0003-Handle-pg_get_indexdef-default-args-in-system_f.patch text/plain 2.8 KB
v8.1-0004-Handle-pg_get_constraintdef-default-args-in-sys.patch text/plain 2.8 KB
v8.1-0005-Handle-pg_get_expr-default-args-in-system_funct.patch text/plain 3.5 KB
v8.1-0006-Handle-pg_get_triggerdef-default-args-in-system.patch text/plain 2.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message m.litsarev 2026-06-11 15:08:13 Fix warning: ‘startpos’ may be used uninitialized in function ‘results_differ’
Previous Message Maksim.Melnikov 2026-06-11 14:31:47 Re: Init connection time grows quadratically