Cloning one database to another

In lieu of a direct way of cloning one database to another, it was suggested by support that we download a daily backup of our prod database and then manually import that into staging with the following:

{staging psql command} -f database-backup.file

However, this resulted in a great deal of errors: psql dump errors · GitHub

Is there a prior step we should take. I didn’t think we’d want to wipe the database (or should need to) entirely before running this, but maybe we do? That would kill database users which presumably would have unintended consequences for our consuming application.

I believe I see what the issue is, and I believe in order to move the dump over, I will be able to do that on your behalf. Let’s continue the conversation in private messaging since I might need to ask you about your database names. I will message you.

I have a similar question about how to use a database backup file to seed an application running in a local environment. When I try to load the file with psql I get this error:

could not open extension control file "/Applications/": No such file or directory

I assume this is because the database service has an extension installed that my local postgres service does not. Is there any way to clone data to a local database without installing every extension used in the service?

See similar conversation here: Missing file: pg_similarity.control. If you’re not using the extensions that are referenced in the error messages, it may be safe to ignore the errors.