Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 58D16688AEC for ; Tue, 22 Jun 2010 13:48:26 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 46104-06 for ; Tue, 22 Jun 2010 16:48:18 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id D1E14688ADC for ; Tue, 22 Jun 2010 13:48:18 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id o5MGmC218301; Tue, 22 Jun 2010 12:48:12 -0400 (EDT) From: Bruce Momjian Message-Id: <201006221648.o5MGmC218301@momjian.us> Subject: Re: Postgresql 9.0b2 : pg_upgrade not passing username to pgdumpall ? In-Reply-To: To: "Cassiano, Marco" Date: Tue, 22 Jun 2010 12:48:12 -0400 (EDT) CC: pgsql-admin@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ELM1277225292-3537-1_" Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-10 required=5 tests=BAYES_40=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/171 X-Sequence-Number: 34949 --ELM1277225292-3537-1_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" Cassiano, Marco wrote: > Hi all, > > > > it's my first trial with pg_upgrade so I'm surely missing something.... > > I'm trying to launch pg_upgrade passing my super user name but > pg_dumpall fails with a permission denied error.... > > I don't see the username in the pgdumpall call....could it be this the > problem ? > > Thank you (I hope this is the right list to post this) Turns out I was missing the user name designation. I am attaching the patch that fixes this, and a pg_ctl issue on Win32. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + None of us is going to be here forever. + --ELM1277225292-3537-1_ Content-Transfer-Encoding: 7bit Content-Type: text/x-diff Content-Disposition: inline; filename="/rtmp/diff" Index: contrib/pg_upgrade/dump.c =================================================================== RCS file: /cvsroot/pgsql/contrib/pg_upgrade/dump.c,v retrieving revision 1.2 diff -c -c -r1.2 dump.c *** contrib/pg_upgrade/dump.c 12 Jun 2010 17:05:29 -0000 1.2 --- contrib/pg_upgrade/dump.c 22 Jun 2010 16:44:06 -0000 *************** *** 19,27 **** * restores the frozenid's for databases and relations. */ exec_prog(ctx, true, ! SYSTEMQUOTE "\"%s/pg_dumpall\" --port %d --schema-only " ! "--binary-upgrade > \"%s/" ALL_DUMP_FILE "\"" SYSTEMQUOTE, ! ctx->new.bindir, ctx->old.port, ctx->cwd); check_ok(ctx); } --- 19,27 ---- * restores the frozenid's for databases and relations. */ 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); check_ok(ctx); } Index: contrib/pg_upgrade/option.c =================================================================== RCS file: /cvsroot/pgsql/contrib/pg_upgrade/option.c,v retrieving revision 1.7 diff -c -c -r1.7 option.c *** contrib/pg_upgrade/option.c 15 Jun 2010 23:25:01 -0000 1.7 --- contrib/pg_upgrade/option.c 22 Jun 2010 16:44:06 -0000 *************** *** 174,185 **** * start. */ /* truncate */ ! ctx->log_fd = fopen(ctx->logfile, "w"); ! if (!ctx->log_fd) pg_log(ctx, PG_FATAL, "Cannot write to log file %s\n", ctx->logfile); fclose(ctx->log_fd); ! ctx->log_fd = fopen(ctx->logfile, "a"); ! if (!ctx->log_fd) pg_log(ctx, PG_FATAL, "Cannot write to log file %s\n", ctx->logfile); } else --- 174,183 ---- * start. */ /* truncate */ ! if ((ctx->log_fd = fopen(ctx->logfile, "w")) == NULL) pg_log(ctx, PG_FATAL, "Cannot write to log file %s\n", ctx->logfile); fclose(ctx->log_fd); ! if ((ctx->log_fd = fopen(ctx->logfile, "a")) == NULL) pg_log(ctx, PG_FATAL, "Cannot write to log file %s\n", ctx->logfile); } else Index: contrib/pg_upgrade/pg_upgrade.h =================================================================== RCS file: /cvsroot/pgsql/contrib/pg_upgrade/pg_upgrade.h,v retrieving revision 1.8 diff -c -c -r1.8 pg_upgrade.h *** contrib/pg_upgrade/pg_upgrade.h 15 Jun 2010 02:08:01 -0000 1.8 --- contrib/pg_upgrade/pg_upgrade.h 22 Jun 2010 16:44:06 -0000 *************** *** 48,54 **** #define pg_link_file win32_pghardlink #define EXE_EXT ".exe" #define sleep(x) Sleep(x * 1000) ! #define DEVNULL "nul" /* "con" does not work from the Msys 1.0.10 console (part of MinGW). */ #define DEVTTY "con" /* from pgport */ --- 48,54 ---- #define pg_link_file win32_pghardlink #define EXE_EXT ".exe" #define sleep(x) Sleep(x * 1000) ! #define DEVNULL "nul" /* "con" does not work from the Msys 1.0.10 console (part of MinGW). */ #define DEVTTY "con" /* from pgport */ Index: contrib/pg_upgrade/server.c =================================================================== RCS file: /cvsroot/pgsql/contrib/pg_upgrade/server.c,v retrieving revision 1.2 diff -c -c -r1.2 server.c *** contrib/pg_upgrade/server.c 14 May 2010 00:32:21 -0000 1.2 --- contrib/pg_upgrade/server.c 22 Jun 2010 16:44:06 -0000 *************** *** 177,188 **** port = ctx->new.port; } ! /* use -l for Win32 */ snprintf(cmd, sizeof(cmd), SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" " "-o \"-p %d -c autovacuum=off -c autovacuum_freeze_max_age=2000000000\" " "start >> \"%s\" 2>&1" SYSTEMQUOTE, ! bindir, ctx->logfile, datadir, port, ctx->logfile); exec_prog(ctx, true, "%s", cmd); /* wait for the server to start properly */ --- 177,198 ---- port = ctx->new.port; } ! /* ! * 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 -c autovacuum_freeze_max_age=2000000000\" " "start >> \"%s\" 2>&1" SYSTEMQUOTE, ! bindir, ctx->logfile, datadir, port, ! #ifndef WIN32 ! ctx->logfile); ! #else ! DEVNULL); ! #endif exec_prog(ctx, true, "%s", cmd); /* wait for the server to start properly */ *************** *** 200,205 **** --- 210,216 ---- void stop_postmaster(migratorContext *ctx, bool fast, bool quiet) { + char cmd[MAXPGPATH]; const char *bindir; const char *datadir; *************** *** 216,225 **** else return; /* no cluster running */ ! /* use -l for Win32 */ ! exec_prog(ctx, fast ? false : true, SYSTEMQUOTE "\"%s/pg_ctl\" -l \"%s\" -D \"%s\" %s stop >> \"%s\" 2>&1" SYSTEMQUOTE, ! bindir, ctx->logfile, datadir, fast ? "-m fast" : "", ctx->logfile); ctx->postmasterPID = 0; ctx->running_cluster = NONE; --- 227,242 ---- else return; /* no cluster running */ ! /* 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" : "", ! #ifndef WIN32 ! ctx->logfile); ! #else ! DEVNULL); ! #endif ! exec_prog(ctx, fast ? false : true, "%s", cmd); ctx->postmasterPID = 0; ctx->running_cluster = NONE; --ELM1277225292-3537-1_--