Re: initdb / bootstrap design

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: initdb / bootstrap design
Date: 2022-02-16 10:47:31
Message-ID: 264b73d6-b160-a3f2-315c-eba3b1277ed5@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16.02.22 03:12, Andres Freund wrote:
> Sure, there's a few tokens that we replace in initdb. As it turns out there's
> only two rows that are actually variable. The username of the initial
> superuser in pg_authid and the pg_database row for template 1, where encoding,
> lc_collate and lc_ctype varies. The rest is all compile time constant
> replacements we could do as part of genbki.pl.
>
> It seems we could save a good number of context switches by opening
> postgres.bki just before boot_yyparse() in BootstrapModeMain() and having the
> parser read it. The pg_authid / pg_database rows we could just do via
> explicit insertions in BootstrapModeMain(), provided by commandline args?

I think we could do the locale setup by updating the pg_database row of
template1 after bootstrap, as in the attached patch. (The order of
proceedings in the surrounding function might need some refinement in a
final patch.) I suspect we could do the treatment of pg_authid similarly.

Attachment Content-Type Size
0001-Simplify-locale-setup-of-template1-in-initdb.patch text/plain 2.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-02-16 11:03:21 Re: bailing out in tap tests nearly always a bad idea
Previous Message Peter Eisentraut 2022-02-16 10:11:05 Re: Non-decimal integer literals