diff -urN old/postgresql-10.1/src/bin/pg_upgrade/test.sh new/postgresql-10.1/src/bin/pg_upgrade/test.sh --- old/postgresql-10.1/src/bin/pg_upgrade/test.sh 2017-11-07 00:46:52.000000000 +0000 +++ new/postgresql-10.1/src/bin/pg_upgrade/test.sh 2018-01-12 18:50:04.038190911 +0000 @@ -20,7 +20,7 @@ # Run a given "initdb" binary and overlay the regression testing # authentication configuration. standard_initdb() { - "$1" -N + "$1" -U postgres -N if [ -n "$TEMP_CONFIG" -a -r "$TEMP_CONFIG" ] then cat "$TEMP_CONFIG" >> "$PGDATA/postgresql.conf" @@ -153,6 +153,9 @@ # enable echo so the user can see what is being executed set -x +PGUSER=postgres +export PGUSER + standard_initdb "$oldbindir"/initdb "$oldbindir"/pg_ctl start -l "$logdir/postmaster1.log" -o "$POSTMASTER_OPTS" -w @@ -252,6 +255,8 @@ *) sh ./delete_old_cluster.sh ;; esac +unset PGUSER + if diff "$temp_root"/dump1.sql "$temp_root"/dump2.sql >/dev/null; then echo PASSED exit 0 diff -urN old/postgresql-10.1/src/test/regress/pg_regress.c new/postgresql-10.1/src/test/regress/pg_regress.c --- old/postgresql-10.1/src/test/regress/pg_regress.c 2017-11-07 00:46:52.000000000 +0000 +++ new/postgresql-10.1/src/test/regress/pg_regress.c 2018-01-12 18:03:56.732603484 +0000 @@ -829,6 +829,9 @@ sprintf(s, "%d", port); doputenv("PGPORT", s); } + + /* use user "postgres" for temp instance */ + doputenv("PGUSER", "postgres"); } else { @@ -2246,7 +2249,7 @@ /* initdb */ header(_("initializing database system")); snprintf(buf, sizeof(buf), - "\"%s%sinitdb\" -D \"%s/data\" --no-clean --no-sync%s%s > \"%s/log/initdb.log\" 2>&1", + "\"%s%sinitdb\" -D \"%s/data\" -U postgres --no-clean --no-sync%s%s > \"%s/log/initdb.log\" 2>&1", bindir ? bindir : "", bindir ? "/" : "", temp_instance, @@ -2317,7 +2320,7 @@ * Check if there is a postmaster running already. */ snprintf(buf2, sizeof(buf2), - "\"%s%spsql\" -X postgres <%s 2>%s", + "\"%s%spsql\" -X -U postgres <%s 2>%s", bindir ? bindir : "", bindir ? "/" : "", DEVNULL, DEVNULL);