I generated successfully pg dump with directory
format and when I restore it restores to DB with the same name as dump was created for despite the fact of me specifying to use alternative name.
Here is my pg_dump command
& pg_dump -Fd -v -j 2 -Z0 --host=$pghost --username=$username --dbname=postgres --exclude-table=cron.job --exclude-table=cron.job_run_details -f $filename
And here is my pg_restore command
pg_restore -Fd -C -j 4 --schema=public --no-owner --verbose --host=$pghost --username=$username --dbname=restore $filename
In this case regardless of me putting --dbname=restore
it still restores as postgres