Re: Updating data: confirmation and question

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Updating data: confirmation and question
Дата
Msg-id 547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com
обсуждение исходный текст
Ответ на Updating data: confirmation and question  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Updating data: confirmation and question  (Rich Shepard <rshepard@appl-ecosys.com>)
Список 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 по дате отправления:

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Updating data: confirmation and question
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Updating data: confirmation and question