After testing Abelisto's suggestion I found answers for both questions:
Answer to question 1
As informed by Abelisto, postgres 12 does not have locale
option for create database
, while postgres 13 does.
postgres 12: postgresql.org/docs/12/sql-createdatabase.html
postgres 13: postgresql.org/docs/13/sql-createdatabase.html
Then, creating the database manually on the destination db and removing -C
from the command solved it. Here is the final command:
pg_dump -h remotehost -p 5432 -U postgres remotedb | psql -h localhost -p 5432 -U postgres localdb
An observation is that I had postgres 12 & 13 installed but psql
path was setup for postgres 13. Hence, no matter if I was trying to pg-dump
between postgres 12 databases, I would get the locale
error, since psql
was using postgres 13 to run the command.
Answer to question 2
The process for inputing both passwords was correct:
- Destination db password
- Hit enter
- Origin db password
- Hit enter
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…