]> granicus.if.org Git - postgresql/commitdiff
Add username designations to all pg_upgrade utility calls that support it.
authorBruce Momjian <bruce@momjian.us>
Wed, 23 Jun 2010 20:04:50 +0000 (20:04 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 23 Jun 2010 20:04:50 +0000 (20:04 +0000)
contrib/pg_upgrade/check.c
contrib/pg_upgrade/pg_upgrade.c
contrib/pg_upgrade/server.c

index b6c7d3101d37aca78667d69dcbde3bee30aca7df..775cc0b2d5c742388719c103cb5eaf2d6f941460 100644 (file)
@@ -149,10 +149,11 @@ 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 "
-                                         "-f \"%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
-                                         ctx->new.bindir, ctx->new.port, sequence_script_file_name,
-                                         ctx->logfile);
+                                         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);
                        unlink(sequence_script_file_name);
                        check_ok(ctx);
                }
index b314a1f1c39892d457c8974f300ad6eed2df9118..c3f8070be584f273b4549c998a24a86d153f1f63 100644 (file)
@@ -78,7 +78,8 @@ main(int argc, char **argv)
         * because there is no need to have the schema load use new oids.
         */
        prep_status(&ctx, "Setting next oid for new cluster");
-       exec_prog(&ctx, true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -o %u \"%s\" > " DEVNULL SYSTEMQUOTE,
+       exec_prog(&ctx, true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -o %u \"%s\" > "
+                 DEVNULL SYSTEMQUOTE,
                  ctx.new.bindir, ctx.old.controldata.chkpnt_nxtoid, ctx.new.pgdata);
        check_ok(&ctx);
 
@@ -156,8 +157,9 @@ prepare_new_cluster(migratorContext *ctx)
         */
        prep_status(ctx, "Analyzing all rows in the new cluster");
        exec_prog(ctx, true,
-                         SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --all --analyze >> %s 2>&1" SYSTEMQUOTE,
-                         ctx->new.bindir, ctx->new.port, ctx->logfile);
+                         SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
+                         "--all --analyze >> %s 2>&1" SYSTEMQUOTE,
+                         ctx->new.bindir, ctx->new.port, ctx->user, ctx->logfile);
        check_ok(ctx);
 
        /*
@@ -168,8 +170,9 @@ prepare_new_cluster(migratorContext *ctx)
         */
        prep_status(ctx, "Freezing all rows on the new cluster");
        exec_prog(ctx, true,
-                         SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --all --freeze >> %s 2>&1" SYSTEMQUOTE,
-                         ctx->new.bindir, ctx->new.port, ctx->logfile);
+                         SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
+                         "--all --freeze >> %s 2>&1" SYSTEMQUOTE,
+                         ctx->new.bindir, ctx->new.port, ctx->user, ctx->logfile);
        check_ok(ctx);
 
        get_pg_database_relfilenode(ctx, CLUSTER_NEW);
@@ -196,9 +199,10 @@ prepare_new_databases(migratorContext *ctx)
         */
        prep_status(ctx, "Creating databases in the new cluster");
        exec_prog(ctx, true,
-                         SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on --port %d "
-                         "-f \"%s/%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
-                         ctx->new.bindir, ctx->new.port, ctx->cwd,
+                         SYSTEMQUOTE "\"%s/psql\" --port %d --username \"%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);
        check_ok(ctx);
 
@@ -218,9 +222,10 @@ create_new_objects(migratorContext *ctx)
 
        prep_status(ctx, "Restoring database schema to new cluster");
        exec_prog(ctx, true,
-                         SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on --port %d "
-                         "-f \"%s/%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
-                         ctx->new.bindir, ctx->new.port, ctx->cwd,
+                         SYSTEMQUOTE "\"%s/psql\" --port %d --username \"%s\" "
+                         "--set ON_ERROR_STOP=on -f \"%s/%s\" --dbname template1 >> \"%s\""
+                         SYSTEMQUOTE,
+                         ctx->new.bindir, ctx->new.port,  ctx->user, ctx->cwd,
                          DB_DUMP_FILE, ctx->logfile);
        check_ok(ctx);
 
index 9f6c9cb4181e79838ff7dd9a515520323961b757..ffe2b1030cee096bedd4840be3093b77089073d3 100644 (file)
@@ -185,7 +185,8 @@ start_postmaster(migratorContext *ctx, Cluster whichCluster, bool quiet)
         */      
        snprintf(cmd, sizeof(cmd),
                         SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" "
-                        "-o \"-p %d -c autovacuum=off -c autovacuum_freeze_max_age=2000000000\" "
+                        "-o \"-p %d -c autovacuum=off "
+                        "-c autovacuum_freeze_max_age=2000000000\" "
                         "start >> \"%s\" 2>&1" SYSTEMQUOTE,
                         bindir, ctx->logfile, datadir, port,
 #ifndef WIN32
@@ -229,7 +230,8 @@ 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,
+                         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);