Re: Updating data: confirmation and question - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Updating data: confirmation and question
Date
Msg-id 547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com
Whole thread Raw
In response to Updating data: confirmation and question  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Updating data: confirmation and question
List pgsql-general
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@aklaver.com



pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Updating data: confirmation and question
Next
From: Rich Shepard
Date:
Subject: Re: Updating data: confirmation and question