diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index efcb5924935..0fb0912e453 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -3540,14 +3540,16 @@ _reconnectToDB(ArchiveHandle *AH, const char *dbname) * Anything added between this line and the following \restrict must * be careful to avoid any possible meta-command injection vectors. */ - ahprintf(AH, "\\unrestrict %s\n", ropt->restrict_key); + if (ropt->restrict_key) + ahprintf(AH, "\\unrestrict %s\n", ropt->restrict_key); initPQExpBuffer(&connectbuf); appendPsqlMetaConnect(&connectbuf, dbname); ahprintf(AH, "%s", connectbuf.data); termPQExpBuffer(&connectbuf); - ahprintf(AH, "\\restrict %s\n\n", ropt->restrict_key); + if (ropt->restrict_key) + ahprintf(AH, "\\restrict %s\n\n", ropt->restrict_key); } /*