Re: generating function default settings from pg_proc.dat

Corey Huinker <corey.huinker@gmail.com>

From: Corey Huinker <corey.huinker@gmail.com>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Andres Freund <andres@anarazel.de>, Tom Lane <tgl@sss.pgh.pa.us>, Andrew Dunstan <andrew@dunslane.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-02-17T08:49:33Z
Lists: pgsql-hackers
On Tue, Feb 17, 2026 at 1:37 AM Álvaro Herrera <alvherre@kurilemu.de> wrote:

> On 2026-Feb-16, Andres Freund wrote:
>
> > could be
> >
> > { oid => '3786', descr => 'set up a logical replication slot',
> >   proname => 'pg_create_logical_replication_slot', provolatile => 'v',
> >   proparallel => 'u',
> >   proargs => [
> >      {type => 'name', name => 'slot_name'},
> >      {type => 'name', name => 'plugin'},
> >      {type => 'bool', name => 'temporary', default => 'false'},
> >      {type => 'bool', name => 'twophase', default => 'false'},
> >      {type => 'bool', name => 'failover', default => 'false'},
> >   ],
> >   prorettype => [
> >      {type => 'name', name => 'slot_name'},
> >      {type => 'pg_lsn', name => 'lsn'},
> >   ]
> > }
>
> This is pretty much the sort of thing I was imagining when I read
> Corey's argumentation.  +1 for something along these lines.


I like this a lot too, but I'm noticing that with each iteration we're
getting closer to re-inventing SQL. Would it make sense in the long run to
have a mode on the CREATE FUNCTION command that cues initdb to create the
minimal function skeleton with prescribed oid on the first pass, but then
stores the defer-able parts (if any) for a later pass, perhaps in parallel?
Then we wouldn't have to worry about how to model all future additions to
CREATE FUNCTION, and instead focus on what parts of creating the function
need to be in the bootstrap pass.

Commits

  1. Simplify creation of built-in functions with non-default ACLs.

  2. Be more wary of false matches in initdb's replace_token().

  3. Simplify creation of built-in functions with default arguments.