57#include <unicode/ucol.h>
68#include "catalog/pg_authid_d.h"
69#include "catalog/pg_class_d.h"
70#include "catalog/pg_collation_d.h"
71#include "catalog/pg_database_d.h"
97 "trust",
"reject",
"scram-sha-256",
"md5",
"password",
"ident",
"radius",
119 "trust",
"reject",
"scram-sha-256",
"md5",
"password",
"peer",
"radius",
208#define AUTHTRUST_WARNING \
209"# CAUTION: Configuring the system for local \"trust\" authentication\n" \
210"# allows any local user to connect as any PostgreSQL user, including\n" \
211"# the database superuser. If you do not trust all your local users,\n" \
212"# use another authentication method.\n"
226static const char *
const backend_options =
"--single -F -O -j -c search_path=pg_catalog -c exit_on_error=true -c log_checkpoints=false";
233 "pg_wal/archive_status",
243 "pg_multixact/members",
244 "pg_multixact/offsets",
253 "pg_logical/snapshots",
254 "pg_logical/mappings"
263 const char *
token,
const char *replacement);
268static char **
readfile(
const char *path);
269static void writefile(
char *path,
char **lines);
319#define PG_CMD_DECL FILE *cmdfd
321#define PG_CMD_OPEN(cmd) \
323 cmdfd = popen_check(cmd, "w"); \
328#define PG_CMD_CLOSE() \
330 if (pclose_check(cmdfd)) \
334#define PG_CMD_PUTS(line) \
336 if (fputs(line, cmdfd) < 0 || fflush(cmdfd) < 0) \
337 output_failed = true, output_errno = errno; \
340#define PG_CMD_PRINTF(fmt, ...) \
342 if (fprintf(cmdfd, fmt, __VA_ARGS__) < 0 || fflush(cmdfd) < 0) \
343 output_failed = true, output_errno = errno; \
393 pg_fatal(
"failed to restore old locale");
480 replen =
strlen(replacement);
483 for (
int i = 0; lines[
i];
i++)
544 for (
i = 0; lines[
i];
i++)
582 for (ptr = lines[
i]; ptr <
where; ptr++)
621 if (lines[
i] ==
NULL)
647#define LETTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
648#define DIGITS "0123456789"
685 pg_fatal(
"could not open file \"%s\" for reading: %m", path);
729 pg_fatal(
"could not open file \"%s\" for writing: %m", path);
730 for (line = lines; *line !=
NULL; line++)
733 pg_fatal(
"could not write file \"%s\": %m", path);
737 pg_fatal(
"could not close file \"%s\": %m", path);
753 pg_log_error(
"could not execute command \"%s\": %m", command);
777 pg_log_info(
"removing contents of data directory \"%s\"",
780 pg_log_error(
"failed to remove contents of data directory");
793 pg_log_error(
"failed to remove contents of WAL directory");
800 pg_log_info(
"data directory \"%s\" not removed at user's request",
804 pg_log_info(
"WAL directory \"%s\" not removed at user's request",
823 pg_log_error_hint(
"Please log in (using, e.g., \"su\") as the (unprivileged) user that will own the server process.");
855 pg_fatal(
"\"%s\" is not a valid server encoding name",
872 {
"arabic",
"Arabic"},
874 {
"armenian",
"Armenian"},
876 {
"basque",
"Basque"},
878 {
"catalan",
"Catalan"},
880 {
"danish",
"Danish"},
884 {
"english",
"POSIX"},
886 {
"english",
"English"},
888 {
"estonian",
"Estonian"},
890 {
"finnish",
"Finnish"},
892 {
"french",
"French"},
894 {
"german",
"German"},
900 {
"hungarian",
"Hungarian"},
901 {
"indonesian",
"id"},
902 {
"indonesian",
"Indonesian"},
906 {
"italian",
"Italian"},
907 {
"lithuanian",
"lt"},
908 {
"lithuanian",
"Lithuanian"},
910 {
"nepali",
"Nepali"},
912 {
"norwegian",
"Norwegian"},
914 {
"polish",
"Polish"},
915 {
"portuguese",
"pt"},
916 {
"portuguese",
"Portuguese"},
919 {
"russian",
"Russian"},
921 {
"serbian",
"Serbian"},
923 {
"spanish",
"Spanish"},
925 {
"swedish",
"Swedish"},
929 {
"turkish",
"Turkish"},
931 {
"yiddish",
"Yiddish"},
963 *ptr !=
'_' && *ptr !=
'-' && *ptr !=
'.' && *ptr !=
'@')
1004 pg_log_error_hint(
"This might mean you have a corrupted installation or identified the wrong directory with the invocation option -L.");
1008 pg_log_error(
"could not access file \"%s\": %m", path);
1009 pg_log_error_hint(
"This might mean you have a corrupted installation or identified the wrong directory with the invocation option -L.");
1015 pg_log_error(
"file \"%s\" is not a regular file", path);
1016 pg_log_error_hint(
"This might mean you have a corrupted installation or identified the wrong directory with the invocation option -L.");
1037 pg_fatal(
"could not open file \"%s\" for writing: %m", path);
1040 pg_fatal(
"could not write file \"%s\": %m", path);
1057 pg_fatal(
"could not open file \"%s\" for writing: %m", path);
1059 pg_fatal(
"could not write file \"%s\": %m", path);
1080#if defined(HAVE_SHM_OPEN) && !defined(__sun__)
1126#define MIN_BUFS_FOR_CONNS(nconns) ((nconns) * 10)
1137#define AV_SLOTS_FOR_CONNS(nconns) ((nconns) / 6)
1143 16384, 8192, 4096, 3584, 3072, 2560, 2048, 1536,
1144 1000, 900, 800, 700, 600, 500,
1145 400, 300, 200, 100, 50
1159 printf(
_(
"selecting dynamic shared memory implementation ... "));
1169 printf(
_(
"selecting default \"max_connections\" ... "));
1190 printf(
_(
"selecting default \"shared_buffers\" ... "));
1213 printf(
_(
"selecting default time zone ... "));
1234 "\"%s\" --check %s %s "
1235 "-c max_connections=%d "
1236 "-c autovacuum_worker_slots=%d "
1237 "-c shared_buffers=%d "
1238 "-c dynamic_shared_memory_type=%s",
1253 " < \"%s\" > \"%s\" 2>&1",
1261 return (status == 0);
1273 if ((
sz % 1024) == 0)
1293 fputs(
_(
"creating configuration files ... "), stdout);
1378#if DEFAULT_BACKEND_FLUSH_AFTER > 0
1385#if DEFAULT_BGWRITER_FLUSH_AFTER > 0
1392#if DEFAULT_CHECKPOINT_FLUSH_AFTER > 0
1445 pg_fatal(
"could not change permissions of \"%s\": %m", path);
1459 pg_fatal(
"could not change permissions of \"%s\": %m", path);
1491 hints.ai_socktype = 0;
1492 hints.ai_protocol = 0;
1493 hints.ai_addrlen = 0;
1503 "#host all all ::1");
1505 "host replication all ::1",
1506 "#host replication all ::1");
1515 "@authmethodlocal@",
1526 pg_fatal(
"could not change permissions of \"%s\": %m", path);
1537 pg_fatal(
"could not change permissions of \"%s\": %m", path);
1556 printf(
_(
"running bootstrap script ... "));
1568 pg_log_error(
"input file \"%s\" does not belong to PostgreSQL %s",
1583 (
sizeof(
Pointer) == 4) ?
"i" :
"d");
1645 PG_CMD_PUTS(
"REVOKE ALL ON pg_authid FROM public;\n\n");
1691 pg_fatal(
"could not open file \"%s\" for reading: %m",
1697 pg_fatal(
"could not read password from file \"%s\": %m",
1700 pg_fatal(
"password file \"%s\" is empty",
1721 PG_CMD_PUTS(
"SELECT pg_stop_making_pinned_objects();\n\n");
1734 for (
char **line = lines; *line !=
NULL; line++)
1753 "SELECT p.oid as p_oid, o.oid as o_oid, oprname "
1754 "FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid ) "
1755 "INSERT INTO pg_description "
1756 " SELECT p_oid, 'pg_proc'::regclass, 0, "
1757 " 'implementation of ' || oprname || ' operator' "
1759 " WHERE NOT EXISTS (SELECT 1 FROM pg_description "
1760 " WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass) "
1761 " AND NOT EXISTS (SELECT 1 FROM pg_description "
1762 " WHERE objoid = o_oid AND classoid = 'pg_operator'::regclass"
1763 " AND description LIKE 'deprecated%');\n\n");
1777 PG_CMD_PUTS(
"UPDATE pg_collation SET collversion = pg_collation_actual_version(oid) WHERE collname = 'unicode';\n\n");
1780 PG_CMD_PUTS(
"SELECT pg_import_system_collations('pg_catalog');\n\n");
1806 " SET relacl = (SELECT array_agg(a.acl) FROM "
1807 " (SELECT E'=r/\"%s\"' as acl "
1808 " UNION SELECT unnest(pg_catalog.acldefault("
1815 " AND relacl IS NULL;\n\n",
1817 PG_CMD_PUTS(
"GRANT USAGE ON SCHEMA pg_catalog, public TO PUBLIC;\n\n");
1818 PG_CMD_PUTS(
"REVOKE ALL ON pg_largeobject FROM PUBLIC;\n\n");
1820 " (objoid, classoid, objsubid, initprivs, privtype)"
1823 " (SELECT oid FROM pg_class WHERE relname = 'pg_class'),"
1830 " relacl IS NOT NULL"
1835 " (objoid, classoid, objsubid, initprivs, privtype)"
1838 " (SELECT oid FROM pg_class WHERE relname = 'pg_class'),"
1839 " pg_attribute.attnum,"
1840 " pg_attribute.attacl,"
1844 " JOIN pg_attribute ON (pg_class.oid = pg_attribute.attrelid)"
1846 " pg_attribute.attacl IS NOT NULL"
1851 " (objoid, classoid, objsubid, initprivs, privtype)"
1854 " (SELECT oid FROM pg_class WHERE relname = 'pg_proc'),"
1861 " proacl IS NOT NULL;\n\n");
1863 " (objoid, classoid, objsubid, initprivs, privtype)"
1866 " (SELECT oid FROM pg_class WHERE relname = 'pg_type'),"
1873 " typacl IS NOT NULL;\n\n");
1875 " (objoid, classoid, objsubid, initprivs, privtype)"
1878 " (SELECT oid FROM pg_class WHERE relname = 'pg_language'),"
1885 " lanacl IS NOT NULL;\n\n");
1887 " (objoid, classoid, objsubid, initprivs, privtype)"
1890 " (SELECT oid FROM pg_class WHERE "
1891 " relname = 'pg_largeobject_metadata'),"
1896 " pg_largeobject_metadata"
1898 " lomacl IS NOT NULL;\n\n");
1900 " (objoid, classoid, objsubid, initprivs, privtype)"
1903 " (SELECT oid FROM pg_class WHERE relname = 'pg_namespace'),"
1910 " nspacl IS NOT NULL;\n\n");
1912 " (objoid, classoid, objsubid, initprivs, privtype)"
1915 " (SELECT oid FROM pg_class WHERE "
1916 " relname = 'pg_foreign_data_wrapper'),"
1921 " pg_foreign_data_wrapper"
1923 " fdwacl IS NOT NULL;\n\n");
1925 " (objoid, classoid, objsubid, initprivs, privtype)"
1928 " (SELECT oid FROM pg_class "
1929 " WHERE relname = 'pg_foreign_server'),"
1934 " pg_foreign_server"
1936 " srvacl IS NOT NULL;\n\n");
1955 while (ptr !=
vstr && (*ptr <
'0' || *ptr >
'9'))
1975 PG_CMD_PRINTF(
"UPDATE information_schema.sql_implementation_info "
1976 " SET character_value = '%s' "
1977 " WHERE implementation_info_name = 'DBMS VERSION';\n\n",
1981 " (feature_id, feature_name, sub_feature_id, "
1982 " sub_feature_name, is_supported, comments) "
2029 PG_CMD_PUTS(
"CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false"
2031 " STRATEGY = file_copy;\n\n");
2038 PG_CMD_PUTS(
"UPDATE pg_database SET datcollversion = NULL WHERE datname = 'template0';\n\n");
2043 PG_CMD_PUTS(
"UPDATE pg_database SET datcollversion = pg_database_collation_actual_version(oid) WHERE datname = 'template1';\n\n");
2049 PG_CMD_PUTS(
"REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;\n\n");
2050 PG_CMD_PUTS(
"REVOKE CREATE,TEMPORARY ON DATABASE template0 FROM public;\n\n");
2052 PG_CMD_PUTS(
"COMMENT ON DATABASE template0 IS 'unmodifiable empty database';\n\n");
2071 " STRATEGY = file_copy;\n\n");
2072 PG_CMD_PUTS(
"COMMENT ON DATABASE postgres IS 'default administrative connection database';\n\n");
2118 printf(
_(
"could not write to child process: %s\n"),
2208 pg_fatal(
"locale name \"%s\" contains non-ASCII characters",
locale);
2248 pg_fatal(
"invalid locale settings; check LANG and LC_* environment variables");
2254 pg_fatal(
"locale name \"%s\" contains non-ASCII characters",
2281 "selected locale uses (%s) do not match. This would lead to "
2282 "misbehavior in various character string processing functions.",
2286 "or choose a matching combination.",
2304 pg_log_error_detail(
"The encoding you selected (%s) is not supported with the ICU provider.",
2307 "or choose a matching combination.",
2325 const bool strict =
true;
2343 buflen = buflen * 2;
2355 pg_fatal(
"could not convert locale name \"%s\" to language tag: %s",
2361 pg_fatal(
"ICU is not supported in this build");
2384 pg_fatal(
"could not get language from locale \"%s\": %s",
2390 if (
strcmp(lang,
"") == 0 ||
2410 pg_fatal(
"locale \"%s\" has unknown language \"%s\"",
2413 pg_fatal(
"ICU is not supported in this build");
2461#if defined(LC_MESSAGES) && !defined(WIN32)
2471 pg_fatal(
"locale must be specified if provider is %s",
2484 pg_fatal(
"invalid locale name \"%s\" for builtin provider",
2495 printf(
_(
"Using language tag \"%s\" for ICU locale \"%s\".\n"),
2507 pg_fatal(
"ICU is not supported in this build");
2518 printf(
_(
"%s initializes a PostgreSQL database cluster.\n\n"),
progname);
2522 printf(
_(
" -A, --auth=METHOD default authentication method for local connections\n"));
2523 printf(
_(
" --auth-host=METHOD default authentication method for local TCP/IP connections\n"));
2524 printf(
_(
" --auth-local=METHOD default authentication method for local-socket connections\n"));
2525 printf(
_(
" [-D, --pgdata=]DATADIR location for this database cluster\n"));
2526 printf(
_(
" -E, --encoding=ENCODING set default encoding for new databases\n"));
2527 printf(
_(
" -g, --allow-group-access allow group read/execute on data directory\n"));
2528 printf(
_(
" --icu-locale=LOCALE set ICU locale ID for new databases\n"));
2529 printf(
_(
" --icu-rules=RULES set additional ICU collation rules for new databases\n"));
2530 printf(
_(
" -k, --data-checksums use data page checksums\n"));
2531 printf(
_(
" --locale=LOCALE set default locale for new databases\n"));
2532 printf(
_(
" --lc-collate=, --lc-ctype=, --lc-messages=LOCALE\n"
2533 " --lc-monetary=, --lc-numeric=, --lc-time=LOCALE\n"
2534 " set default locale in the respective category for\n"
2535 " new databases (default taken from environment)\n"));
2536 printf(
_(
" --no-locale equivalent to --locale=C\n"));
2537 printf(
_(
" --builtin-locale=LOCALE\n"
2538 " set builtin locale name for new databases\n"));
2539 printf(
_(
" --locale-provider={builtin|libc|icu}\n"
2540 " set default locale provider for new databases\n"));
2541 printf(
_(
" --no-data-checksums do not use data page checksums\n"));
2542 printf(
_(
" --pwfile=FILE read password for the new superuser from file\n"));
2543 printf(
_(
" -T, --text-search-config=CFG\n"
2544 " default text search configuration\n"));
2545 printf(
_(
" -U, --username=NAME database superuser name\n"));
2546 printf(
_(
" -W, --pwprompt prompt for a password for the new superuser\n"));
2547 printf(
_(
" -X, --waldir=WALDIR location for the write-ahead log directory\n"));
2548 printf(
_(
" --wal-segsize=SIZE size of WAL segments, in megabytes\n"));
2549 printf(
_(
"\nLess commonly used options:\n"));
2550 printf(
_(
" -c, --set NAME=VALUE override default setting for server parameter\n"));
2551 printf(
_(
" -d, --debug generate lots of debugging output\n"));
2552 printf(
_(
" --discard-caches set debug_discard_caches=1\n"));
2553 printf(
_(
" -L DIRECTORY where to find the input files\n"));
2554 printf(
_(
" -n, --no-clean do not clean up after errors\n"));
2555 printf(
_(
" -N, --no-sync do not wait for changes to be written safely to disk\n"));
2556 printf(
_(
" --no-sync-data-files do not sync files within database directories\n"));
2557 printf(
_(
" --no-instructions do not print instructions for next steps\n"));
2558 printf(
_(
" -s, --show show internal settings, then exit\n"));
2559 printf(
_(
" --sync-method=METHOD set method for syncing files to disk\n"));
2560 printf(
_(
" -S, --sync-only only sync database files to disk, then exit\n"));
2561 printf(
_(
"\nOther options:\n"));
2562 printf(
_(
" -V, --version output version information, then exit\n"));
2563 printf(
_(
" -?, --help show this help, then exit\n"));
2564 printf(
_(
"\nIf the data directory is not specified, the environment variable PGDATA\n"
2583 const char *
const *p;
2591 pg_fatal(
"invalid authentication method \"%s\" for \"%s\" connections",
2605 pg_fatal(
"must specify a password for the superuser to enable password authentication");
2625 pg_log_error_hint(
"You must identify the directory where the data for this database system "
2626 "will reside. Do this with either the invocation option -D or the "
2627 "environment variable PGDATA.");
2642 pg_fatal(
"could not set environment");
2660 pg_fatal(
"program \"%s\" is needed by %s but was not found in the same directory as \"%s\"",
2663 pg_fatal(
"program \"%s\" was found by \"%s\" but was not the same version as %s",
2678 pg_fatal(
"input file location must be an absolute path");
2695 printf(
_(
"The database cluster will be initialized with locale \"%s\".\n"),
lc_ctype);
2698 printf(
_(
"The database cluster will be initialized with this locale configuration:\n"));
2704 " LC_MESSAGES: %s\n"
2705 " LC_MONETARY: %s\n"
2732 pg_log_error(
"could not find suitable encoding for locale \"%s\"",
2747 printf(
_(
"Encoding \"%s\" implied by locale is not allowed as a server-side encoding.\n"
2748 "The default database encoding will be set to \"%s\" instead.\n"),
2752 pg_log_error(
"locale \"%s\" requires unsupported encoding \"%s\"",
2764 printf(
_(
"The default database encoding has accordingly been set to \"%s\".\n"),
2780 pg_fatal(
"builtin provider locale \"%s\" requires encoding \"%s\"",
2808 "PGDATA=%s\nshare_path=%s\nPGPATH=%s\n"
2809 "POSTGRES_SUPERUSERNAME=%s\nPOSTGRES_BKI=%s\n"
2810 "POSTGRESQL_CONF_SAMPLE=%s\n"
2811 "PG_HBA_SAMPLE=%s\nPG_IDENT_SAMPLE=%s\n",
2842 pg_log_info(
"could not find suitable text search configuration for locale \"%s\"",
2853 pg_log_warning(
"suitable text search configuration for locale \"%s\" is unknown",
2858 pg_log_warning(
"specified text search configuration \"%s\" might not match locale \"%s\"",
2863 printf(
_(
"The default text search configuration will be set to \"%s\".\n"),
2897 printf(
_(
"creating directory %s ... "),
2911 printf(
_(
"fixing permissions on existing directory %s ... "),
2916 pg_fatal(
"could not change permissions of directory \"%s\": %m",
2932 pg_log_error_hint(
"If you want to create a new database system, either remove or empty "
2933 "the directory \"%s\" or run %s "
2934 "with an argument other than \"%s\".",
2961 pg_fatal(
"WAL directory location must be an absolute path");
2968 printf(
_(
"creating directory %s ... "),
2973 pg_fatal(
"could not create directory \"%s\": %m",
2983 printf(
_(
"fixing permissions on existing directory %s ... "),
2988 pg_fatal(
"could not change permissions of directory \"%s\": %m",
3004 pg_log_error_hint(
"If you want to store the WAL there, either remove or empty the directory \"%s\".",
3014 pg_fatal(
"could not create symbolic link \"%s\": %m",
3021 pg_fatal(
"could not create directory \"%s\": %m",
3033 pg_log_error_detail(
"It contains a dot-prefixed/invisible file, perhaps due to it being a mount point.");
3034 else if (
error == 3)
3035 pg_log_error_detail(
"It contains a lost+found directory, perhaps due to it being a mount point.");
3037 pg_log_error_hint(
"Using a mount point directly as the data directory is not recommended.\n"
3038 "Create a subdirectory under the mount point.");
3064 printf(
_(
"creating subdirectories ... "));
3078 pg_fatal(
"could not create directory \"%s\": %m", path);
3107 fputs(
_(
"performing post-bootstrap initialization ... "), stdout);
3227 if (
strcmp(argv[1],
"--help") == 0 ||
strcmp(argv[1],
"-?") == 0)
3232 if (
strcmp(argv[1],
"--version") == 0 ||
strcmp(argv[1],
"-V") == 0)
3241 while ((
c =
getopt_long(argc, argv,
"A:c:dD:E:gkL:nNsST:U:WX:",
3297 printf(
_(
"Running in debug mode.\n"));
3301 printf(
_(
"Running in no-clean mode. Mistakes will not be cleaned up.\n"));
3364 "-c debug_discard_caches=1");
3417 pg_log_error(
"too many command-line arguments (first is \"%s\")",
3424 pg_fatal(
"%s cannot be specified unless locale provider \"%s\" is chosen",
3425 "--builtin-locale",
"builtin");
3428 pg_fatal(
"%s cannot be specified unless locale provider \"%s\" is chosen",
3429 "--icu-locale",
"icu");
3432 pg_fatal(
"%s cannot be specified unless locale provider \"%s\" is chosen",
3433 "--icu-rules",
"icu");
3446 fputs(
_(
"syncing data to disk ... "), stdout);
3454 pg_fatal(
"password prompt and password file cannot be specified together");
3465 pg_fatal(
"argument of %s must be a power of two between 1 and 1024",
"--wal-segsize");
3478 pg_fatal(
"superuser name \"%s\" is disallowed; role names cannot begin with \"pg_\"",
username);
3480 printf(
_(
"The files belonging to this database system will be owned "
3482 "This user must also own the server process.\n\n"),
3496 printf(
_(
"Data page checksums are enabled.\n"));
3498 printf(
_(
"Data page checksums are disabled.\n"));
3509 fputs(
_(
"syncing data to disk ... "), stdout);
3515 printf(
_(
"\nSync to disk skipped.\nThe data directory might become corrupt if the operating system crashes.\n"));
3520 pg_log_warning(
"enabling \"trust\" authentication for local connections");
3521 pg_log_warning_hint(
"You can change this by editing pg_hba.conf or using the option -A, or "
3522 "--auth-local and --auth-host, the next time you run initdb.");
3553 printf(
_(
"\nSuccess. You can now start the database server using:\n\n"
#define PG_TEXTDOMAIN(domain)
int find_my_exec(const char *argv0, char *retpath)
void set_pglocale_pgservice(const char *argv0, const char *app)
int find_other_exec(const char *argv0, const char *target, const char *versionstr, char *retpath)
#define fprintf(file, fmt, msg)
bool is_encoding_supported_by_icu(int encoding)
void err(int eval, const char *fmt,...)
void * pg_malloc(size_t size)
char * pg_strdup(const char *in)
void * pg_realloc(void *ptr, size_t size)
#define pg_realloc_array(pointer, type, count)
#define pg_malloc_array(type, count)
void SetDataDirectoryCreatePerm(int dataDirMode)
#define PG_DIR_MODE_GROUP
@ DATA_DIR_SYNC_METHOD_FSYNC
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
static char * escape_quotes_bki(const char *src)
static const char * default_timezone
static char * superuser_password
static char * encodingid_to_string(int enc)
static char * get_id(void)
void warn_on_mount_point(int error)
static void setup_depend(FILE *cmdfd)
static bool found_existing_pgdata
static bool found_existing_xlogdir
static char * pgdata_native
#define PG_CMD_PUTS(line)
static void check_authmethod_valid(const char *authmethod, const char *const *valid_methods, const char *conntype)
static bool sync_data_files
static char ** readfile(const char *path)
static bool icu_locale_specified
static bool noinstructions
void initialize_data_directory(void)
static void setup_collation(FILE *cmdfd)
static bool check_icu_locale_encoding(int user_enc)
static char backend_exec[MAXPGPATH]
static void restore_global_locale(int category, save_locale_t save)
static bool data_checksums
void setup_text_search(void)
static int get_encoding_id(const char *encoding_name)
static char infoversion[100]
static FILE * popen_check(const char *command, const char *mode)
static char * icu_language_tag(const char *loc_str)
static const char * authmethodhost
void create_data_directory(void)
static bool guc_value_requires_quotes(const char *guc_value)
static char * features_file
struct _stringlist _stringlist
void setup_bin_paths(const char *argv0)
static bool check_locale_encoding(const char *locale, int user_enc)
static void check_authmethod_unspecified(const char **authmethod)
static char locale_provider
static const char *const auth_methods_host[]
static int wal_segment_size_mb
static void bootstrap_template1(void)
void setup_locale_encoding(void)
static void setup_run_file(FILE *cmdfd, const char *filename)
static const char *const auth_methods_local[]
static char ** replace_token(char **lines, const char *token, const char *replacement)
static bool test_specific_config_settings(int test_conns, int test_av_slots, int test_buffs)
static size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
static void setlocales(void)
static save_locale_t save_global_locale(int category)
static bool made_new_xlogdir
static void setup_auth(FILE *cmdfd)
static void check_need_password(const char *authmethodlocal, const char *authmethodhost)
static int locale_date_order(const char *locale)
static void make_postgres(FILE *cmdfd)
static void test_config_settings(void)
static void cleanup_directories_atexit(void)
static const char *const backend_options
static void setup_config(void)
static char * lc_messages
static void setup_privileges(FILE *cmdfd)
static void write_version_file(const char *extrapath)
static const char * find_matching_ts_config(const char *lc_type)
static void trapsig(SIGNAL_ARGS)
static bool output_failed
static char * system_views_file
static void setup_description(FILE *cmdfd)
static char * escape_quotes(const char *src)
#define PG_CMD_PRINTF(fmt,...)
static bool builtin_locale_specified
static char * pretty_wal_size(int segment_count)
static void vacuum_db(FILE *cmdfd)
static const char *const subdirs[]
static void set_info_version(void)
static const struct tsearch_config_match tsearch_config_languages[]
void setup_data_file_paths(void)
static void set_input(char **dest, const char *filename)
static bool made_new_pgdata
static char ** replace_guc_value(char **lines, const char *guc_name, const char *guc_value, bool mark_as_comment)
#define MIN_BUFS_FOR_CONNS(nconns)
static DataDirSyncMethod sync_method
static char bin_path[MAXPGPATH]
void create_xlog_or_symlink(void)
static char * system_functions_file
static _stringlist * extra_guc_names
#define AV_SLOTS_FOR_CONNS(nconns)
static const char * dynamic_shared_memory_type
static void check_input(char *path)
static void add_stringlist_item(_stringlist **listhead, const char *str)
static bool caught_signal
static const char * progname
static _stringlist * extra_guc_values
#define AUTHTRUST_WARNING
static const char * choose_dsm_implementation(void)
static char * dictionary_file
static void writefile(char *path, char **lines)
static void setup_schema(FILE *cmdfd)
const char * select_default_timezone(const char *share_path)
static void check_ok(void)
static char * system_constraints_file
static void set_null_conf(void)
static char * extra_options
static const char * authmethodlocal
static const char *const boot_options
static void make_template0(FILE *cmdfd)
static char * info_schema_file
static void load_plpgsql(FILE *cmdfd)
static const char * default_text_search_config
static void check_locale_name(int category, const char *locale, char **canonname)
static char * lc_monetary
static void icu_validate_locale(const char *loc_str)
static void get_su_pwd(void)
void pg_logging_init(const char *argv0)
#define pg_log_error(...)
#define pg_log_error_hint(...)
#define pg_log_warning_hint(...)
#define pg_log_error_detail(...)
void pfree(void *pointer)
bool option_parse_int(const char *optarg, const char *optname, int min_range, int max_range, int *result)
bool parse_sync_method(const char *optarg, DataDirSyncMethod *sync_method)
static PgChecksumMode mode
#define DEFAULT_PGSOCKET_DIR
#define DEFAULT_XLOG_SEG_SIZE
#define DEFAULT_BACKEND_FLUSH_AFTER
#define DEFAULT_CHECKPOINT_FLUSH_AFTER
#define DEFAULT_BGWRITER_FLUSH_AFTER
static char * pg_ctl_path
static char version_file[MAXPGPATH]
char * pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx)
bool pg_get_line_buf(FILE *stream, StringInfo buf)
PGDLLIMPORT char * optarg
uint32 pg_prng_uint32(pg_prng_state *state)
void pg_prng_seed(pg_prng_state *state, uint64 seed)
static char buf[DEFAULT_XLOG_SEG_SIZE]
#define pg_encoding_to_char
#define pg_valid_server_encoding_id
#define pg_valid_server_encoding
#define pg_log_warning(...)
void get_share_path(const char *my_exec_path, char *ret_path)
void join_path_components(char *ret_path, const char *head, const char *tail)
int pg_mkdir_p(char *path, int omode)
#define is_absolute_path(filename)
char * last_dir_separator(const char *filename)
int pg_strcasecmp(const char *s1, const char *s2)
char * escape_single_quotes_ascii(const char *src)
void canonicalize_path(char *path)
void get_parent_directory(char *path)
int pg_check_dir(const char *dir)
void make_native_path(char *filename)
#define PG_BACKEND_VERSIONSTR
const char * get_progname(const char *argv0)
int pg_get_encoding_from_locale(const char *ctype, bool write_message)
size_t strlcpy(char *dst, const char *src, size_t siz)
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...)
PQExpBuffer createPQExpBuffer(void)
void initPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void destroyPQExpBuffer(PQExpBuffer str)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void termPQExpBuffer(PQExpBuffer str)
static int fd(const char *x, int i)
static pg_prng_state prng_state
char * psprintf(const char *fmt,...)
void get_restricted_token(void)
bool rmtree(const char *path, bool rmtopdir)
char * simple_prompt(const char *prompt, bool echo)
int pg_strip_crlf(char *str)
bool pg_is_ascii(const char *str)
void appendShellString(PQExpBuffer buf, const char *str)
void initStringInfo(StringInfo str)
struct _stringlist * next
const char * get_user_name_or_exit(const char *progname)
#define symlink(oldpath, newpath)
#define IsValidWalSegSize(size)
#define DEFAULT_MAX_WAL_SEGS
#define DEFAULT_MIN_WAL_SEGS
static void infile(const char *name)