diff --git a/ChangeLog b/ChangeLog
index a513d5a361bb5b24d49ff03fb84e16db53a82c14..58414bad5947ebbf2d9e009bcbc983f91d3a108c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@ version 0.9.5 -- unreleased
 	sys:
 	 . Fixed typo breaking things for VServers.
 	 . Fix bug when vrootdir is on its own partition (Closes: #395928)
+	pgsql:
+	 . Support configuring PGSQLUSER for real, and document it a bit
+	   (Closes: #396578)
     fixed automake 'make install' bug that failed if /etc/backup.d already
     existed
 
diff --git a/examples/example.pgsql b/examples/example.pgsql
index d9aab420c1374cfb3a28221ef283af92d3743638..42f045e0953ad6a56417125a1d2e0dc08218ce78 100644
--- a/examples/example.pgsql
+++ b/examples/example.pgsql
@@ -17,4 +17,7 @@
 # compress = < yes | no > (default = yes)
 # if yes, compress the pg_dump/pg_dumpall output. 
 
-
+### You can also set the following variables in /etc/backupninja.conf:
+# PGSQLDUMP: pg_dump path (default: /usr/bin/pg_dump)
+# PGSQLDUMPALL: pg_dumpall path (default: /usr/bin/pg_dumpall)
+# PGSQLUSER: user running PostgreSQL (default: postgres)
diff --git a/handlers/pgsql b/handlers/pgsql
index 1b916247bc091233757cfcab98b4cc70adc1710c..fb8fa4fbd54b89301e59052963dabef7a5dd3702 100644
--- a/handlers/pgsql
+++ b/handlers/pgsql
@@ -64,10 +64,10 @@ fi
 if [ $usevserver = yes ]; then
    pguid=`$VSERVER $vsname exec getent passwd $PGSQLUSER | awk -F: '{print $3}'`
 else
-   pguid=`getent passwd postgres | awk -F: '{print $3}'`
+   pguid=`getent passwd $PGSQLUSER | awk -F: '{print $3}'`
 fi
 [ -n "$pguid" ] || \
-    fatal "No user called postgres`[ $usevserver = no ] || echo \" on vserver $vsname\"`."
+    fatal "No user called $PGSQLUSER`[ $usevserver = no ] || echo \" on vserver $vsname\"`."
 debug "chown $pguid $vroot$backupdir"
 chown $pguid $vroot$backupdir
 debug "chmod 700 $vroot$backupdir"
@@ -77,15 +77,15 @@ chmod 700 $vroot$backupdir
 if [ "$databases" == "all" ]; then
     if [ $usevserver = yes ]; then
        if [ "$compress" == "yes" ]; then          
-          execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${vsname}.sql.gz\""
+          execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${vsname}.sql.gz\""
        else
-          execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMPALL > $backupdir/${vsname}.sql\""
+          execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > $backupdir/${vsname}.sql\""
        fi
     else
        if [ "$compress" == "yes" ]; then
-          execstr="su - postgres -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${localhost}-all.sql.gz\""
+          execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP > $backupdir/${localhost}-all.sql.gz\""
        else
-	execstr="su - postgres -c \"$PGSQLDUMPALL > $backupdir/${localhost}-all.sql\""
+	execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > $backupdir/${localhost}-all.sql\""
        fi
     fi
     debug "$execstr"
@@ -106,15 +106,15 @@ else
     for db in $databases; do
 	if [ $usevserver = yes ]; then
            if [ "$compress" == "yes" ]; then
-              execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\""
+              execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\""
            else
-              execstr="$VSERVER $vsname exec su - postgres -c \"$PGSQLDUMP $db | > $backupdir/${db}.sql\""
+              execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > $backupdir/${db}.sql\""
            fi
 	else
            if [ "$compress" == "yes" ]; then
-              execstr="su - postgres -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\""
+              execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP > $backupdir/${db}.sql.gz\""
            else
-              execstr="su - postgres -c \"$PGSQLDUMP $db > $backupdir/${db}.sql\""
+              execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > $backupdir/${db}.sql\""
            fi
 	fi
 	debug "$execstr"
diff --git a/handlers/pgsql.helper b/handlers/pgsql.helper
index 2b05339f9b0c0976e609933b36afeb3214b27cbe..80246167dcfc174b37bbc6088ddf7923a95a5250 100644
--- a/handlers/pgsql.helper
+++ b/handlers/pgsql.helper
@@ -96,6 +96,11 @@ $pgsql_databases
 # if yes, compress the pg_dump/pg_dumpall output. 
 $pgsql_compress
 
+### You can also set the following variables in backupninja.conf:
+# PGSQLDUMP: pg_dump path (default: /usr/bin/pg_dump)
+# PGSQLDUMPALL: pg_dumpall path (default: /usr/bin/pg_dumpall)
+# PGSQLUSER: user running PostgreSQL (default: postgres)
+
 EOF
    chmod 600 $next_filename
 
diff --git a/src/backupninja.in b/src/backupninja.in
index 920d89e66f3fdc244c95c30d2b07ba8d51278ce5..8d1257f75e69ece85166da88fbb027f93ae1bb14 100755
--- a/src/backupninja.in
+++ b/src/backupninja.in
@@ -450,6 +450,7 @@ getconf MYSQLHOTCOPY /usr/bin/mysqlhotcopy
 getconf MYSQLDUMP /usr/bin/mysqldump
 getconf PGSQLDUMP /usr/bin/pg_dump
 getconf PGSQLDUMPALL /usr/bin/pg_dumpall
+getconf PGSQLUSER postgres
 getconf GZIP /bin/gzip
 getconf RSYNC /usr/bin/rsync
 getconf admingroup root