Re: Updating data: confirmation and question

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Updating data: confirmation and question
Date: 2019-10-26 16:14:08
Message-ID: 547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2019-10-26 17:39:11 Re: Updating data: confirmation and question
Previous Message Rich Shepard 2019-10-26 15:38:31 Updating data: confirmation and question