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 4FC1AD1B191 for ; Tue, 29 Jun 2004 13:57:00 -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 89166-07 for ; Tue, 29 Jun 2004 16:56:57 +0000 (GMT) Received: from resmta03.ono.com (smtp.ono.com [62.42.230.12]) by svr1.postgresql.org (Postfix) with ESMTP id B1E35D1B17B for ; Tue, 29 Jun 2004 13:56:55 -0300 (ADT) Received: from [62.43.115.2] by resmta03.ono.com with HTTP; Tue, 29 Jun 2004 18:56:53 +0200 Date: Tue, 29 Jun 2004 18:56:53 +0200 Message-ID: <40D7955200003EA9@resmta03.ono.com> In-Reply-To: <11767.1088346148@sss.pgh.pa.us> From: juanmime@ono.com Subject: Asunto: Re: pg_restore usage To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.4 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME, RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200406/372 X-Sequence-Number: 14032 >tfo@alumni.brown.edu (Thomas F. O'Connell) writes: >> 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 >> 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? > >Whatever database you name in -d has to already exist, because that's >where pg_restore will initially connect. -C means to issue a CREATE >DATABASE command and then reconnect to the new db. > >In other words, try "-C -d template1". > I have a database called "test", that I use for proofs, and It also is usef= ull for restoring a database. Realize that psql and pg_restore, need to connect to a database. Therefore I use the "test" database for these issues. I prefer "test", than "template= 1", because If I make an mistake, then it would not affect all databases based in the template.