mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Pgindent run before 9.1 beta2.
This commit is contained in:
@ -33,12 +33,12 @@ typedef struct
|
||||
|
||||
/* Methods */
|
||||
|
||||
bool (*f_gt) (const void *, const void *, Oid); /* greater than */
|
||||
bool (*f_ge) (const void *, const void *, Oid); /* greater equal */
|
||||
bool (*f_eq) (const void *, const void *, Oid); /* equal */
|
||||
bool (*f_le) (const void *, const void *, Oid); /* less equal */
|
||||
bool (*f_lt) (const void *, const void *, Oid); /* less than */
|
||||
int32 (*f_cmp) (const void *, const void *, Oid); /* compare */
|
||||
bool (*f_gt) (const void *, const void *, Oid); /* greater than */
|
||||
bool (*f_ge) (const void *, const void *, Oid); /* greater equal */
|
||||
bool (*f_eq) (const void *, const void *, Oid); /* equal */
|
||||
bool (*f_le) (const void *, const void *, Oid); /* less equal */
|
||||
bool (*f_lt) (const void *, const void *, Oid); /* less than */
|
||||
int32 (*f_cmp) (const void *, const void *, Oid); /* compare */
|
||||
GBT_VARKEY *(*f_l2n) (GBT_VARKEY *); /* convert leaf to node */
|
||||
} gbtree_vinfo;
|
||||
|
||||
|
@ -533,7 +533,7 @@ usage(void)
|
||||
"Main intended use as restore_command in recovery.conf:\n"
|
||||
" restore_command = 'pg_standby [OPTION]... ARCHIVELOCATION %%f %%p %%r'\n"
|
||||
"e.g.\n"
|
||||
" restore_command = 'pg_standby /mnt/server/archiverdir %%f %%p %%r'\n");
|
||||
" restore_command = 'pg_standby /mnt/server/archiverdir %%f %%p %%r'\n");
|
||||
printf("\nReport bugs to <pgsql-bugs@postgresql.org>.\n");
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ check_new_cluster_is_empty(void)
|
||||
/* pg_largeobject and its index should be skipped */
|
||||
if (strcmp(rel_arr->rels[relnum].nspname, "pg_catalog") != 0)
|
||||
pg_log(PG_FATAL, "New cluster database \"%s\" is not empty\n",
|
||||
new_cluster.dbarr.dbs[dbnum].db_name);
|
||||
new_cluster.dbarr.dbs[dbnum].db_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,17 +381,18 @@ check_new_cluster_is_empty(void)
|
||||
static void
|
||||
check_old_cluster_has_new_cluster_dbs(void)
|
||||
{
|
||||
int old_dbnum, new_dbnum;
|
||||
int old_dbnum,
|
||||
new_dbnum;
|
||||
|
||||
for (new_dbnum = 0; new_dbnum < new_cluster.dbarr.ndbs; new_dbnum++)
|
||||
{
|
||||
for (old_dbnum = 0; old_dbnum < old_cluster.dbarr.ndbs; old_dbnum++)
|
||||
if (strcmp(old_cluster.dbarr.dbs[old_dbnum].db_name,
|
||||
new_cluster.dbarr.dbs[new_dbnum].db_name) == 0)
|
||||
new_cluster.dbarr.dbs[new_dbnum].db_name) == 0)
|
||||
break;
|
||||
if (old_dbnum == old_cluster.dbarr.ndbs)
|
||||
pg_log(PG_FATAL, "New cluster database \"%s\" does not exist in the old cluster\n",
|
||||
new_cluster.dbarr.dbs[new_dbnum].db_name);
|
||||
new_cluster.dbarr.dbs[new_dbnum].db_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,7 +496,7 @@ check_is_super_user(ClusterInfo *cluster)
|
||||
|
||||
if (PQntuples(res) != 1 || strcmp(PQgetvalue(res, 0, 0), "t") != 0)
|
||||
pg_log(PG_FATAL, "database user \"%s\" is not a superuser\n",
|
||||
os_info.user);
|
||||
os_info.user);
|
||||
|
||||
PQclear(res);
|
||||
|
||||
|
@ -90,10 +90,10 @@ get_control_data(ClusterInfo *cluster, bool live_check)
|
||||
pg_putenv("LC_TIME", NULL);
|
||||
pg_putenv("LANG",
|
||||
#ifndef WIN32
|
||||
NULL);
|
||||
NULL);
|
||||
#else
|
||||
/* On Windows the default locale cannot be English, so force it */
|
||||
"en");
|
||||
"en");
|
||||
#endif
|
||||
pg_putenv("LANGUAGE", NULL);
|
||||
pg_putenv("LC_ALL", NULL);
|
||||
|
@ -99,16 +99,17 @@ verify_directories(void)
|
||||
|
||||
if (access(".", R_OK | W_OK
|
||||
#ifndef WIN32
|
||||
|
||||
/*
|
||||
* Do a directory execute check only on Unix because execute permission
|
||||
* on NTFS means "can execute scripts", which we don't care about.
|
||||
* Also, X_OK is not defined in the Windows API.
|
||||
* Do a directory execute check only on Unix because execute permission on
|
||||
* NTFS means "can execute scripts", which we don't care about. Also, X_OK
|
||||
* is not defined in the Windows API.
|
||||
*/
|
||||
| X_OK
|
||||
| X_OK
|
||||
#endif
|
||||
) != 0)
|
||||
) != 0)
|
||||
pg_log(PG_FATAL,
|
||||
"You must have read and write access in the current directory.\n");
|
||||
"You must have read and write access in the current directory.\n");
|
||||
|
||||
check_bin_dir(&old_cluster);
|
||||
check_data_dir(old_cluster.pgdata);
|
||||
@ -132,16 +133,18 @@ check_data_dir(const char *pg_data)
|
||||
{
|
||||
char subDirName[MAXPGPATH];
|
||||
int subdirnum;
|
||||
|
||||
/* start check with top-most directory */
|
||||
const char *requiredSubdirs[] = {"", "base", "global", "pg_clog",
|
||||
"pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
|
||||
"pg_xlog"};
|
||||
"pg_xlog"};
|
||||
|
||||
for (subdirnum = 0;
|
||||
subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
|
||||
++subdirnum)
|
||||
{
|
||||
struct stat statBuf;
|
||||
|
||||
snprintf(subDirName, sizeof(subDirName), "%s/%s", pg_data,
|
||||
requiredSubdirs[subdirnum]);
|
||||
|
||||
@ -173,8 +176,8 @@ check_bin_dir(ClusterInfo *cluster)
|
||||
report_status(PG_FATAL, "check for %s failed: %s\n",
|
||||
cluster->bindir, getErrorText(errno));
|
||||
else if (!S_ISDIR(statBuf.st_mode))
|
||||
report_status(PG_FATAL, "%s is not a directory\n",
|
||||
cluster->bindir);
|
||||
report_status(PG_FATAL, "%s is not a directory\n",
|
||||
cluster->bindir);
|
||||
|
||||
validate_exec(cluster->bindir, "postgres");
|
||||
validate_exec(cluster->bindir, "pg_ctl");
|
||||
|
@ -158,6 +158,7 @@ parseCommandLine(int argc, char *argv[])
|
||||
case 'u':
|
||||
pg_free(os_info.user);
|
||||
os_info.user = pg_strdup(optarg);
|
||||
|
||||
/*
|
||||
* Push the user name into the environment so pre-9.1
|
||||
* pg_ctl/libpq uses it.
|
||||
|
@ -378,7 +378,7 @@ void *pg_malloc(int size);
|
||||
void pg_free(void *ptr);
|
||||
const char *getErrorText(int errNum);
|
||||
unsigned int str2uint(const char *str);
|
||||
void pg_putenv(const char *var, const char *val);
|
||||
void pg_putenv(const char *var, const char *val);
|
||||
|
||||
|
||||
/* version.c */
|
||||
|
@ -52,8 +52,8 @@ get_db_conn(ClusterInfo *cluster, const char *db_name)
|
||||
char conn_opts[MAXPGPATH];
|
||||
|
||||
snprintf(conn_opts, sizeof(conn_opts),
|
||||
"dbname = '%s' user = '%s' port = %d", db_name, os_info.user,
|
||||
cluster->port);
|
||||
"dbname = '%s' user = '%s' port = %d", db_name, os_info.user,
|
||||
cluster->port);
|
||||
|
||||
return PQconnectdb(conn_opts);
|
||||
}
|
||||
@ -146,16 +146,18 @@ start_postmaster(ClusterInfo *cluster)
|
||||
PGconn *conn;
|
||||
bool exit_hook_registered = false;
|
||||
int pg_ctl_return = 0;
|
||||
|
||||
#ifndef WIN32
|
||||
char *output_filename = log_opts.filename;
|
||||
char *output_filename = log_opts.filename;
|
||||
#else
|
||||
|
||||
/*
|
||||
* On Win32, we can't send both pg_upgrade output and pg_ctl output to the
|
||||
* same file because we get the error: "The process cannot access the file
|
||||
* because it is being used by another process." so we have to send all
|
||||
* other output to 'nul'.
|
||||
*/
|
||||
char *output_filename = DEVNULL;
|
||||
char *output_filename = DEVNULL;
|
||||
#endif
|
||||
|
||||
if (!exit_hook_registered)
|
||||
@ -180,13 +182,13 @@ start_postmaster(ClusterInfo *cluster)
|
||||
"-o \"-p %d %s\" start >> \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
cluster->bindir, output_filename, cluster->pgdata, cluster->port,
|
||||
(cluster->controldata.cat_ver >=
|
||||
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" :
|
||||
"-c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
|
||||
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" :
|
||||
"-c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
|
||||
log_opts.filename);
|
||||
|
||||
/*
|
||||
* Don't throw an error right away, let connecting throw the error
|
||||
* because it might supply a reason for the failure.
|
||||
* Don't throw an error right away, let connecting throw the error because
|
||||
* it might supply a reason for the failure.
|
||||
*/
|
||||
pg_ctl_return = exec_prog(false, "%s", cmd);
|
||||
|
||||
@ -196,7 +198,7 @@ start_postmaster(ClusterInfo *cluster)
|
||||
{
|
||||
pg_log(PG_REPORT, "\nconnection to database failed: %s\n",
|
||||
PQerrorMessage(conn));
|
||||
if (conn)
|
||||
if (conn)
|
||||
PQfinish(conn);
|
||||
pg_log(PG_FATAL, "unable to connect to %s postmaster started with the command: %s\n",
|
||||
CLUSTER_NAME(cluster), cmd);
|
||||
@ -206,8 +208,8 @@ start_postmaster(ClusterInfo *cluster)
|
||||
/* If the connection didn't fail, fail now */
|
||||
if (pg_ctl_return != 0)
|
||||
pg_log(PG_FATAL, "pg_ctl failed to start the %s server\n",
|
||||
CLUSTER_NAME(cluster));
|
||||
|
||||
CLUSTER_NAME(cluster));
|
||||
|
||||
os_info.running_cluster = cluster;
|
||||
}
|
||||
|
||||
@ -218,11 +220,12 @@ stop_postmaster(bool fast)
|
||||
char cmd[MAXPGPATH];
|
||||
const char *bindir;
|
||||
const char *datadir;
|
||||
|
||||
#ifndef WIN32
|
||||
char *output_filename = log_opts.filename;
|
||||
char *output_filename = log_opts.filename;
|
||||
#else
|
||||
/* See comment in start_postmaster() about why win32 output is ignored. */
|
||||
char *output_filename = DEVNULL;
|
||||
char *output_filename = DEVNULL;
|
||||
#endif
|
||||
|
||||
if (os_info.running_cluster == &old_cluster)
|
||||
@ -268,17 +271,17 @@ check_pghost_envvar(void)
|
||||
for (option = start; option->keyword != NULL; option++)
|
||||
{
|
||||
if (option->envvar && (strcmp(option->envvar, "PGHOST") == 0 ||
|
||||
strcmp(option->envvar, "PGHOSTADDR") == 0))
|
||||
strcmp(option->envvar, "PGHOSTADDR") == 0))
|
||||
{
|
||||
const char *value = getenv(option->envvar);
|
||||
|
||||
if (value && strlen(value) > 0 &&
|
||||
/* check for 'local' host values */
|
||||
/* check for 'local' host values */
|
||||
(strcmp(value, "localhost") != 0 && strcmp(value, "127.0.0.1") != 0 &&
|
||||
strcmp(value, "::1") != 0 && value[0] != '/'))
|
||||
pg_log(PG_FATAL,
|
||||
"libpq environment variable %s has a non-local server value: %s\n",
|
||||
option->envvar, value);
|
||||
"libpq environment variable %s has a non-local server value: %s\n",
|
||||
option->envvar, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,4 +281,3 @@ pg_putenv(const char *var, const char *val)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user