X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 12CC4D1B267 for ; Mon, 21 Jun 2004 19:12:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67675-02 for ; Mon, 21 Jun 2004 22:12:45 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 73011D1B209 for ; Mon, 21 Jun 2004 19:12:41 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i5LMCfQC019998 for ; Mon, 21 Jun 2004 22:12:41 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i5LLvFEj014800 for pgsql-admin@postgresql.org; Mon, 21 Jun 2004 21:57:15 GMT From: tfo@alumni.brown.edu (Thomas F. O'Connell) X-Newsgroups: comp.databases.postgresql.admin Subject: pg_restore usage Date: 21 Jun 2004 14:57:17 -0700 Organization: http://groups.google.com Lines: 32 Message-ID: <80c38bb1.0406211357.f9fadd6@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/345 X-Sequence-Number: 14005 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.