BootstrapModeMain函数不会运行SQL,但是可以运行特殊的bootstrap语言,也就是从bki解析出来的语句。

/*   The main entry point for running the backend in bootstrap mode
* The bootstrap mode is used to initialize the template database.
* The bootstrap backend doesn't speak SQL, but instead expects
* commands in a special bootstrap language. */
static void BootstrapModeMain(void) {
int i;
/* To ensure that src/common/link-canary.c is linked into the backend, we must call it from somewhere. Here is as good as anywhere. */
if (pg_link_canary_is_frontend()) elog(ERROR, "backend is incorrectly linked to frontend functions");
/* Do backend-like initialization for bootstrap mode */
InitProcess();
InitPostgres(NULL, InvalidOid, NULL, InvalidOid, NULL, false);

/* Initialize stuff for bootstrap-file processing */
for (i = 0; i < MAXATTR; i++) {
attrtypes[i] = NULL; Nulls[i] = false;
}
/* Process bootstrap input. */ // boot_yyparse解析bki特殊的bootstrap语言
StartTransactionCommand();
boot_yyparse();
CommitTransactionCommand();

/* We should now know about all mapped relations, so it's okay to write out the initial relation mapping files. */
RelationMapFinishBootstrap();

/* Clean up and exit */
cleanup(); proc_exit(0);
}

PG主程序模块(Main)——BootstrapModeMain从bki解析语句_postgresql