pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Rich Shepard <rshepard@appl-ecosys.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Updating data: confirmation and question
Date: Sat, 26 Oct 2019 09:14:08 -0700
Message-ID: <547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com> (raw)
In-Reply-To: <alpine.LNX.2.20.1910260831280.28605@salmo.appl-ecosys.com>
References: <alpine.LNX.2.20.1910260831280.28605@salmo.appl-ecosys.com>

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





view thread (7+ messages)  latest in thread

Message-ID: <547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com>
Permalink:  ../547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com/
Also on:    postgresql.org/message-id/547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, rshepard@appl-ecosys.com
  Subject: Re: Updating data: confirmation and question
  In-Reply-To: <547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com>
  References: <alpine.LNX.2.20.1910260831280.28605@salmo.appl-ecosys.com> <547c2d0b-70a5-2a62-6b9e-3ff852485dea@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox