pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tfo@alumni.brown.edu
To: pgsql-admin@postgresql.org
Subject: pg_restore usage
Date: 21 Jun 2004 14:57:17 -0700
Message-ID: <80c38bb1.0406211357.f9fadd6@posting.google.com> (raw)

A while back, there was a thread on this list called "pg_restore
problem with 7.3.1". It outlined a scenario very similar to one I'm
having problems with. Granted, they're not serious problems (in the
sense that there's an acceptable workaround), but they suggest that
either pg_restore is not working as expected, or I have incorrect
expectations. I'd like to get some clarification as to which is the
case.

I dump a database as follows:

pg_dump -F c db >pg_dump`date +\%Y\%m\%d`.pgsql

I transfer this file to another server, where the database db does not
exist. I try the following:

pg_restore -C -d db pg_dump20040621.pgsql

I get this error:

pg_restore: [archiver (db)] connection to database "db" failed: FATAL:
 database "db" does not exist

What is an example of how the -C flag is intended to be used? If it is
omitted, then the error is the same because no createdb has been
issued.

In the end, what I'm looking for is a nice way of taking a dump and
restoring it in one command that could be added to a crontab. I
realize that it's not too much extra work to create a shell script
that creates the relevant database, but this seems like such a natural
one-liner, and I'm curious what the intent of the -C flag is, if not
to precipitate such a situation.



view thread (3+ messages)  latest in thread

Message-ID: <80c38bb1.0406211357.f9fadd6@posting.google.com>
Permalink:  ../80c38bb1.0406211357.f9fadd6@posting.google.com/
Also on:    postgresql.org/message-id/80c38bb1.0406211357.f9fadd6@posting.google.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-admin@postgresql.org
  Cc: tfo@alumni.brown.edu
  Subject: Re: pg_restore usage
  In-Reply-To: <80c38bb1.0406211357.f9fadd6@posting.google.com>
  References: <80c38bb1.0406211357.f9fadd6@posting.google.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