From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ronald Haynes <rhaynes74@gmail.com>
To: pgsql-general@lists.postgresql.org, Ray O'Donnell <ray@rodonnell.ie>
Subject: Re: restore question
Date: Tue, 19 Jul 2022 09:52:30 -0700
Message-ID: <b65cf6a7-130e-e3a9-1216-f5947bcabb4d@aklaver.com> (raw)
In-Reply-To: <592b6261-8a4f-481f-853a-b80f159dcb1e@Spark>
References: <12b2292b-372c-4fe0-9f63-7f641bad688a@Spark>
<72da6868-8a2c-4378-8857-8391763393cb@Spark>
<89905c07-ae17-a1a7-2a26-ba8ab6109c50@rodonnell.ie>
<592b6261-8a4f-481f-853a-b80f159dcb1e@Spark>
On 7/19/22 9:44 AM, Ronald Haynes wrote:
> Thanks Ray, running
>
> pSql -f backup-file.sql
>
>
>
> psql: error: FATAL: database "rhaynes74" does not exist
No that is expected as you did not specify a database to connect to
using -d <some_db>. In that case psql uses the OS user name you are
running the command as for the database name per:
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
dbname
The database name. Defaults to be the same as the user name. In
certain contexts, the value is checked for extended formats; see Section
34.1.1 for more details on those.
So change the command to:
psql -d postgres -U <db_user> -f backup-file.sql
Where <db_user> is a database user that has the correct privileges to
load/create the databases.
>
> Which seems odd since rhaynes74 is a user not a database name in the file.
>
> Sincerely,
>
> Dr. Ronald D. Haynes
> Professor, Department of Mathematics and Statistics
> Chair, MSc and Phd Scientific Computing Programs
> Memorial University of Newfoundland
--
Adrian Klaver
adrian.klaver@aklaver.com
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, rhaynes74@gmail.com, ray@rodonnell.ie
Subject: Re: restore question
In-Reply-To: <b65cf6a7-130e-e3a9-1216-f5947bcabb4d@aklaver.com>
References: <12b2292b-372c-4fe0-9f63-7f641bad688a@Spark> <72da6868-8a2c-4378-8857-8391763393cb@Spark> <89905c07-ae17-a1a7-2a26-ba8ab6109c50@rodonnell.ie> <592b6261-8a4f-481f-853a-b80f159dcb1e@Spark> <b65cf6a7-130e-e3a9-1216-f5947bcabb4d@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