Bro, this issue you're encountering with pg_restore could stem from a few different factors,
and some of the common reasons and solutions.
1. Database Format Mismatch
The backup file you're trying to restore might not be in the right format.
PostgreSQL supports several backup formats:
Custom format (.backup): This is often created with pg_dump.
=============
Plain SQL format (.sql): This is a plain text file containing SQL commands.
=================
Directory format: A directory structure, also generated by pg_dump.
=================
Solution:
=========
If you're trying to restore from a .sql file, you should use psql instead of pg_restore.
==========================================================================================
==>psql -U your_user -d your_db_name -f backup.sql
If it's a .backup or directory format, you should use pg_restore. Example:
==========================================================================
==>pg_restore -U your_user -d your_db_name your_backup_file.backup
Solution:
Make sure the user you're logged in as has the appropriate permissions to create objects in the database.
==>GRANT ALL PRIVILEGES ON DATABASE your_db_name TO your_user;