Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc1b6179

Browse files
committed
Add username designations to all pg_upgrade utility calls that support it.
1 parent601d1ee commitc1b6179

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

‎contrib/pg_upgrade/check.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,11 @@ issue_warnings(migratorContext *ctx, char *sequence_script_file_name)
149149
{
150150
prep_status(ctx,"Adjusting sequences");
151151
exec_prog(ctx, true,
152-
SYSTEMQUOTE"\"%s/psql\" --set ON_ERROR_STOP=on --port %d "
153-
"-f \"%s\" --dbname template1 >> \"%s\""SYSTEMQUOTE,
154-
ctx->new.bindir,ctx->new.port,sequence_script_file_name,
155-
ctx->logfile);
152+
SYSTEMQUOTE"\"%s/psql\" --set ON_ERROR_STOP=on --port %d "
153+
"--username \"%s\" -f \"%s\" --dbname template1 >> \"%s\""
154+
SYSTEMQUOTE,
155+
ctx->new.bindir,ctx->new.port,ctx->user,
156+
sequence_script_file_name,ctx->logfile);
156157
unlink(sequence_script_file_name);
157158
check_ok(ctx);
158159
}

‎contrib/pg_upgrade/pg_upgrade.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ main(int argc, char **argv)
7878
* because there is no need to have the schema load use new oids.
7979
*/
8080
prep_status(&ctx,"Setting next oid for new cluster");
81-
exec_prog(&ctx, true,SYSTEMQUOTE"\"%s/pg_resetxlog\" -o %u \"%s\" > "DEVNULLSYSTEMQUOTE,
81+
exec_prog(&ctx, true,SYSTEMQUOTE"\"%s/pg_resetxlog\" -o %u \"%s\" > "
82+
DEVNULLSYSTEMQUOTE,
8283
ctx.new.bindir,ctx.old.controldata.chkpnt_nxtoid,ctx.new.pgdata);
8384
check_ok(&ctx);
8485

@@ -156,8 +157,9 @@ prepare_new_cluster(migratorContext *ctx)
156157
*/
157158
prep_status(ctx,"Analyzing all rows in the new cluster");
158159
exec_prog(ctx, true,
159-
SYSTEMQUOTE"\"%s/vacuumdb\" --port %d --all --analyze >> %s 2>&1"SYSTEMQUOTE,
160-
ctx->new.bindir,ctx->new.port,ctx->logfile);
160+
SYSTEMQUOTE"\"%s/vacuumdb\" --port %d --username \"%s\" "
161+
"--all --analyze >> %s 2>&1"SYSTEMQUOTE,
162+
ctx->new.bindir,ctx->new.port,ctx->user,ctx->logfile);
161163
check_ok(ctx);
162164

163165
/*
@@ -168,8 +170,9 @@ prepare_new_cluster(migratorContext *ctx)
168170
*/
169171
prep_status(ctx,"Freezing all rows on the new cluster");
170172
exec_prog(ctx, true,
171-
SYSTEMQUOTE"\"%s/vacuumdb\" --port %d --all --freeze >> %s 2>&1"SYSTEMQUOTE,
172-
ctx->new.bindir,ctx->new.port,ctx->logfile);
173+
SYSTEMQUOTE"\"%s/vacuumdb\" --port %d --username \"%s\" "
174+
"--all --freeze >> %s 2>&1"SYSTEMQUOTE,
175+
ctx->new.bindir,ctx->new.port,ctx->user,ctx->logfile);
173176
check_ok(ctx);
174177

175178
get_pg_database_relfilenode(ctx,CLUSTER_NEW);
@@ -196,9 +199,10 @@ prepare_new_databases(migratorContext *ctx)
196199
*/
197200
prep_status(ctx,"Creating databases in the new cluster");
198201
exec_prog(ctx, true,
199-
SYSTEMQUOTE"\"%s/psql\" --set ON_ERROR_STOP=on --port %d "
200-
"-f \"%s/%s\" --dbname template1 >> \"%s\""SYSTEMQUOTE,
201-
ctx->new.bindir,ctx->new.port,ctx->cwd,
202+
SYSTEMQUOTE"\"%s/psql\" --port %d --username \"%s\" "
203+
"--set ON_ERROR_STOP=on -f \"%s/%s\" --dbname template1 >> \"%s\""
204+
SYSTEMQUOTE,
205+
ctx->new.bindir,ctx->new.port,ctx->user,ctx->cwd,
202206
GLOBALS_DUMP_FILE,ctx->logfile);
203207
check_ok(ctx);
204208

@@ -218,9 +222,10 @@ create_new_objects(migratorContext *ctx)
218222

219223
prep_status(ctx,"Restoring database schema to new cluster");
220224
exec_prog(ctx, true,
221-
SYSTEMQUOTE"\"%s/psql\" --set ON_ERROR_STOP=on --port %d "
222-
"-f \"%s/%s\" --dbname template1 >> \"%s\""SYSTEMQUOTE,
223-
ctx->new.bindir,ctx->new.port,ctx->cwd,
225+
SYSTEMQUOTE"\"%s/psql\" --port %d --username \"%s\" "
226+
"--set ON_ERROR_STOP=on -f \"%s/%s\" --dbname template1 >> \"%s\""
227+
SYSTEMQUOTE,
228+
ctx->new.bindir,ctx->new.port,ctx->user,ctx->cwd,
224229
DB_DUMP_FILE,ctx->logfile);
225230
check_ok(ctx);
226231

‎contrib/pg_upgrade/server.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ start_postmaster(migratorContext *ctx, Cluster whichCluster, bool quiet)
185185
*/
186186
snprintf(cmd,sizeof(cmd),
187187
SYSTEMQUOTE"\"%s/pg_ctl\" -l \"%s\" -D \"%s\" "
188-
"-o \"-p %d -c autovacuum=off -c autovacuum_freeze_max_age=2000000000\" "
188+
"-o \"-p %d -c autovacuum=off "
189+
"-c autovacuum_freeze_max_age=2000000000\" "
189190
"start >> \"%s\" 2>&1"SYSTEMQUOTE,
190191
bindir,ctx->logfile,datadir,port,
191192
#ifndefWIN32
@@ -229,7 +230,8 @@ stop_postmaster(migratorContext *ctx, bool fast, bool quiet)
229230

230231
/* See comment in start_postmaster() about why win32 output is ignored. */
231232
snprintf(cmd,sizeof(cmd),
232-
SYSTEMQUOTE"\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> \"%s\" 2>&1"SYSTEMQUOTE,
233+
SYSTEMQUOTE"\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> "
234+
"\"%s\" 2>&1"SYSTEMQUOTE,
233235
bindir,ctx->logfile,datadir,fast ?"-m fast" :"",
234236
#ifndefWIN32
235237
ctx->logfile);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp