--- postgresql-7.4.5/src/bin/pg_dump/pg_backup_archiver.c.orig Fri Sep 10 17:33:09 2004 +++ postgresql-7.4.5/src/bin/pg_dump/pg_backup_archiver.c Fri Sep 10 18:24:30 2004 @@ -50,7 +50,7 @@ static void _doSetFixedOutputState(ArchiveHandle *AH); static void _doSetSessionAuth(ArchiveHandle *AH, const char *user); -static void _reconnectToDB(ArchiveHandle *AH, const char *dbname, const char *user); +static void _reconnectToDB(ArchiveHandle *AH, const char *dbname); static void _becomeUser(ArchiveHandle *AH, const char *user); static void _becomeOwner(ArchiveHandle *AH, TocEntry *te); static void _selectOutputSchema(ArchiveHandle *AH, const char *schemaName); @@ -262,8 +262,8 @@ /* If we created a DB, connect to it... */ if (strcmp(te->desc, "DATABASE") == 0) { - ahlog(AH, 1, "connecting to new database \"%s\" as user \"%s\"\n", te->tag, te->owner); - _reconnectToDB(AH, te->tag, te->owner); + ahlog(AH, 1, "connecting to new database \"%s\"\n", te->tag); + _reconnectToDB(AH, te->tag); } } @@ -2104,18 +2104,16 @@ * the script output. */ static void -_reconnectToDB(ArchiveHandle *AH, const char *dbname, const char *user) +_reconnectToDB(ArchiveHandle *AH, const char *dbname) { if (RestoringToDB(AH)) - ReconnectToServer(AH, dbname, user); + ReconnectToServer(AH, dbname, NULL); else { PQExpBuffer qry = createPQExpBuffer(); - appendPQExpBuffer(qry, "\\connect %s", + appendPQExpBuffer(qry, "\\connect %s\n\n", dbname ? fmtId(dbname) : "-"); - appendPQExpBuffer(qry, " %s\n\n", - fmtId(user)); ahprintf(AH, qry->data); @@ -2124,12 +2122,12 @@ /* * NOTE: currUser keeps track of what the imaginary session user in - * our script is + * our script is. It's now effectively reset to the original userID. */ if (AH->currUser) free(AH->currUser); - AH->currUser = strdup(user); + AH->currUser = strdup(""); /* don't assume we still know the output schema */ if (AH->currSchema)