Restoring backups
suggest changepsql < backup.sql
A safer alternative uses -1 to wrap the restore in a transaction. The -f specifies the filename rather than using shell redirection.
psql -1 -f backup.sql
Custom format files must be restored using pg_restore with the -d option to specify the database:
pg_restore -d DATABASE DATABASE.pgsql
The custom format can also be converted back to SQL:
pg_restore backup.pgsql > backup.sql
Usage of the custom format is recommended because you can choose which things to restore and optionally enable parallel processing.
You may need pg_dump followed by pg_restore (or a plain-SQL restore) to move data to a newer major version. Restore into a server of the same or a newer major version. A dump taken by a newer pg_dump is not meant for an older server. Custom-format dumps are restored with pg_restore, not with psql. psql -1 wraps one session in a single transaction; it does not apply to pg_restore, which has its own -1.