Pgindent run on pg_upgrade source after restructuring.
This commit is contained in:
parent
e13f7e9a71
commit
07456b45e6
@ -15,7 +15,7 @@ static void check_new_db_is_empty(void);
|
||||
static void check_locale_and_encoding(ControlData *oldctrl,
|
||||
ControlData *newctrl);
|
||||
static void check_for_isn_and_int8_passing_mismatch(
|
||||
Cluster whichCluster);
|
||||
Cluster whichCluster);
|
||||
static void check_for_reg_data_type_usage(Cluster whichCluster);
|
||||
|
||||
|
||||
@ -156,9 +156,9 @@ issue_warnings(char *sequence_script_file_name)
|
||||
{
|
||||
prep_status("Adjusting sequences");
|
||||
exec_prog(true,
|
||||
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on "
|
||||
"--no-psqlrc --port %d --username \"%s\" "
|
||||
"-f \"%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
|
||||
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on "
|
||||
"--no-psqlrc --port %d --username \"%s\" "
|
||||
"-f \"%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
|
||||
new_cluster.bindir, new_cluster.port, os_info.user,
|
||||
sequence_script_file_name, log.filename);
|
||||
unlink(sequence_script_file_name);
|
||||
@ -418,12 +418,12 @@ create_script_for_old_cluster_deletion(
|
||||
/* remove PG_VERSION? */
|
||||
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
|
||||
fprintf(script, RM_CMD " %s%s/PG_VERSION\n",
|
||||
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix);
|
||||
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix);
|
||||
|
||||
for (dbnum = 0; dbnum < new_cluster.dbarr.ndbs; dbnum++)
|
||||
{
|
||||
fprintf(script, RMDIR_CMD " %s%s/%d\n",
|
||||
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix,
|
||||
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix,
|
||||
old_cluster.dbarr.dbs[dbnum].db_oid);
|
||||
}
|
||||
}
|
||||
@ -434,7 +434,7 @@ create_script_for_old_cluster_deletion(
|
||||
* or a version-specific subdirectory.
|
||||
*/
|
||||
fprintf(script, RMDIR_CMD " %s%s\n",
|
||||
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix);
|
||||
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix);
|
||||
}
|
||||
|
||||
fclose(script);
|
||||
@ -450,7 +450,7 @@ create_script_for_old_cluster_deletion(
|
||||
|
||||
|
||||
/*
|
||||
* check_for_isn_and_int8_passing_mismatch()
|
||||
* check_for_isn_and_int8_passing_mismatch()
|
||||
*
|
||||
* /contrib/isn relies on data type int8, and in 8.4 int8 can now be passed
|
||||
* by value. The schema dumps the CREATE TYPE PASSEDBYVALUE setting so
|
||||
@ -547,7 +547,7 @@ check_for_isn_and_int8_passing_mismatch(Cluster whichCluster)
|
||||
* pg_type.oid
|
||||
* pg_enum.oid
|
||||
*
|
||||
* Most of the reg* data types reference system catalog info that is
|
||||
* Most of the reg* data types reference system catalog info that is
|
||||
* not preserved, and hence these data types cannot be used in user
|
||||
* tables upgraded by pg_upgrade.
|
||||
*/
|
||||
@ -585,13 +585,13 @@ check_for_reg_data_type_usage(Cluster whichCluster)
|
||||
"WHERE c.oid = a.attrelid AND "
|
||||
" NOT a.attisdropped AND "
|
||||
" a.atttypid IN ( "
|
||||
" 'pg_catalog.regproc'::pg_catalog.regtype, "
|
||||
" 'pg_catalog.regproc'::pg_catalog.regtype, "
|
||||
" 'pg_catalog.regprocedure'::pg_catalog.regtype, "
|
||||
" 'pg_catalog.regoper'::pg_catalog.regtype, "
|
||||
" 'pg_catalog.regoper'::pg_catalog.regtype, "
|
||||
" 'pg_catalog.regoperator'::pg_catalog.regtype, "
|
||||
" 'pg_catalog.regclass'::pg_catalog.regtype, "
|
||||
/* regtype.oid is preserved, so 'regtype' is OK */
|
||||
" 'pg_catalog.regconfig'::pg_catalog.regtype, "
|
||||
" 'pg_catalog.regclass'::pg_catalog.regtype, "
|
||||
/* regtype.oid is preserved, so 'regtype' is OK */
|
||||
" 'pg_catalog.regconfig'::pg_catalog.regtype, "
|
||||
" 'pg_catalog.regdictionary'::pg_catalog.regtype) AND "
|
||||
" c.relnamespace = n.oid AND "
|
||||
" n.nspname != 'pg_catalog' AND "
|
||||
|
@ -94,7 +94,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
|
||||
#ifndef WIN32
|
||||
NULL);
|
||||
#else
|
||||
/* On Windows the default locale cannot be English, so force it */
|
||||
/* On Windows the default locale cannot be English, so force it */
|
||||
"en");
|
||||
#endif
|
||||
putenv2("LANGUAGE", NULL);
|
||||
@ -372,7 +372,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
|
||||
pclose(output);
|
||||
|
||||
/*
|
||||
* Restore environment variables
|
||||
* Restore environment variables
|
||||
*/
|
||||
putenv2("LC_COLLATE", lc_collate);
|
||||
putenv2("LC_CTYPE", lc_ctype);
|
||||
@ -393,7 +393,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
|
||||
pg_free(language);
|
||||
pg_free(lc_all);
|
||||
pg_free(lc_messages);
|
||||
|
||||
|
||||
/* verify that we got all the mandatory pg_control data */
|
||||
if (!got_xid || !got_oid ||
|
||||
(!live_check && !got_log_id) ||
|
||||
@ -549,9 +549,10 @@ putenv2(const char *var, const char *val)
|
||||
|
||||
sprintf(envstr, "%s=%s", var, val);
|
||||
putenv(envstr);
|
||||
|
||||
/*
|
||||
* Do not free envstr because it becomes part of the environment
|
||||
* on some operating systems. See port/unsetenv.c::unsetenv.
|
||||
* Do not free envstr because it becomes part of the environment on
|
||||
* some operating systems. See port/unsetenv.c::unsetenv.
|
||||
*/
|
||||
#else
|
||||
SetEnvironmentVariableA(var, val);
|
||||
|
@ -24,7 +24,7 @@ generate_old_dump(void)
|
||||
exec_prog(true,
|
||||
SYSTEMQUOTE "\"%s/pg_dumpall\" --port %d --username \"%s\" "
|
||||
"--schema-only --binary-upgrade > \"%s/" ALL_DUMP_FILE "\""
|
||||
SYSTEMQUOTE, new_cluster.bindir, old_cluster.port, os_info.user, os_info.cwd);
|
||||
SYSTEMQUOTE, new_cluster.bindir, old_cluster.port, os_info.user, os_info.cwd);
|
||||
check_ok();
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <grp.h>
|
||||
|
||||
|
||||
static void check_data_dir(const char *pg_data);
|
||||
static void check_data_dir(const char *pg_data);
|
||||
static void check_bin_dir(ClusterInfo *cluster);
|
||||
static int check_exec(const char *dir, const char *cmdName);
|
||||
static const char *validate_exec(const char *path);
|
||||
@ -128,7 +128,7 @@ check_data_dir(const char *pg_data)
|
||||
int subdirnum;
|
||||
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]);
|
||||
@ -143,8 +143,8 @@ check_data_dir(const char *pg_data)
|
||||
report_status(PG_FATAL, "check for %s failed: %s",
|
||||
requiredSubdirs[subdirnum], getErrorText(errno));
|
||||
else if (!S_ISDIR(statBuf.st_mode))
|
||||
report_status(PG_FATAL, "%s is not a directory",
|
||||
requiredSubdirs[subdirnum]);
|
||||
report_status(PG_FATAL, "%s is not a directory",
|
||||
requiredSubdirs[subdirnum]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,8 +173,8 @@ copy_file(const char *srcfile, const char *dstfile, bool force)
|
||||
|
||||
if (nbytes < 0)
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
int save_errno = errno;
|
||||
|
||||
if (buffer != NULL)
|
||||
free(buffer);
|
||||
|
||||
@ -196,7 +196,7 @@ copy_file(const char *srcfile, const char *dstfile, bool force)
|
||||
if (write(dest_fd, buffer, nbytes) != nbytes)
|
||||
{
|
||||
/* if write didn't set errno, assume problem is no disk space */
|
||||
int save_errno = errno ? errno : ENOSPC;
|
||||
int save_errno = errno ? errno : ENOSPC;
|
||||
|
||||
if (buffer != NULL)
|
||||
free(buffer);
|
||||
|
@ -253,7 +253,7 @@ check_loadable_libraries(void)
|
||||
fclose(script);
|
||||
pg_log(PG_REPORT, "fatal\n");
|
||||
pg_log(PG_FATAL,
|
||||
"| Your installation references loadable libraries that are missing\n"
|
||||
"| Your installation references loadable libraries that are missing\n"
|
||||
"| from the new installation. You can add these libraries to\n"
|
||||
"| the new installation, or remove the functions using them\n"
|
||||
"| from the old installation. A list of the problem libraries\n"
|
||||
|
@ -201,9 +201,9 @@ print_maps(FileNameMap *maps, int n, const char *dbName)
|
||||
for (mapnum = 0; mapnum < n; mapnum++)
|
||||
pg_log(PG_DEBUG, "%s.%s:%u ==> %s.%s:%u\n",
|
||||
maps[mapnum].old_nspname, maps[mapnum].old_relname,
|
||||
maps[mapnum].old_relfilenode,
|
||||
maps[mapnum].old_relfilenode,
|
||||
maps[mapnum].new_nspname, maps[mapnum].new_relname,
|
||||
maps[mapnum].new_relfilenode);
|
||||
maps[mapnum].new_relfilenode);
|
||||
|
||||
pg_log(PG_DEBUG, "\n\n");
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ static void get_pkglibdirs(void);
|
||||
static char *get_pkglibdir(const char *bindir);
|
||||
|
||||
|
||||
UserOpts user_opts;
|
||||
UserOpts user_opts;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -22,7 +22,8 @@ static void set_frozenxids(void);
|
||||
static void setup(char *argv0, bool live_check);
|
||||
static void cleanup(void);
|
||||
|
||||
ClusterInfo old_cluster, new_cluster;
|
||||
ClusterInfo old_cluster,
|
||||
new_cluster;
|
||||
OSInfo os_info;
|
||||
|
||||
int
|
||||
@ -82,7 +83,7 @@ main(int argc, char **argv)
|
||||
prep_status("Setting next oid for new cluster");
|
||||
exec_prog(true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -o %u \"%s\" > "
|
||||
DEVNULL SYSTEMQUOTE,
|
||||
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtoid, new_cluster.pgdata);
|
||||
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtoid, new_cluster.pgdata);
|
||||
check_ok();
|
||||
|
||||
create_script_for_old_cluster_deletion(&deletion_script_file_name);
|
||||
@ -161,7 +162,7 @@ prepare_new_cluster(void)
|
||||
exec_prog(true,
|
||||
SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
|
||||
"--all --analyze >> %s 2>&1" SYSTEMQUOTE,
|
||||
new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
|
||||
new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
|
||||
check_ok();
|
||||
|
||||
/*
|
||||
@ -174,7 +175,7 @@ prepare_new_cluster(void)
|
||||
exec_prog(true,
|
||||
SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
|
||||
"--all --freeze >> %s 2>&1" SYSTEMQUOTE,
|
||||
new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
|
||||
new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
|
||||
check_ok();
|
||||
|
||||
get_pg_database_relfilenode(CLUSTER_NEW);
|
||||
@ -202,7 +203,7 @@ prepare_new_databases(void)
|
||||
prep_status("Creating databases in the new cluster");
|
||||
exec_prog(true,
|
||||
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on "
|
||||
/* --no-psqlrc prevents AUTOCOMMIT=off */
|
||||
/* --no-psqlrc prevents AUTOCOMMIT=off */
|
||||
"--no-psqlrc --port %d --username \"%s\" "
|
||||
"-f \"%s/%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
|
||||
new_cluster.bindir, new_cluster.port, os_info.user, os_info.cwd,
|
||||
@ -273,14 +274,14 @@ copy_clog_xlog_xid(void)
|
||||
/* set the next transaction id of the new cluster */
|
||||
prep_status("Setting next transaction id for new cluster");
|
||||
exec_prog(true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -f -x %u \"%s\" > " DEVNULL SYSTEMQUOTE,
|
||||
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtxid, new_cluster.pgdata);
|
||||
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtxid, new_cluster.pgdata);
|
||||
check_ok();
|
||||
|
||||
/* now reset the wal archives in the new cluster */
|
||||
prep_status("Resetting WAL archives");
|
||||
exec_prog(true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -l %u,%u,%u \"%s\" >> \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
new_cluster.bindir, old_cluster.controldata.chkpnt_tli,
|
||||
old_cluster.controldata.logid, old_cluster.controldata.nxtlogseg,
|
||||
old_cluster.controldata.logid, old_cluster.controldata.nxtlogseg,
|
||||
new_cluster.pgdata, log.filename);
|
||||
check_ok();
|
||||
}
|
||||
|
@ -53,7 +53,7 @@
|
||||
#endif
|
||||
|
||||
#define CLUSTERNAME(cluster) ((cluster) == CLUSTER_OLD ? "old" : "new")
|
||||
#define ACTIVE_CLUSTER(cluster) (((cluster) == CLUSTER_OLD) ? \
|
||||
#define ACTIVE_CLUSTER(cluster) (((cluster) == CLUSTER_OLD) ? \
|
||||
&old_cluster : &new_cluster)
|
||||
|
||||
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
|
||||
@ -85,8 +85,8 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
Oid old_relfilenode; /* Relfilenode of the old relation */
|
||||
Oid new_relfilenode; /* Relfilenode of the new relation */
|
||||
Oid old_relfilenode; /* Relfilenode of the old relation */
|
||||
Oid new_relfilenode; /* Relfilenode of the new relation */
|
||||
char old_file[MAXPGPATH];
|
||||
char new_file[MAXPGPATH];
|
||||
char old_nspname[NAMEDATALEN]; /* old name of the namespace */
|
||||
@ -240,10 +240,11 @@ typedef struct
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
extern Log log;
|
||||
extern UserOpts user_opts;
|
||||
extern ClusterInfo old_cluster, new_cluster;
|
||||
extern OSInfo os_info;
|
||||
extern Log log;
|
||||
extern UserOpts user_opts;
|
||||
extern ClusterInfo old_cluster,
|
||||
new_cluster;
|
||||
extern OSInfo os_info;
|
||||
extern char scandir_file_pattern[];
|
||||
|
||||
|
||||
@ -260,7 +261,7 @@ void output_completion_banner(
|
||||
char *deletion_script_file_name);
|
||||
void check_cluster_versions(void);
|
||||
void check_cluster_compatibility(bool live_check);
|
||||
void create_script_for_old_cluster_deletion(char **deletion_script_file_name);
|
||||
void create_script_for_old_cluster_deletion(char **deletion_script_file_name);
|
||||
|
||||
|
||||
/* controldata.c */
|
||||
@ -402,12 +403,12 @@ void new_9_0_populate_pg_largeobject_metadata(
|
||||
|
||||
/* version_old_8_3.c */
|
||||
|
||||
void old_8_3_check_for_name_data_type_usage(Cluster whichCluster);
|
||||
void old_8_3_check_for_tsquery_usage(Cluster whichCluster);
|
||||
void old_8_3_check_for_name_data_type_usage(Cluster whichCluster);
|
||||
void old_8_3_check_for_tsquery_usage(Cluster whichCluster);
|
||||
void old_8_3_rebuild_tsvector_tables(bool check_mode,
|
||||
Cluster whichCluster);
|
||||
Cluster whichCluster);
|
||||
void old_8_3_invalidate_hash_gin_indexes(bool check_mode,
|
||||
Cluster whichCluster);
|
||||
Cluster whichCluster);
|
||||
void old_8_3_invalidate_bpchar_pattern_ops_indexes(bool check_mode,
|
||||
Cluster whichCluster);
|
||||
char *old_8_3_create_sequence_script(Cluster whichCluster);
|
||||
Cluster whichCluster);
|
||||
char *old_8_3_create_sequence_script(Cluster whichCluster);
|
||||
|
@ -63,7 +63,7 @@ transfer_all_new_dbs(DbInfoArr *olddb_arr,
|
||||
}
|
||||
}
|
||||
|
||||
prep_status(""); /* in case nothing printed */
|
||||
prep_status(""); /* in case nothing printed */
|
||||
check_ok();
|
||||
|
||||
return msg;
|
||||
@ -122,9 +122,9 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
|
||||
/* Copying files might take some time, so give feedback. */
|
||||
|
||||
snprintf(old_file, sizeof(old_file), "%s/%u", maps[mapnum].old_file,
|
||||
maps[mapnum].old_relfilenode);
|
||||
maps[mapnum].old_relfilenode);
|
||||
snprintf(new_file, sizeof(new_file), "%s/%u", maps[mapnum].new_file,
|
||||
maps[mapnum].new_relfilenode);
|
||||
maps[mapnum].new_relfilenode);
|
||||
pg_log(PG_REPORT, OVERWRITE_MESSAGE, old_file);
|
||||
|
||||
/*
|
||||
@ -142,7 +142,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
|
||||
* Now copy/link any fsm and vm files, if they exist
|
||||
*/
|
||||
snprintf(scandir_file_pattern, sizeof(scandir_file_pattern), "%u_",
|
||||
maps[mapnum].old_relfilenode);
|
||||
maps[mapnum].old_relfilenode);
|
||||
numFiles = pg_scandir(maps[mapnum].old_file, &namelist, dir_matching_filenames);
|
||||
|
||||
while (numFiles--)
|
||||
@ -150,7 +150,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
|
||||
snprintf(old_file, sizeof(old_file), "%s/%s", maps[mapnum].old_file,
|
||||
namelist[numFiles]->d_name);
|
||||
snprintf(new_file, sizeof(new_file), "%s/%u%s", maps[mapnum].new_file,
|
||||
maps[mapnum].new_relfilenode, strchr(namelist[numFiles]->d_name, '_'));
|
||||
maps[mapnum].new_relfilenode, strchr(namelist[numFiles]->d_name, '_'));
|
||||
|
||||
unlink(new_file);
|
||||
transfer_relfile(pageConverter, old_file, new_file,
|
||||
@ -171,7 +171,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
|
||||
* copied.
|
||||
*/
|
||||
snprintf(scandir_file_pattern, sizeof(scandir_file_pattern), "%u.",
|
||||
maps[mapnum].old_relfilenode);
|
||||
maps[mapnum].old_relfilenode);
|
||||
numFiles = pg_scandir(maps[mapnum].old_file, &namelist, dir_matching_filenames);
|
||||
|
||||
while (numFiles--)
|
||||
@ -179,7 +179,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
|
||||
snprintf(old_file, sizeof(old_file), "%s/%s", maps[mapnum].old_file,
|
||||
namelist[numFiles]->d_name);
|
||||
snprintf(new_file, sizeof(new_file), "%s/%u%s", maps[mapnum].new_file,
|
||||
maps[mapnum].new_relfilenode, strchr(namelist[numFiles]->d_name, '.'));
|
||||
maps[mapnum].new_relfilenode, strchr(namelist[numFiles]->d_name, '.'));
|
||||
|
||||
unlink(new_file);
|
||||
transfer_relfile(pageConverter, old_file, new_file,
|
||||
|
@ -36,7 +36,7 @@ connectToServer(const char *db_name,
|
||||
PGconn *conn;
|
||||
|
||||
snprintf(connectString, sizeof(connectString),
|
||||
"dbname = '%s' user = '%s' port = %d", db_name, os_info.user, port);
|
||||
"dbname = '%s' user = '%s' port = %d", db_name, os_info.user, port);
|
||||
|
||||
conn = PQconnectdb(connectString);
|
||||
|
||||
@ -175,8 +175,8 @@ start_postmaster(Cluster whichCluster, bool quiet)
|
||||
/*
|
||||
* 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'.
|
||||
* because it is being used by another process." so we have to send all
|
||||
* other output to 'nul'.
|
||||
*/
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" "
|
||||
@ -260,7 +260,7 @@ test_server_conn(int timeout, Cluster whichCluster)
|
||||
bool ret = false;
|
||||
|
||||
snprintf(con_opts, sizeof(con_opts),
|
||||
"dbname = 'template1' user = '%s' port = %d ", os_info.user, port);
|
||||
"dbname = 'template1' user = '%s' port = %d ", os_info.user, port);
|
||||
|
||||
for (tries = 0; tries < timeout; tries++)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ init_tablespaces(void)
|
||||
set_tablespace_directory_suffix(CLUSTER_NEW);
|
||||
|
||||
if (os_info.num_tablespaces > 0 &&
|
||||
strcmp(old_cluster.tablespace_suffix, new_cluster.tablespace_suffix) == 0)
|
||||
strcmp(old_cluster.tablespace_suffix, new_cluster.tablespace_suffix) == 0)
|
||||
pg_log(PG_FATAL,
|
||||
"Cannot migrate to/from the same system catalog version when\n"
|
||||
"using tablespaces.\n");
|
||||
@ -52,7 +52,7 @@ get_tablespace_paths(void)
|
||||
|
||||
if ((os_info.num_tablespaces = PQntuples(res)) != 0)
|
||||
os_info.tablespaces = (char **) pg_malloc(
|
||||
os_info.num_tablespaces * sizeof(char *));
|
||||
os_info.num_tablespaces * sizeof(char *));
|
||||
else
|
||||
os_info.tablespaces = NULL;
|
||||
|
||||
@ -81,8 +81,8 @@ set_tablespace_directory_suffix(Cluster whichCluster)
|
||||
{
|
||||
/* This cluster has a version-specific subdirectory */
|
||||
active_cluster->tablespace_suffix = pg_malloc(4 +
|
||||
strlen(active_cluster->major_version_str) +
|
||||
10 /* OIDCHARS */ + 1);
|
||||
strlen(active_cluster->major_version_str) +
|
||||
10 /* OIDCHARS */ + 1);
|
||||
|
||||
/* The leading slash is needed to start a new directory. */
|
||||
sprintf(active_cluster->tablespace_suffix, "/PG_%s_%d", active_cluster->major_version_str,
|
||||
|
@ -293,8 +293,8 @@ old_8_3_rebuild_tsvector_tables(bool check_mode,
|
||||
if (strlen(old_nspname) != 0 || strlen(old_relname) != 0)
|
||||
fprintf(script, ";\n\n");
|
||||
fprintf(script, "ALTER TABLE %s.%s\n",
|
||||
quote_identifier(PQgetvalue(res, rowno, i_nspname)),
|
||||
quote_identifier(PQgetvalue(res, rowno, i_relname)));
|
||||
quote_identifier(PQgetvalue(res, rowno, i_nspname)),
|
||||
quote_identifier(PQgetvalue(res, rowno, i_relname)));
|
||||
}
|
||||
else
|
||||
fprintf(script, ",\n");
|
||||
@ -304,8 +304,8 @@ old_8_3_rebuild_tsvector_tables(bool check_mode,
|
||||
fprintf(script, "ALTER COLUMN %s "
|
||||
/* This could have been a custom conversion function call. */
|
||||
"TYPE pg_catalog.tsvector USING %s::pg_catalog.text::pg_catalog.tsvector",
|
||||
quote_identifier(PQgetvalue(res, rowno, i_attname)),
|
||||
quote_identifier(PQgetvalue(res, rowno, i_attname)));
|
||||
quote_identifier(PQgetvalue(res, rowno, i_attname)),
|
||||
quote_identifier(PQgetvalue(res, rowno, i_attname)));
|
||||
}
|
||||
}
|
||||
if (strlen(old_nspname) != 0 || strlen(old_relname) != 0)
|
||||
@ -407,8 +407,8 @@ old_8_3_invalidate_hash_gin_indexes(bool check_mode,
|
||||
db_used = true;
|
||||
}
|
||||
fprintf(script, "REINDEX INDEX %s.%s;\n",
|
||||
quote_identifier(PQgetvalue(res, rowno, i_nspname)),
|
||||
quote_identifier(PQgetvalue(res, rowno, i_relname)));
|
||||
quote_identifier(PQgetvalue(res, rowno, i_nspname)),
|
||||
quote_identifier(PQgetvalue(res, rowno, i_relname)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -532,8 +532,8 @@ old_8_3_invalidate_bpchar_pattern_ops_indexes(bool check_mode,
|
||||
db_used = true;
|
||||
}
|
||||
fprintf(script, "REINDEX INDEX %s.%s;\n",
|
||||
quote_identifier(PQgetvalue(res, rowno, i_nspname)),
|
||||
quote_identifier(PQgetvalue(res, rowno, i_relname)));
|
||||
quote_identifier(PQgetvalue(res, rowno, i_nspname)),
|
||||
quote_identifier(PQgetvalue(res, rowno, i_relname)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,7 +669,7 @@ old_8_3_create_sequence_script(Cluster whichCluster)
|
||||
i_is_called = PQfnumber(seq_res, "is_called");
|
||||
|
||||
fprintf(script, "SELECT setval('%s.%s', %s, '%s');\n",
|
||||
quote_identifier(nspname), quote_identifier(relname),
|
||||
quote_identifier(nspname), quote_identifier(relname),
|
||||
PQgetvalue(seq_res, 0, i_last_value), PQgetvalue(seq_res, 0, i_is_called));
|
||||
PQclear(seq_res);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user