mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
pgindent run for 9.0, second run
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
* Darko Prenosil <Darko.Prenosil@finteh.hr>
|
||||
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.98 2010/06/15 20:29:01 tgl Exp $
|
||||
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.99 2010/07/06 19:18:54 momjian Exp $
|
||||
* Copyright (c) 2001-2010, PostgreSQL Global Development Group
|
||||
* ALL RIGHTS RESERVED;
|
||||
*
|
||||
@ -1797,7 +1797,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals
|
||||
appendStringInfo(&buf, " AND ");
|
||||
|
||||
appendStringInfoString(&buf,
|
||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
||||
|
||||
if (tgt_pkattvals[i] != NULL)
|
||||
appendStringInfo(&buf, " = %s",
|
||||
@ -1880,7 +1880,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
|
||||
appendStringInfo(&buf, " AND ");
|
||||
|
||||
appendStringInfo(&buf, "%s",
|
||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
||||
|
||||
val = tgt_pkattvals[i];
|
||||
|
||||
@ -1976,8 +1976,8 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
|
||||
* Build sql statement to look up tuple of interest, ie, the one matching
|
||||
* src_pkattvals. We used to use "SELECT *" here, but it's simpler to
|
||||
* generate a result tuple that matches the table's physical structure,
|
||||
* with NULLs for any dropped columns. Otherwise we have to deal with
|
||||
* two different tupdescs and everything's very confusing.
|
||||
* with NULLs for any dropped columns. Otherwise we have to deal with two
|
||||
* different tupdescs and everything's very confusing.
|
||||
*/
|
||||
appendStringInfoString(&buf, "SELECT ");
|
||||
|
||||
@ -1990,7 +1990,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
|
||||
appendStringInfoString(&buf, "NULL");
|
||||
else
|
||||
appendStringInfoString(&buf,
|
||||
quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
|
||||
quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
|
||||
}
|
||||
|
||||
appendStringInfo(&buf, " FROM %s WHERE ", relname);
|
||||
@ -2003,7 +2003,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
|
||||
appendStringInfo(&buf, " AND ");
|
||||
|
||||
appendStringInfoString(&buf,
|
||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
||||
|
||||
if (src_pkattvals[i] != NULL)
|
||||
appendStringInfo(&buf, " = %s",
|
||||
@ -2417,9 +2417,9 @@ validate_pkattnums(Relation rel,
|
||||
/* Validate attnums and convert to internal form */
|
||||
for (i = 0; i < pknumatts_arg; i++)
|
||||
{
|
||||
int pkattnum = pkattnums_arg->values[i];
|
||||
int lnum;
|
||||
int j;
|
||||
int pkattnum = pkattnums_arg->values[i];
|
||||
int lnum;
|
||||
int j;
|
||||
|
||||
/* Can throw error immediately if out of range */
|
||||
if (pkattnum <= 0 || pkattnum > natts)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This is a port of the Double Metaphone algorithm for use in PostgreSQL.
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/fuzzystrmatch/dmetaphone.c,v 1.14 2010/04/05 02:46:20 adunstan Exp $
|
||||
* $PostgreSQL: pgsql/contrib/fuzzystrmatch/dmetaphone.c,v 1.15 2010/07/06 19:18:55 momjian Exp $
|
||||
*
|
||||
* Double Metaphone computes 2 "sounds like" strings - a primary and an
|
||||
* alternate. In most cases they are the same, but for foreign names
|
||||
@ -461,7 +461,7 @@ DoubleMetaphone(char *str, char **codes)
|
||||
current += 1;
|
||||
break;
|
||||
|
||||
case '\xc7': /* C with cedilla */
|
||||
case '\xc7': /* C with cedilla */
|
||||
MetaphAdd(primary, "S");
|
||||
MetaphAdd(secondary, "S");
|
||||
current += 1;
|
||||
@ -1037,7 +1037,7 @@ DoubleMetaphone(char *str, char **codes)
|
||||
MetaphAdd(secondary, "N");
|
||||
break;
|
||||
|
||||
case '\xd1': /* N with tilde */
|
||||
case '\xd1': /* N with tilde */
|
||||
current += 1;
|
||||
MetaphAdd(primary, "N");
|
||||
MetaphAdd(secondary, "N");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $PostgreSQL: pgsql/contrib/pg_archivecleanup/pg_archivecleanup.c,v 1.2 2010/06/17 17:31:27 tgl Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_archivecleanup/pg_archivecleanup.c,v 1.3 2010/07/06 19:18:55 momjian Exp $
|
||||
*
|
||||
* pg_archivecleanup.c
|
||||
*
|
||||
@ -40,8 +40,9 @@ bool debug = false; /* are we debugging? */
|
||||
char *archiveLocation; /* where to find the archive? */
|
||||
char *restartWALFileName; /* the file from which we can restart restore */
|
||||
char WALFilePath[MAXPGPATH]; /* the file path including archive */
|
||||
char exclusiveCleanupFileName[MAXPGPATH]; /* the oldest file we want to
|
||||
* remain in archive */
|
||||
char exclusiveCleanupFileName[MAXPGPATH]; /* the oldest file we
|
||||
* want to remain in
|
||||
* archive */
|
||||
|
||||
|
||||
/* =====================================================================
|
||||
@ -68,14 +69,14 @@ char exclusiveCleanupFileName[MAXPGPATH]; /* the oldest file we want to
|
||||
/*
|
||||
* Initialize allows customized commands into the archive cleanup program.
|
||||
*
|
||||
* You may wish to add code to check for tape libraries, etc..
|
||||
* You may wish to add code to check for tape libraries, etc..
|
||||
*/
|
||||
static void
|
||||
Initialize(void)
|
||||
{
|
||||
/*
|
||||
* This code assumes that archiveLocation is a directory, so we use
|
||||
* stat to test if it's accessible.
|
||||
* This code assumes that archiveLocation is a directory, so we use stat
|
||||
* to test if it's accessible.
|
||||
*/
|
||||
struct stat stat_buf;
|
||||
|
||||
@ -100,22 +101,21 @@ CleanupPriorWALFiles(void)
|
||||
while ((xlde = readdir(xldir)) != NULL)
|
||||
{
|
||||
/*
|
||||
* We ignore the timeline part of the XLOG segment identifiers
|
||||
* in deciding whether a segment is still needed. This
|
||||
* ensures that we won't prematurely remove a segment from a
|
||||
* parent timeline. We could probably be a little more
|
||||
* proactive about removing segments of non-parent timelines,
|
||||
* but that would be a whole lot more complicated.
|
||||
* We ignore the timeline part of the XLOG segment identifiers in
|
||||
* deciding whether a segment is still needed. This ensures that
|
||||
* we won't prematurely remove a segment from a parent timeline.
|
||||
* We could probably be a little more proactive about removing
|
||||
* segments of non-parent timelines, but that would be a whole lot
|
||||
* more complicated.
|
||||
*
|
||||
* We use the alphanumeric sorting property of the filenames
|
||||
* to decide which ones are earlier than the
|
||||
* exclusiveCleanupFileName file. Note that this means files
|
||||
* are not removed in the order they were originally written,
|
||||
* in case this worries you.
|
||||
* We use the alphanumeric sorting property of the filenames to
|
||||
* decide which ones are earlier than the exclusiveCleanupFileName
|
||||
* file. Note that this means files are not removed in the order
|
||||
* they were originally written, in case this worries you.
|
||||
*/
|
||||
if (strlen(xlde->d_name) == XLOG_DATA_FNAME_LEN &&
|
||||
strspn(xlde->d_name, "0123456789ABCDEF") == XLOG_DATA_FNAME_LEN &&
|
||||
strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
|
||||
strspn(xlde->d_name, "0123456789ABCDEF") == XLOG_DATA_FNAME_LEN &&
|
||||
strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
snprintf(WALFilePath, MAXPGPATH, "%s\\%s", archiveLocation, xlde->d_name);
|
||||
@ -152,13 +152,13 @@ CleanupPriorWALFiles(void)
|
||||
static void
|
||||
SetWALFileNameForCleanup(void)
|
||||
{
|
||||
bool fnameOK = false;
|
||||
bool fnameOK = false;
|
||||
|
||||
/*
|
||||
* If restartWALFileName is a WAL file name then just use it directly.
|
||||
* If restartWALFileName is a .backup filename, make sure we use
|
||||
* the prefix of the filename, otherwise we will remove wrong files
|
||||
* since 000000010000000000000010.00000020.backup is after
|
||||
* If restartWALFileName is a WAL file name then just use it directly. If
|
||||
* restartWALFileName is a .backup filename, make sure we use the prefix
|
||||
* of the filename, otherwise we will remove wrong files since
|
||||
* 000000010000000000000010.00000020.backup is after
|
||||
* 000000010000000000000010.
|
||||
*/
|
||||
if (strlen(restartWALFileName) == XLOG_DATA_FNAME_LEN &&
|
||||
@ -169,17 +169,20 @@ SetWALFileNameForCleanup(void)
|
||||
}
|
||||
else if (strlen(restartWALFileName) == XLOG_BACKUP_FNAME_LEN)
|
||||
{
|
||||
int args;
|
||||
int args;
|
||||
uint32 tli = 1,
|
||||
log = 0,
|
||||
seg = 0,
|
||||
offset = 0;
|
||||
|
||||
args = sscanf(restartWALFileName, "%08X%08X%08X.%08X.backup", &tli, &log, &seg, &offset);
|
||||
if (args == 4)
|
||||
{
|
||||
fnameOK = true;
|
||||
|
||||
/*
|
||||
* Use just the prefix of the filename, ignore everything after first period
|
||||
* Use just the prefix of the filename, ignore everything after
|
||||
* first period
|
||||
*/
|
||||
XLogFileName(exclusiveCleanupFileName, tli, log, seg);
|
||||
}
|
||||
@ -205,12 +208,12 @@ usage(void)
|
||||
printf("Usage:\n");
|
||||
printf(" %s [OPTION]... ARCHIVELOCATION OLDESTKEPTWALFILE\n", progname);
|
||||
printf("\n"
|
||||
"for use as an archive_cleanup_command in the recovery.conf when standby_mode = on:\n"
|
||||
"for use as an archive_cleanup_command in the recovery.conf when standby_mode = on:\n"
|
||||
" archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
|
||||
"e.g.\n"
|
||||
" archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n");
|
||||
printf("\n"
|
||||
"or for use as a standalone archive cleaner:\n"
|
||||
"or for use as a standalone archive cleaner:\n"
|
||||
"e.g.\n"
|
||||
" pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup\n");
|
||||
printf("\nOptions:\n");
|
||||
@ -258,9 +261,10 @@ main(int argc, char **argv)
|
||||
|
||||
/*
|
||||
* We will go to the archiveLocation to check restartWALFileName.
|
||||
* restartWALFileName may not exist anymore, which would not be an error, so
|
||||
* we separate the archiveLocation and restartWALFileName so we can check
|
||||
* separately whether archiveLocation exists, if not that is an error
|
||||
* restartWALFileName may not exist anymore, which would not be an error,
|
||||
* so we separate the archiveLocation and restartWALFileName so we can
|
||||
* check separately whether archiveLocation exists, if not that is an
|
||||
* error
|
||||
*/
|
||||
if (optind < argc)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
* server checks and output routines
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/check.c,v 1.10 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/check.c,v 1.11 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -152,8 +152,8 @@ issue_warnings(migratorContext *ctx, char *sequence_script_file_name)
|
||||
{
|
||||
prep_status(ctx, "Adjusting sequences");
|
||||
exec_prog(ctx, true,
|
||||
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on --port %d "
|
||||
"--username \"%s\" -f \"%s\" --dbname template1 >> \"%s\""
|
||||
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on --port %d "
|
||||
"--username \"%s\" -f \"%s\" --dbname template1 >> \"%s\""
|
||||
SYSTEMQUOTE,
|
||||
ctx->new.bindir, ctx->new.port, ctx->user,
|
||||
sequence_script_file_name, ctx->logfile);
|
||||
@ -217,7 +217,7 @@ check_cluster_versions(migratorContext *ctx)
|
||||
/* Only current PG version is supported as a target */
|
||||
if (GET_MAJOR_VERSION(ctx->new.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM))
|
||||
pg_log(ctx, PG_FATAL, "This utility can only upgrade to PostgreSQL version %s.\n",
|
||||
PG_MAJORVERSION);
|
||||
PG_MAJORVERSION);
|
||||
|
||||
/*
|
||||
* We can't allow downgrading because we use the target pg_dumpall, and
|
||||
@ -375,7 +375,7 @@ check_new_db_is_empty(migratorContext *ctx)
|
||||
*/
|
||||
void
|
||||
create_script_for_old_cluster_deletion(migratorContext *ctx,
|
||||
char **deletion_script_file_name)
|
||||
char **deletion_script_file_name)
|
||||
{
|
||||
FILE *script = NULL;
|
||||
int tblnum;
|
||||
@ -389,7 +389,7 @@ create_script_for_old_cluster_deletion(migratorContext *ctx,
|
||||
|
||||
if ((script = fopen(*deletion_script_file_name, "w")) == NULL)
|
||||
pg_log(ctx, PG_FATAL, "Could not create necessary file: %s\n",
|
||||
*deletion_script_file_name);
|
||||
*deletion_script_file_name);
|
||||
|
||||
#ifndef WIN32
|
||||
/* add shebang header */
|
||||
@ -420,6 +420,7 @@ create_script_for_old_cluster_deletion(migratorContext *ctx,
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
/*
|
||||
* Simply delete the tablespace directory, which might be ".old"
|
||||
* or a version-specific subdirectory.
|
||||
@ -433,7 +434,7 @@ create_script_for_old_cluster_deletion(migratorContext *ctx,
|
||||
#ifndef WIN32
|
||||
if (chmod(*deletion_script_file_name, S_IRWXU) != 0)
|
||||
pg_log(ctx, PG_FATAL, "Could not add execute permission to file: %s\n",
|
||||
*deletion_script_file_name);
|
||||
*deletion_script_file_name);
|
||||
#endif
|
||||
|
||||
check_ok(ctx);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* controldata functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/controldata.c,v 1.8 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/controldata.c,v 1.9 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -93,6 +93,7 @@ get_control_data(migratorContext *ctx, ClusterInfo *cluster, bool live_check)
|
||||
fputs(bufin, ctx->debug_fd);
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* Due to an installer bug, LANG=C doesn't work for PG 8.3.3, but does
|
||||
* work 8.2.6 and 8.3.7, so check for non-ASCII output and suggest a
|
||||
|
@ -4,7 +4,7 @@
|
||||
* dump functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/dump.c,v 1.6 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/dump.c,v 1.7 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -24,7 +24,7 @@ generate_old_dump(migratorContext *ctx)
|
||||
exec_prog(ctx, true,
|
||||
SYSTEMQUOTE "\"%s/pg_dumpall\" --port %d --username \"%s\" "
|
||||
"--schema-only --binary-upgrade > \"%s/" ALL_DUMP_FILE "\""
|
||||
SYSTEMQUOTE, ctx->new.bindir, ctx->old.port, ctx->user, ctx->cwd);
|
||||
SYSTEMQUOTE, ctx->new.bindir, ctx->old.port, ctx->user, ctx->cwd);
|
||||
check_ok(ctx);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* execution functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/exec.c,v 1.7 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/exec.c,v 1.8 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
static void checkBinDir(migratorContext *ctx, ClusterInfo *cluster);
|
||||
static int check_exec(migratorContext *ctx, const char *dir, const char *cmdName);
|
||||
static int check_exec(migratorContext *ctx, const char *dir, const char *cmdName);
|
||||
static const char *validate_exec(const char *path);
|
||||
static int check_data_dir(migratorContext *ctx, const char *pg_data);
|
||||
|
||||
@ -311,5 +311,3 @@ check_data_dir(migratorContext *ctx, const char *pg_data)
|
||||
|
||||
return (fail) ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* file system operations
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/file.c,v 1.12 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/file.c,v 1.13 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -226,7 +226,7 @@ copy_file(const char *srcfile, const char *dstfile, bool force)
|
||||
*/
|
||||
int
|
||||
pg_scandir(migratorContext *ctx, const char *dirname,
|
||||
struct dirent ***namelist,
|
||||
struct dirent *** namelist,
|
||||
int (*selector) (const struct dirent *))
|
||||
{
|
||||
#ifndef HAVE_SCANDIR
|
||||
@ -235,13 +235,14 @@ pg_scandir(migratorContext *ctx, const char *dirname,
|
||||
/*
|
||||
* scandir() is originally from BSD 4.3, which had the third argument as
|
||||
* non-const. Linux and other C libraries have updated it to use a const.
|
||||
* http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2005-12/msg00214.html
|
||||
* http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2005-12/msg002
|
||||
* 14.html
|
||||
*
|
||||
* Here we try to guess which libc's need const, and which don't. The net
|
||||
* goal here is to try to suppress a compiler warning due to a prototype
|
||||
* mismatch of const usage. Ideally we would do this via autoconf, but
|
||||
* autoconf doesn't have a suitable builtin test and it seems overkill
|
||||
* to add one just to avoid a warning.
|
||||
* autoconf doesn't have a suitable builtin test and it seems overkill to
|
||||
* add one just to avoid a warning.
|
||||
*/
|
||||
#elif defined(__FreeBSD__) || defined(__bsdi__) || defined(__darwin__) || defined(__OpenBSD__)
|
||||
/* no const */
|
||||
|
@ -4,7 +4,7 @@
|
||||
* information support functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/info.c,v 1.10 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/info.c,v 1.11 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -18,12 +18,12 @@ static void dbarr_print(migratorContext *ctx, DbInfoArr *arr,
|
||||
Cluster whichCluster);
|
||||
static void relarr_print(migratorContext *ctx, RelInfoArr *arr);
|
||||
static void get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo,
|
||||
RelInfoArr *relarr, Cluster whichCluster);
|
||||
RelInfoArr *relarr, Cluster whichCluster);
|
||||
static void relarr_free(RelInfoArr *rel_arr);
|
||||
static void map_rel(migratorContext *ctx, const RelInfo *oldrel,
|
||||
const RelInfo *newrel, const DbInfo *old_db,
|
||||
const DbInfo *new_db, const char *olddata,
|
||||
const char *newdata, FileNameMap *map);
|
||||
const RelInfo *newrel, const DbInfo *old_db,
|
||||
const DbInfo *new_db, const char *olddata,
|
||||
const char *newdata, FileNameMap *map);
|
||||
static void map_rel_by_id(migratorContext *ctx, Oid oldid, Oid newid,
|
||||
const char *old_nspname, const char *old_relname,
|
||||
const char *new_nspname, const char *new_relname,
|
||||
@ -31,10 +31,10 @@ static void map_rel_by_id(migratorContext *ctx, Oid oldid, Oid newid,
|
||||
const DbInfo *new_db, const char *olddata,
|
||||
const char *newdata, FileNameMap *map);
|
||||
static RelInfo *relarr_lookup_reloid(migratorContext *ctx,
|
||||
RelInfoArr *rel_arr, Oid oid, Cluster whichCluster);
|
||||
RelInfoArr *rel_arr, Oid oid, Cluster whichCluster);
|
||||
static RelInfo *relarr_lookup_rel(migratorContext *ctx, RelInfoArr *rel_arr,
|
||||
const char *nspname, const char *relname,
|
||||
Cluster whichCluster);
|
||||
const char *nspname, const char *relname,
|
||||
Cluster whichCluster);
|
||||
|
||||
|
||||
/*
|
||||
@ -226,13 +226,13 @@ get_db_infos(migratorContext *ctx, DbInfoArr *dbinfs_arr, Cluster whichCluster)
|
||||
int i_oid;
|
||||
int i_spclocation;
|
||||
|
||||
res = executeQueryOrDie(ctx, conn,
|
||||
"SELECT d.oid, d.datname, t.spclocation "
|
||||
"FROM pg_catalog.pg_database d "
|
||||
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
|
||||
" ON d.dattablespace = t.oid "
|
||||
"WHERE d.datallowconn = true");
|
||||
|
||||
res = executeQueryOrDie(ctx, conn,
|
||||
"SELECT d.oid, d.datname, t.spclocation "
|
||||
"FROM pg_catalog.pg_database d "
|
||||
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
|
||||
" ON d.dattablespace = t.oid "
|
||||
"WHERE d.datallowconn = true");
|
||||
|
||||
i_datname = PQfnumber(res, "datname");
|
||||
i_oid = PQfnumber(res, "oid");
|
||||
i_spclocation = PQfnumber(res, "spclocation");
|
||||
@ -358,7 +358,7 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo,
|
||||
for (relnum = 0; relnum < ntups; relnum++)
|
||||
{
|
||||
RelInfo *curr = &relinfos[num_rels++];
|
||||
const char *tblspace;
|
||||
const char *tblspace;
|
||||
|
||||
curr->reloid = atol(PQgetvalue(res, relnum, i_oid));
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* options functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/option.c,v 1.11 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/option.c,v 1.12 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -52,7 +52,7 @@ parseCommandLine(migratorContext *ctx, int argc, char *argv[])
|
||||
int option; /* Command line option */
|
||||
int optindex = 0; /* used by getopt_long */
|
||||
int user_id;
|
||||
|
||||
|
||||
if (getenv("PGUSER"))
|
||||
{
|
||||
pg_free(ctx->user);
|
||||
@ -68,7 +68,7 @@ parseCommandLine(migratorContext *ctx, int argc, char *argv[])
|
||||
|
||||
/* user lookup and 'root' test must be split because of usage() */
|
||||
user_id = get_user_info(ctx, &ctx->user);
|
||||
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ||
|
||||
@ -303,7 +303,7 @@ validateDirectoryOption(migratorContext *ctx, char **dirpath,
|
||||
if ((*dirpath)[strlen(*dirpath) - 1] == '/')
|
||||
#else
|
||||
if ((*dirpath)[strlen(*dirpath) - 1] == '/' ||
|
||||
(*dirpath)[strlen(*dirpath) - 1] == '\\')
|
||||
(*dirpath)[strlen(*dirpath) - 1] == '\\')
|
||||
#endif
|
||||
(*dirpath)[strlen(*dirpath) - 1] = 0;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* main source file
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/pg_upgrade.c,v 1.9 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/pg_upgrade.c,v 1.10 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -82,7 +82,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
prep_status(&ctx, "Setting next oid for new cluster");
|
||||
exec_prog(&ctx, true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -o %u \"%s\" > "
|
||||
DEVNULL SYSTEMQUOTE,
|
||||
DEVNULL SYSTEMQUOTE,
|
||||
ctx.new.bindir, ctx.old.controldata.chkpnt_nxtoid, ctx.new.pgdata);
|
||||
check_ok(&ctx);
|
||||
|
||||
@ -166,10 +166,10 @@ prepare_new_cluster(migratorContext *ctx)
|
||||
check_ok(ctx);
|
||||
|
||||
/*
|
||||
* We do freeze after analyze so pg_statistic is also frozen.
|
||||
* template0 is not frozen here, but data rows were frozen by initdb,
|
||||
* and we set its datfrozenxid and relfrozenxids later to match the
|
||||
* new xid counter later.
|
||||
* We do freeze after analyze so pg_statistic is also frozen. template0 is
|
||||
* not frozen here, but data rows were frozen by initdb, and we set its
|
||||
* datfrozenxid and relfrozenxids later to match the new xid counter
|
||||
* later.
|
||||
*/
|
||||
prep_status(ctx, "Freezing all rows on the new cluster");
|
||||
exec_prog(ctx, true,
|
||||
@ -203,7 +203,7 @@ prepare_new_databases(migratorContext *ctx)
|
||||
prep_status(ctx, "Creating databases in the new cluster");
|
||||
exec_prog(ctx, true,
|
||||
SYSTEMQUOTE "\"%s/psql\" --port %d --username \"%s\" "
|
||||
"--set ON_ERROR_STOP=on -f \"%s/%s\" --dbname template1 >> \"%s\""
|
||||
"--set ON_ERROR_STOP=on -f \"%s/%s\" --dbname template1 >> \"%s\""
|
||||
SYSTEMQUOTE,
|
||||
ctx->new.bindir, ctx->new.port, ctx->user, ctx->cwd,
|
||||
GLOBALS_DUMP_FILE, ctx->logfile);
|
||||
@ -226,9 +226,9 @@ create_new_objects(migratorContext *ctx)
|
||||
prep_status(ctx, "Restoring database schema to new cluster");
|
||||
exec_prog(ctx, true,
|
||||
SYSTEMQUOTE "\"%s/psql\" --port %d --username \"%s\" "
|
||||
"--set ON_ERROR_STOP=on -f \"%s/%s\" --dbname template1 >> \"%s\""
|
||||
"--set ON_ERROR_STOP=on -f \"%s/%s\" --dbname template1 >> \"%s\""
|
||||
SYSTEMQUOTE,
|
||||
ctx->new.bindir, ctx->new.port, ctx->user, ctx->cwd,
|
||||
ctx->new.bindir, ctx->new.port, ctx->user, ctx->cwd,
|
||||
DB_DUMP_FILE, ctx->logfile);
|
||||
check_ok(ctx);
|
||||
|
||||
@ -300,7 +300,8 @@ void
|
||||
set_frozenxids(migratorContext *ctx)
|
||||
{
|
||||
int dbnum;
|
||||
PGconn *conn, *conn_template1;
|
||||
PGconn *conn,
|
||||
*conn_template1;
|
||||
PGresult *dbres;
|
||||
int ntups;
|
||||
int i_datname;
|
||||
@ -327,21 +328,21 @@ set_frozenxids(migratorContext *ctx)
|
||||
ntups = PQntuples(dbres);
|
||||
for (dbnum = 0; dbnum < ntups; dbnum++)
|
||||
{
|
||||
char *datname = PQgetvalue(dbres, dbnum, i_datname);
|
||||
char *datallowconn= PQgetvalue(dbres, dbnum, i_datallowconn);
|
||||
char *datname = PQgetvalue(dbres, dbnum, i_datname);
|
||||
char *datallowconn = PQgetvalue(dbres, dbnum, i_datallowconn);
|
||||
|
||||
/*
|
||||
* We must update databases where datallowconn = false, e.g.
|
||||
* template0, because autovacuum increments their datfrozenxids and
|
||||
* relfrozenxids even if autovacuum is turned off, and even though
|
||||
* all the data rows are already frozen To enable this, we
|
||||
* temporarily change datallowconn.
|
||||
* We must update databases where datallowconn = false, e.g.
|
||||
* template0, because autovacuum increments their datfrozenxids and
|
||||
* relfrozenxids even if autovacuum is turned off, and even though all
|
||||
* the data rows are already frozen To enable this, we temporarily
|
||||
* change datallowconn.
|
||||
*/
|
||||
if (strcmp(datallowconn, "f") == 0)
|
||||
PQclear(executeQueryOrDie(ctx, conn_template1,
|
||||
"UPDATE pg_catalog.pg_database "
|
||||
"SET datallowconn = true "
|
||||
"WHERE datname = '%s'", datname));
|
||||
"UPDATE pg_catalog.pg_database "
|
||||
"SET datallowconn = true "
|
||||
"WHERE datname = '%s'", datname));
|
||||
|
||||
conn = connectToServer(ctx, datname, CLUSTER_NEW);
|
||||
|
||||
@ -357,9 +358,9 @@ set_frozenxids(migratorContext *ctx)
|
||||
/* Reset datallowconn flag */
|
||||
if (strcmp(datallowconn, "f") == 0)
|
||||
PQclear(executeQueryOrDie(ctx, conn_template1,
|
||||
"UPDATE pg_catalog.pg_database "
|
||||
"SET datallowconn = false "
|
||||
"WHERE datname = '%s'", datname));
|
||||
"UPDATE pg_catalog.pg_database "
|
||||
"SET datallowconn = false "
|
||||
"WHERE datname = '%s'", datname));
|
||||
}
|
||||
|
||||
PQclear(dbres);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* pg_upgrade.h
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/pg_upgrade.h,v 1.14 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/pg_upgrade.h,v 1.15 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
@ -21,7 +21,7 @@
|
||||
#define MAX_STRING 1024
|
||||
#define LINE_ALLOC 4096
|
||||
#define QUERY_ALLOC 8192
|
||||
|
||||
|
||||
#define MIGRATOR_API_VERSION 1
|
||||
|
||||
#define MESSAGE_WIDTH "60"
|
||||
@ -53,19 +53,19 @@
|
||||
#define CLUSTERNAME(cluster) ((cluster) == CLUSTER_OLD ? "old" : "new")
|
||||
|
||||
/* OID system catalog preservation added during PG 9.0 development */
|
||||
#define TABLE_SPACE_SUBDIRS 201001111
|
||||
#define TABLE_SPACE_SUBDIRS 201001111
|
||||
|
||||
/*
|
||||
* Each relation is represented by a relinfo structure.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char nspname[NAMEDATALEN]; /* namespace name */
|
||||
char relname[NAMEDATALEN]; /* relation name */
|
||||
char nspname[NAMEDATALEN]; /* namespace name */
|
||||
char relname[NAMEDATALEN]; /* relation name */
|
||||
Oid reloid; /* relation oid */
|
||||
Oid relfilenode; /* relation relfile node */
|
||||
Oid toastrelid; /* oid of the toast relation */
|
||||
char tablespace[MAXPGPATH]; /* relations tablespace path */
|
||||
char tablespace[MAXPGPATH]; /* relations tablespace path */
|
||||
} RelInfo;
|
||||
|
||||
typedef struct
|
||||
@ -83,10 +83,10 @@ typedef struct
|
||||
Oid new; /* Relfilenode of the new relation */
|
||||
char old_file[MAXPGPATH];
|
||||
char new_file[MAXPGPATH];
|
||||
char old_nspname[NAMEDATALEN]; /* old name of the namespace */
|
||||
char old_relname[NAMEDATALEN]; /* old name of the relation */
|
||||
char new_nspname[NAMEDATALEN]; /* new name of the namespace */
|
||||
char new_relname[NAMEDATALEN]; /* new name of the relation */
|
||||
char old_nspname[NAMEDATALEN]; /* old name of the namespace */
|
||||
char old_relname[NAMEDATALEN]; /* old name of the relation */
|
||||
char new_nspname[NAMEDATALEN]; /* new name of the namespace */
|
||||
char new_relname[NAMEDATALEN]; /* new name of the relation */
|
||||
} FileNameMap;
|
||||
|
||||
/*
|
||||
@ -161,7 +161,7 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NONE = 0, /* used for no running servers */
|
||||
NONE = 0, /* used for no running servers */
|
||||
CLUSTER_OLD,
|
||||
CLUSTER_NEW
|
||||
} Cluster;
|
||||
@ -177,15 +177,15 @@ typedef long pgpid_t;
|
||||
typedef struct
|
||||
{
|
||||
ControlData controldata; /* pg_control information */
|
||||
DbInfoArr dbarr; /* dbinfos array */
|
||||
char *pgdata; /* pathname for cluster's $PGDATA directory */
|
||||
char *bindir; /* pathname for cluster's executable directory */
|
||||
unsigned short port; /* port number where postmaster is waiting */
|
||||
uint32 major_version; /* PG_VERSION of cluster */
|
||||
char *major_version_str; /* string PG_VERSION of cluster */
|
||||
Oid pg_database_oid; /* OID of pg_database relation */
|
||||
char *libpath; /* pathname for cluster's pkglibdir */
|
||||
char *tablespace_suffix; /* directory specification */
|
||||
DbInfoArr dbarr; /* dbinfos array */
|
||||
char *pgdata; /* pathname for cluster's $PGDATA directory */
|
||||
char *bindir; /* pathname for cluster's executable directory */
|
||||
unsigned short port; /* port number where postmaster is waiting */
|
||||
uint32 major_version; /* PG_VERSION of cluster */
|
||||
char *major_version_str; /* string PG_VERSION of cluster */
|
||||
Oid pg_database_oid; /* OID of pg_database relation */
|
||||
char *libpath; /* pathname for cluster's pkglibdir */
|
||||
char *tablespace_suffix; /* directory specification */
|
||||
} ClusterInfo;
|
||||
|
||||
|
||||
@ -197,11 +197,12 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ClusterInfo old, new; /* old and new cluster information */
|
||||
ClusterInfo old,
|
||||
new; /* old and new cluster information */
|
||||
const char *progname; /* complete pathname for this program */
|
||||
char *exec_path; /* full path to my executable */
|
||||
char *user; /* username for clusters */
|
||||
char cwd[MAXPGPATH]; /* current working directory, used for output */
|
||||
char cwd[MAXPGPATH]; /* current working directory, used for output */
|
||||
char **tablespaces; /* tablespaces */
|
||||
int num_tablespaces;
|
||||
char **libraries; /* loadable libraries */
|
||||
@ -216,37 +217,37 @@ typedef struct
|
||||
* changes */
|
||||
bool verbose; /* TRUE -> be verbose in messages */
|
||||
bool debug; /* TRUE -> log more information */
|
||||
transferMode transfer_mode; /* copy files or link them? */
|
||||
transferMode transfer_mode; /* copy files or link them? */
|
||||
} migratorContext;
|
||||
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
extern char scandir_file_pattern[];
|
||||
extern char scandir_file_pattern[];
|
||||
|
||||
|
||||
/* check.c */
|
||||
|
||||
void output_check_banner(migratorContext *ctx, bool *live_check);
|
||||
void check_old_cluster(migratorContext *ctx, bool live_check,
|
||||
char **sequence_script_file_name);
|
||||
void check_old_cluster(migratorContext *ctx, bool live_check,
|
||||
char **sequence_script_file_name);
|
||||
void check_new_cluster(migratorContext *ctx);
|
||||
void report_clusters_compatible(migratorContext *ctx);
|
||||
void issue_warnings(migratorContext *ctx,
|
||||
char *sequence_script_file_name);
|
||||
void output_completion_banner(migratorContext *ctx,
|
||||
char *deletion_script_file_name);
|
||||
void issue_warnings(migratorContext *ctx,
|
||||
char *sequence_script_file_name);
|
||||
void output_completion_banner(migratorContext *ctx,
|
||||
char *deletion_script_file_name);
|
||||
void check_cluster_versions(migratorContext *ctx);
|
||||
void check_cluster_compatibility(migratorContext *ctx, bool live_check);
|
||||
void create_script_for_old_cluster_deletion(migratorContext *ctx,
|
||||
char **deletion_script_file_name);
|
||||
void create_script_for_old_cluster_deletion(migratorContext *ctx,
|
||||
char **deletion_script_file_name);
|
||||
|
||||
|
||||
/* controldata.c */
|
||||
|
||||
void get_control_data(migratorContext *ctx, ClusterInfo *cluster, bool live_check);
|
||||
void check_control_data(migratorContext *ctx, ControlData *oldctrl,
|
||||
void check_control_data(migratorContext *ctx, ControlData *oldctrl,
|
||||
ControlData *newctrl);
|
||||
|
||||
|
||||
@ -258,8 +259,8 @@ void split_old_dump(migratorContext *ctx);
|
||||
|
||||
/* exec.c */
|
||||
|
||||
int exec_prog(migratorContext *ctx, bool throw_error,
|
||||
const char *cmd,...);
|
||||
int exec_prog(migratorContext *ctx, bool throw_error,
|
||||
const char *cmd,...);
|
||||
void verify_directories(migratorContext *ctx);
|
||||
bool is_server_running(migratorContext *ctx, const char *datadir);
|
||||
void rename_old_pg_control(migratorContext *ctx);
|
||||
@ -279,31 +280,28 @@ typedef const char *(*pluginShutdown) (void *pluginData);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16 oldPageVersion; /* Page layout version of the old
|
||||
* cluster */
|
||||
uint16 newPageVersion; /* Page layout version of the new
|
||||
* cluster */
|
||||
uint16 oldPageVersion; /* Page layout version of the old cluster */
|
||||
uint16 newPageVersion; /* Page layout version of the new cluster */
|
||||
uint16 pluginVersion; /* API version of converter plugin */
|
||||
void *pluginData; /* Plugin data (set by plugin) */
|
||||
pluginStartup startup; /* Pointer to plugin's startup function */
|
||||
pluginConvertFile convertFile; /* Pointer to plugin's file converter
|
||||
void *pluginData; /* Plugin data (set by plugin) */
|
||||
pluginStartup startup; /* Pointer to plugin's startup function */
|
||||
pluginConvertFile convertFile; /* Pointer to plugin's file converter
|
||||
* function */
|
||||
pluginConvertPage convertPage; /* Pointer to plugin's page converter
|
||||
pluginConvertPage convertPage; /* Pointer to plugin's page converter
|
||||
* function */
|
||||
pluginShutdown shutdown; /* Pointer to plugin's shutdown function */
|
||||
} pageCnvCtx;
|
||||
|
||||
const char *setupPageConverter(migratorContext *ctx, pageCnvCtx **result);
|
||||
|
||||
#else
|
||||
/* dummy */
|
||||
typedef void *pageCnvCtx;
|
||||
#endif
|
||||
|
||||
int dir_matching_filenames(const struct dirent *scan_ent);
|
||||
int pg_scandir(migratorContext *ctx, const char *dirname,
|
||||
struct dirent ***namelist,
|
||||
int (*selector) (const struct dirent *));
|
||||
int dir_matching_filenames(const struct dirent * scan_ent);
|
||||
int pg_scandir(migratorContext *ctx, const char *dirname,
|
||||
struct dirent *** namelist,
|
||||
int (*selector) (const struct dirent *));
|
||||
const char *copyAndUpdateFile(migratorContext *ctx,
|
||||
pageCnvCtx *pageConverter, const char *src,
|
||||
const char *dst, bool force);
|
||||
@ -315,21 +313,21 @@ void check_hard_link(migratorContext *ctx);
|
||||
/* function.c */
|
||||
|
||||
void install_support_functions(migratorContext *ctx);
|
||||
void uninstall_support_functions(migratorContext *ctx);
|
||||
void uninstall_support_functions(migratorContext *ctx);
|
||||
void get_loadable_libraries(migratorContext *ctx);
|
||||
void check_loadable_libraries(migratorContext *ctx);
|
||||
|
||||
/* info.c */
|
||||
|
||||
FileNameMap *gen_db_file_maps(migratorContext *ctx, DbInfo *old_db,
|
||||
DbInfo *new_db, int *nmaps, const char *old_pgdata,
|
||||
const char *new_pgdata);
|
||||
void get_db_and_rel_infos(migratorContext *ctx, DbInfoArr *db_arr,
|
||||
Cluster whichCluster);
|
||||
DbInfo *new_db, int *nmaps, const char *old_pgdata,
|
||||
const char *new_pgdata);
|
||||
void get_db_and_rel_infos(migratorContext *ctx, DbInfoArr *db_arr,
|
||||
Cluster whichCluster);
|
||||
DbInfo *dbarr_lookup_db(DbInfoArr *db_arr, const char *db_name);
|
||||
void dbarr_free(DbInfoArr *db_arr);
|
||||
void print_maps(migratorContext *ctx, FileNameMap *maps, int n,
|
||||
const char *dbName);
|
||||
void print_maps(migratorContext *ctx, FileNameMap *maps, int n,
|
||||
const char *dbName);
|
||||
|
||||
/* option.c */
|
||||
|
||||
@ -349,15 +347,15 @@ void init_tablespaces(migratorContext *ctx);
|
||||
|
||||
/* server.c */
|
||||
|
||||
PGconn *connectToServer(migratorContext *ctx, const char *db_name,
|
||||
PGconn *connectToServer(migratorContext *ctx, const char *db_name,
|
||||
Cluster whichCluster);
|
||||
PGresult *executeQueryOrDie(migratorContext *ctx, PGconn *conn,
|
||||
PGresult *executeQueryOrDie(migratorContext *ctx, PGconn *conn,
|
||||
const char *fmt,...);
|
||||
|
||||
void start_postmaster(migratorContext *ctx, Cluster whichCluster, bool quiet);
|
||||
void start_postmaster(migratorContext *ctx, Cluster whichCluster, bool quiet);
|
||||
void stop_postmaster(migratorContext *ctx, bool fast, bool quiet);
|
||||
uint32 get_major_server_version(migratorContext *ctx, char **verstr,
|
||||
Cluster whichCluster);
|
||||
uint32 get_major_server_version(migratorContext *ctx, char **verstr,
|
||||
Cluster whichCluster);
|
||||
void check_for_libpq_envvars(migratorContext *ctx);
|
||||
|
||||
|
||||
@ -381,22 +379,22 @@ const char *getErrorText(int errNum);
|
||||
|
||||
/* version.c */
|
||||
|
||||
void new_9_0_populate_pg_largeobject_metadata(migratorContext *ctx,
|
||||
bool check_mode, Cluster whichCluster);
|
||||
void new_9_0_populate_pg_largeobject_metadata(migratorContext *ctx,
|
||||
bool check_mode, Cluster whichCluster);
|
||||
|
||||
/* version_old_8_3.c */
|
||||
|
||||
void old_8_3_check_for_name_data_type_usage(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
void old_8_3_check_for_tsquery_usage(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
void old_8_3_check_for_isn_and_int8_passing_mismatch(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
void old_8_3_rebuild_tsvector_tables(migratorContext *ctx,
|
||||
bool check_mode, Cluster whichCluster);
|
||||
void old_8_3_invalidate_hash_gin_indexes(migratorContext *ctx,
|
||||
bool check_mode, Cluster whichCluster);
|
||||
void old_8_3_invalidate_bpchar_pattern_ops_indexes(migratorContext *ctx,
|
||||
bool check_mode, Cluster whichCluster);
|
||||
char *old_8_3_create_sequence_script(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
void old_8_3_check_for_name_data_type_usage(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
void old_8_3_check_for_tsquery_usage(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
void old_8_3_check_for_isn_and_int8_passing_mismatch(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
void old_8_3_rebuild_tsvector_tables(migratorContext *ctx,
|
||||
bool check_mode, Cluster whichCluster);
|
||||
void old_8_3_invalidate_hash_gin_indexes(migratorContext *ctx,
|
||||
bool check_mode, Cluster whichCluster);
|
||||
void old_8_3_invalidate_bpchar_pattern_ops_indexes(migratorContext *ctx,
|
||||
bool check_mode, Cluster whichCluster);
|
||||
char *old_8_3_create_sequence_script(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* relfilenode functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/relfilenode.c,v 1.7 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/relfilenode.c,v 1.8 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -21,8 +21,8 @@ static void transfer_relfile(migratorContext *ctx, pageCnvCtx *pageConverter,
|
||||
const char *newnspname, const char *newrelname);
|
||||
|
||||
/* used by scandir(), must be global */
|
||||
char scandir_file_pattern[MAXPGPATH];
|
||||
|
||||
char scandir_file_pattern[MAXPGPATH];
|
||||
|
||||
/*
|
||||
* transfer_all_new_dbs()
|
||||
*
|
||||
|
@ -4,7 +4,7 @@
|
||||
* database server functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/server.c,v 1.7 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/server.c,v 1.8 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -181,11 +181,11 @@ start_postmaster(migratorContext *ctx, Cluster whichCluster, bool quiet)
|
||||
}
|
||||
|
||||
/*
|
||||
* On Win32, we can't send both server 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 pg_ctl output to 'nul'.
|
||||
*/
|
||||
* On Win32, we can't send both server 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 pg_ctl
|
||||
* output to 'nul'.
|
||||
*/
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" "
|
||||
"-o \"-p %d -c autovacuum=off "
|
||||
@ -233,13 +233,13 @@ stop_postmaster(migratorContext *ctx, bool fast, bool quiet)
|
||||
|
||||
/* See comment in start_postmaster() about why win32 output is ignored. */
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> "
|
||||
"\"%s\" 2>&1" SYSTEMQUOTE,
|
||||
bindir, ctx->logfile, datadir, fast ? "-m fast" : "",
|
||||
SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> "
|
||||
"\"%s\" 2>&1" SYSTEMQUOTE,
|
||||
bindir, ctx->logfile, datadir, fast ? "-m fast" : "",
|
||||
#ifndef WIN32
|
||||
ctx->logfile);
|
||||
ctx->logfile);
|
||||
#else
|
||||
DEVNULL);
|
||||
DEVNULL);
|
||||
#endif
|
||||
exec_prog(ctx, fast ? false : true, "%s", cmd);
|
||||
|
||||
|
@ -4,14 +4,14 @@
|
||||
* tablespace functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/tablespace.c,v 1.5 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/tablespace.c,v 1.6 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
|
||||
static void get_tablespace_paths(migratorContext *ctx);
|
||||
static void set_tablespace_directory_suffix(migratorContext *ctx,
|
||||
Cluster whichCluster);
|
||||
Cluster whichCluster);
|
||||
|
||||
|
||||
void
|
||||
@ -52,7 +52,7 @@ get_tablespace_paths(migratorContext *ctx)
|
||||
|
||||
if ((ctx->num_tablespaces = PQntuples(res)) != 0)
|
||||
ctx->tablespaces = (char **) pg_malloc(ctx,
|
||||
ctx->num_tablespaces * sizeof(char *));
|
||||
ctx->num_tablespaces * sizeof(char *));
|
||||
else
|
||||
ctx->tablespaces = NULL;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* utility functions
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/util.c,v 1.4 2010/07/03 16:33:14 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade/util.c,v 1.5 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "pg_upgrade.h"
|
||||
@ -156,8 +156,8 @@ quote_identifier(migratorContext *ctx, const char *s)
|
||||
int
|
||||
get_user_info(migratorContext *ctx, char **user_name)
|
||||
{
|
||||
int user_id;
|
||||
|
||||
int user_id;
|
||||
|
||||
#ifndef WIN32
|
||||
struct passwd *pw = getpwuid(geteuid());
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* to control oid and relfilenode assignment
|
||||
*
|
||||
* Copyright (c) 2010, PostgreSQL Global Development Group
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade_support/pg_upgrade_support.c,v 1.4 2010/07/03 16:33:15 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pg_upgrade_support/pg_upgrade_support.c,v 1.5 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
@ -21,7 +21,7 @@
|
||||
* not be compiling against PG 9.0.
|
||||
*/
|
||||
extern void EnumValuesCreate(Oid enumTypeOid, List *vals,
|
||||
Oid binary_upgrade_next_pg_enum_oid);
|
||||
Oid binary_upgrade_next_pg_enum_oid);
|
||||
|
||||
#ifdef PG_MODULE_MAGIC
|
||||
PG_MODULE_MAGIC;
|
||||
@ -34,13 +34,13 @@ extern PGDLLIMPORT Oid binary_upgrade_next_heap_relfilenode;
|
||||
extern PGDLLIMPORT Oid binary_upgrade_next_toast_relfilenode;
|
||||
extern PGDLLIMPORT Oid binary_upgrade_next_index_relfilenode;
|
||||
|
||||
Datum set_next_pg_type_oid(PG_FUNCTION_ARGS);
|
||||
Datum set_next_pg_type_array_oid(PG_FUNCTION_ARGS);
|
||||
Datum set_next_pg_type_toast_oid(PG_FUNCTION_ARGS);
|
||||
Datum set_next_heap_relfilenode(PG_FUNCTION_ARGS);
|
||||
Datum set_next_toast_relfilenode(PG_FUNCTION_ARGS);
|
||||
Datum set_next_index_relfilenode(PG_FUNCTION_ARGS);
|
||||
Datum add_pg_enum_label(PG_FUNCTION_ARGS);
|
||||
Datum set_next_pg_type_oid(PG_FUNCTION_ARGS);
|
||||
Datum set_next_pg_type_array_oid(PG_FUNCTION_ARGS);
|
||||
Datum set_next_pg_type_toast_oid(PG_FUNCTION_ARGS);
|
||||
Datum set_next_heap_relfilenode(PG_FUNCTION_ARGS);
|
||||
Datum set_next_toast_relfilenode(PG_FUNCTION_ARGS);
|
||||
Datum set_next_index_relfilenode(PG_FUNCTION_ARGS);
|
||||
Datum add_pg_enum_label(PG_FUNCTION_ARGS);
|
||||
|
||||
PG_FUNCTION_INFO_V1(set_next_pg_type_oid);
|
||||
PG_FUNCTION_INFO_V1(set_next_pg_type_array_oid);
|
||||
@ -115,11 +115,10 @@ add_pg_enum_label(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid enumoid = PG_GETARG_OID(0);
|
||||
Oid typoid = PG_GETARG_OID(1);
|
||||
Name label = PG_GETARG_NAME(2);
|
||||
|
||||
Name label = PG_GETARG_NAME(2);
|
||||
|
||||
EnumValuesCreate(typoid, list_make1(makeString(NameStr(*label))),
|
||||
enumoid);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* A simple benchmark program for PostgreSQL
|
||||
* Originally written by Tatsuo Ishii and enhanced by many contributors.
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.98 2010/03/23 01:29:22 itagaki Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.99 2010/07/06 19:18:55 momjian Exp $
|
||||
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
||||
* ALL RIGHTS RESERVED;
|
||||
*
|
||||
@ -2161,7 +2161,7 @@ threadRun(void *arg)
|
||||
TState *thread = (TState *) arg;
|
||||
CState *state = thread->state;
|
||||
TResult *result;
|
||||
FILE *logfile = NULL; /* per-thread log file */
|
||||
FILE *logfile = NULL; /* per-thread log file */
|
||||
instr_time start,
|
||||
end;
|
||||
int nstate = thread->nstate;
|
||||
@ -2273,7 +2273,7 @@ threadRun(void *arg)
|
||||
goto done;
|
||||
}
|
||||
|
||||
FD_SET (sock, &input_mask);
|
||||
FD_SET(sock, &input_mask);
|
||||
|
||||
if (maxsock < sock)
|
||||
maxsock = sock;
|
||||
@ -2407,8 +2407,8 @@ pthread_create(pthread_t *thread,
|
||||
|
||||
/*
|
||||
* Set a different random seed in each child process. Otherwise they all
|
||||
* inherit the parent's state and generate the same "random" sequence.
|
||||
* (In the threaded case, the different threads will obtain subsets of the
|
||||
* inherit the parent's state and generate the same "random" sequence. (In
|
||||
* the threaded case, the different threads will obtain subsets of the
|
||||
* output of a single random() sequence, which should be okay for our
|
||||
* purposes.)
|
||||
*/
|
||||
@ -2484,7 +2484,7 @@ typedef struct win32_pthread
|
||||
void *(*routine) (void *);
|
||||
void *arg;
|
||||
void *result;
|
||||
} win32_pthread;
|
||||
} win32_pthread;
|
||||
|
||||
static unsigned __stdcall
|
||||
win32_pthread_run(void *arg)
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.12 2010/04/02 15:21:20 mha Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.13 2010/07/06 19:18:55 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
@ -98,7 +98,7 @@
|
||||
*
|
||||
* NOTE: The naming of R and S appears backwards here (R is a SHIFT and
|
||||
* S is a ROTATION) because the SHA-256/384/512 description document
|
||||
* (see http://www.iwar.org.uk/comsec/resources/cipher/sha256-384-512.pdf)
|
||||
* (see http://www.iwar.org.uk/comsec/resources/cipher/sha256-384-512.pdf)
|
||||
* uses this same "backwards" definition.
|
||||
*/
|
||||
/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.29 2010/03/03 19:10:22 tgl Exp $
|
||||
* $PostgreSQL: pgsql/contrib/xml2/xpath.c,v 1.30 2010/07/06 19:18:55 momjian Exp $
|
||||
*
|
||||
* Parser interface for DOM-based parser (libxml) rather than
|
||||
* stream-based SAX-type parser
|
||||
@ -631,8 +631,8 @@ xpath_table(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the parser. This should happen after we are done evaluating
|
||||
* the query, in case it calls functions that set up libxml differently.
|
||||
* Setup the parser. This should happen after we are done evaluating the
|
||||
* query, in case it calls functions that set up libxml differently.
|
||||
*/
|
||||
pgxml_parser_init();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $PostgreSQL: pgsql/contrib/xml2/xslt_proc.c,v 1.20 2010/03/03 19:10:22 tgl Exp $
|
||||
* $PostgreSQL: pgsql/contrib/xml2/xslt_proc.c,v 1.21 2010/07/06 19:18:55 momjian Exp $
|
||||
*
|
||||
* XSLT processing functions (requiring libxslt)
|
||||
*
|
||||
@ -28,8 +28,7 @@
|
||||
#include <libxslt/xsltInternals.h>
|
||||
#include <libxslt/transform.h>
|
||||
#include <libxslt/xsltutils.h>
|
||||
|
||||
#endif /* USE_LIBXSLT */
|
||||
#endif /* USE_LIBXSLT */
|
||||
|
||||
|
||||
/* externally accessible functions */
|
||||
@ -45,8 +44,7 @@ extern void pgxml_parser_init(void);
|
||||
static void parse_params(const char **params, text *paramstr);
|
||||
|
||||
#define MAXPARAMS 20 /* must be even, see parse_params() */
|
||||
|
||||
#endif /* USE_LIBXSLT */
|
||||
#endif /* USE_LIBXSLT */
|
||||
|
||||
|
||||
PG_FUNCTION_INFO_V1(xslt_process);
|
||||
@ -130,15 +128,13 @@ xslt_process(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_NULL();
|
||||
|
||||
PG_RETURN_TEXT_P(cstring_to_text_with_len((char *) resstr, reslen));
|
||||
|
||||
#else /* !USE_LIBXSLT */
|
||||
#else /* !USE_LIBXSLT */
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("xslt_process() is not available without libxslt")));
|
||||
PG_RETURN_NULL();
|
||||
|
||||
#endif /* USE_LIBXSLT */
|
||||
#endif /* USE_LIBXSLT */
|
||||
}
|
||||
|
||||
#ifdef USE_LIBXSLT
|
||||
@ -191,4 +187,4 @@ parse_params(const char **params, text *paramstr)
|
||||
params[i] = NULL;
|
||||
}
|
||||
|
||||
#endif /* USE_LIBXSLT */
|
||||
#endif /* USE_LIBXSLT */
|
||||
|
Reference in New Issue
Block a user