Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 375682E0083 for ; Mon, 16 Jun 2008 23:35:04 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 13033-04-5 for ; Mon, 16 Jun 2008 23:34:51 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.228]) by developer.postgresql.org (Postfix) with ESMTP id 1F3CA2E008F for ; Mon, 16 Jun 2008 23:34:42 -0300 (ADT) Received: by rv-out-0506.google.com with SMTP id b25so6204721rvf.43 for ; Mon, 16 Jun 2008 19:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=ppBdIo8SA/M83i/RNDgacvcL00+1HNZCmi/ZLpvxrao=; b=QSlaTcwzM8Udq7BtjyHas3Mi8aRThwKTYomT86r2Z6MA69FTtWhQIM1RaZNz+Oa0Dw G7XhC4xcsYWxwRxFOFCy6QCIStgN+AzkH+cr4CBce71yMfn6WvJUDSh8PVPui5fOBmeC V8HKAyxP0g8HLuBwtcQNQDFSg61rF/NwR2PBE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=F+R3Z3WS0GDYyo9qD6n+5SCqnwm5L5aLh7h58sdBAnDGQjYRWs0MYG6LhwXqMjvYDV AivPE5BujH6MXQA9kjJlyVlcrinGgv2/ruVpTrwbNFDFHCNb7IktXau/kfZVEbvmAnWh UmyA9TTFRDlcpQcR9j0tNTxoONBTxbubQLHlI= Received: by 10.114.127.1 with SMTP id z1mr7228308wac.94.1213670081599; Mon, 16 Jun 2008 19:34:41 -0700 (PDT) Received: by 10.114.130.17 with HTTP; Mon, 16 Jun 2008 19:34:39 -0700 (PDT) Message-ID: Date: Mon, 16 Jun 2008 20:34:39 -0600 From: "Scott Marlowe" To: timalou2@netcourrier.com Subject: Re: Restore a backup into a new schema Cc: pgsql-admin@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/129 X-Sequence-Number: 29467 On Fri, Jun 13, 2008 at 3:33 AM, wrote: > Hi, > > Is it possible to restore a backup schema to another schema ? > > For instance I create a backup of a database called "source" with its public schema with pg_backup > > I want to restore this backup in a database called "dest" into a new schema called public2 Easiest way is to edit the pg_dump file by hand or use sed / awk to change it on the fly. If there's a lot of data and that makes it tough to do that, look into dumping the schema and data separately, but this doesn't always work quite right for some complex schemas.