On 10/26/19 8:38 AM, Rich Shepard wrote:
Before my old server died I ran pg_dumpall on the database there and copied
that to my new server. The old database was postgresql-10 and the new
one is
postgresql-11.5.
Am I correct that I can run 'pgsql -f <filename>.sql' and overwrite the
existing databases with the newer data?
That depends on how you ran pg_dumpall. For instance did you use -c?:
https://www.postgresql.org/docs/11/app-pg-dumpall.html
Checking the database names in both I see that I mistakenly used hyphens
rather than underscores in one database name. I can change that in the .sql
file but have not before learned how/whether I can change a database name
using psql. What's the best approach to changing the existing hypephenated
name?
This?:
https://www.postgresql.org/docs/11/sql-alterdatabase.html
ALTER DATABASE name RENAME TO new_name
TIA,
Rich
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx