Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIAAB-0007I1-K0 for pgsql-performance@arkaria.postgresql.org; Mon, 23 Aug 2021 13:38:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mIAAA-0000p8-Fc for pgsql-performance@arkaria.postgresql.org; Mon, 23 Aug 2021 13:38:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIAAA-0000p0-78 for pgsql-performance@lists.postgresql.org; Mon, 23 Aug 2021 13:38:54 +0000 Received: from facteur.thefreecat.org ([212.129.38.6]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIAA5-0002qN-MS for pgsql-performance@lists.postgresql.org; Mon, 23 Aug 2021 13:38:53 +0000 Received: from [10.26.2.69] ([::ffff:193.253.42.65]) (AUTH: LOGIN cat, TLS: TLS1.3,128bits,ECDHE_RSA_AES_128_GCM_SHA256) by facteur.thefreecat.org with ESMTPSA id 0000000009DC090C.000000006123A48D.00002164; Mon, 23 Aug 2021 15:37:15 +0200 Subject: Re: pg_restore schema dump to schema with different name To: pgsql-performance@lists.postgresql.org References: <2083887101.547666.1629711847197.ref@mail.yahoo.com> <2083887101.547666.1629711847197@mail.yahoo.com> <4a3a3b2569bf521a8da585f3f87c8e56c6d19145.camel@cybertec.at> From: Jean-Christophe Boggio Message-ID: Date: Mon, 23 Aug 2021 15:38:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <4a3a3b2569bf521a8da585f3f87c8e56c6d19145.camel@cybertec.at> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr-FR Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > The only way to do that is to create a new database, import the data > there, rename the schema and dump again. > > Then import that dump into the target database. Or maybe (if you can afford to have source_schema unavailable for some time) : * rename source_schema to tmp_source * import (that will re-create source_schema) * rename source_schema to destination_schema * rename back tmp_source to source_schema