diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 7f7a0f1ce7..ba5e6acbbb 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -538,9 +538,14 @@ RestoreArchive(Archive *AHX) */ if (*te->dropStmt != '\0') { - if (!ropt->if_exists) + if (!ropt->if_exists || + strncmp(te->dropStmt, "--", 2) == 0) { - /* No --if-exists? Then just use the original */ + /* + * Without --if-exists, or if it's just a comment (as + * happens for the public schema), print the dropStmt + * as-is. + */ ahprintf(AH, "%s", te->dropStmt); } else