diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h
index 10e0dee3b87c79218563ca195a4e3a4c5e20d935..0eef1dc8ba8d2896b3e256d15b8c3c30169df9ab 100644
--- a/src/bin/pg_dump/pg_backup.h
+++ b/src/bin/pg_dump/pg_backup.h
@@ -117,7 +117,7 @@ typedef struct _restoreOptions
 	char	   *use_role;		/* Issue SET ROLE to this */
 	int			dataOnly;
 	int			dropSchema;
-	char	   *filename;
+	const char *filename;
 	int			schemaOnly;
 	int         dumpSections;
 	int			verbose;
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 424fc2e8b5994451ff0d020e67421d489dbeede5..44ba913d4a11d29cba5deef28f03c6771f4d4f3e 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -126,7 +126,7 @@ static void vdie_horribly(ArchiveHandle *AH, const char *modulename,
 	__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 0), noreturn));
 
 static void dumpTimestamp(ArchiveHandle *AH, const char *msg, time_t tim);
-static void SetOutput(ArchiveHandle *AH, char *filename, int compression);
+static void SetOutput(ArchiveHandle *AH, const char *filename, int compression);
 static OutputContext SaveOutput(ArchiveHandle *AH);
 static void RestoreOutput(ArchiveHandle *AH, OutputContext savedContext);
 
@@ -1173,7 +1173,7 @@ archprintf(Archive *AH, const char *fmt,...)
  *******************************/
 
 static void
-SetOutput(ArchiveHandle *AH, char *filename, int compression)
+SetOutput(ArchiveHandle *AH, const char *filename, int compression)
 {
 	int			fn;
 
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index c3973daa576c7aa2e54c5b2c80a19a8b58f89192..daafc2bc000b465492caaf33e8fd019059f2988c 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -767,7 +767,7 @@ main(int argc, char **argv)
 	if (plainText)
 	{
 		ropt = NewRestoreOptions();
-		ropt->filename = (char *) filename;
+		ropt->filename = filename;
 		ropt->dropSchema = outputClean;
 		ropt->aclsSkip = aclsSkip;
 		ropt->superuser = outputSuperuser;