pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: rhudon@numetrix.ca
Subject: Restore to a new database from a backup (.tar) generated from
Date: Wed, 29 Nov 2023 22:18:20 +0000
Message-ID: <170129630093.398197.16313313018327801446@wrigleys.postgresql.org> (raw)

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/app-pgrestore.html
Description:

After creating a new database in postgreSQL :                              
CREATE DATABASE x;
I dump it in a .tar file:                                                   
                    pg_dump -p 5433 -U postgres -W -F t x > 
C:\pgBackups\x.tar
Then I restore it with  the restore command:                                
   pg_restore -p 5433 -U postgres -W -d x -C --verbose C:\pgBackups\x.tar
                   RESULT : pg_restore: création de DATABASE « x »
                                    pg_restore: pendant le traitement de la
TOC (« PROCESSING TOC ») :
                                    pg_restore: de l'entrée TOC 3315 ; 1262
29865 DATABASE x postgres
                                    pg_restore: erreur : could not execute
query: ERREUR:  la base de données « x » existe déjà
                                    La commande était : CREATE DATABASE x
WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE =
'French_Canada.1252';
                                    pg_restore: connexion à la nouvelle base
de données « x »
                                    pg_restore: attention : erreurs ignorées
lors de la restauration : 1                     ' PROBLEM WITH CODE PAGE
1252 and the fact that the (empty) db already exists
if I remove the database (x) from PostgreSQL (Version 15.5)            DROP
DATABASE x;
and I try the same restore command:                                         
          pg_restore -p 5433 -U postgres -W -d x -C --verbose
C:\pgBackups\x.tar
                  RESULT :  pg_restore: connexion à la base de données pour
la restauration
Mot de passe :
pg_restore: erreur : la connexion au serveur sur « localhost » (::1), port
5433 a échoué : FATAL:  la base de données « x » n'existe pas     ' The
problem is that the database does not exist  

So, I can I create a database from scratch, in PostgreSQL, from a backup
(.tar) file generated from  pg_dump ?


view thread (2+ messages)  latest in thread

Message-ID: <170129630093.398197.16313313018327801446@wrigleys.postgresql.org>
Permalink:  ../170129630093.398197.16313313018327801446@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/170129630093.398197.16313313018327801446@wrigleys.postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, rhudon@numetrix.ca
  Subject: Re: Restore to a new database from a backup (.tar) generated from
  In-Reply-To: <170129630093.398197.16313313018327801446@wrigleys.postgresql.org>

* 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