* 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. */
| 531 | * commands in a special bootstrap language. |
| 532 | */ |
| 533 | static void |
| 534 | BootstrapModeMain(void) |
| 535 | { |
| 536 | int i; |
| 537 | |
| 538 | Assert(!IsUnderPostmaster); |
| 539 | Assert(IsBootstrapProcessingMode()); |
| 540 | |
| 541 | /* |
| 542 | * To ensure that src/common/link-canary.c is linked into the backend, we |
| 543 | * must call it from somewhere. Here is as good as anywhere. |
| 544 | */ |
| 545 | if (pg_link_canary_is_frontend()) |
| 546 | elog(ERROR, "backend is incorrectly linked to frontend functions"); |
| 547 | |
| 548 | /* |
| 549 | * Do backend-like initialization for bootstrap mode |
| 550 | */ |
| 551 | InitProcess(); |
| 552 | |
| 553 | InitPostgres(NULL, InvalidOid, NULL, InvalidOid, NULL, false); |
| 554 | |
| 555 | /* Initialize stuff for bootstrap-file processing */ |
| 556 | for (i = 0; i < MAXATTR; i++) |
| 557 | { |
| 558 | attrtypes[i] = NULL; |
| 559 | Nulls[i] = false; |
| 560 | } |
| 561 | |
| 562 | /* |
| 563 | * Process bootstrap input. |
| 564 | */ |
| 565 | StartTransactionCommand(); |
| 566 | boot_yyparse(); |
| 567 | CommitTransactionCommand(); |
| 568 | |
| 569 | /* |
| 570 | * We should now know about all mapped relations, so it's okay to write |
| 571 | * out the initial relation mapping files. |
| 572 | */ |
| 573 | RelationMapFinishBootstrap(); |
| 574 | |
| 575 | /* Clean up and exit */ |
| 576 | cleanup(); |
| 577 | proc_exit(0); |
| 578 | } |
| 579 | |
| 580 | |
| 581 | /* ---------------------------------------------------------------- |
no test coverage detected