Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtE7l-0008EZ-BZ for pgsql-general@arkaria.postgresql.org; Mon, 11 Feb 2019 16:08:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gtE7j-0005Iu-R2 for pgsql-general@arkaria.postgresql.org; Mon, 11 Feb 2019 16:07:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtE7h-0005In-Lh for pgsql-general@lists.postgresql.org; Mon, 11 Feb 2019 16:07:59 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtE7a-0006FG-0T for pgsql-general@lists.postgresql.org; Mon, 11 Feb 2019 16:07:56 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0EB85306E; Mon, 11 Feb 2019 11:07:47 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 11 Feb 2019 11:07:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=o CHmQgDNAHt1YzJVmw17mSCx9MJxtZT7bDbEFpyRxJ4=; b=A/UR7p9d75ixgHjPM ReAsND1P9NDgZdjtItmz5XRZeSyeIbtuWXG81RsfEdOIpeSLYOezSRmcVx6BAISN D9Q3f6wCTJ/MjTdH6k9cRB+c5BMPjG1gdFkxd7UwgfKWcrMZPPqc9V4x8py/hhQd aLj5ZtQr1lQp0N/9rUbo9E4CrHwiRKOsFB+xkJUbcfnv4jKMyHmDChskVQIDdL2K eBkIMLa3Gi90eq2clFJRmVtUMnUMdLJrRSwO/y2eAHJ+ks7t1biJCWP+ubMPgQa2 qBmXONONRLKQbWQMTXWkvza0x04keMDilPbws9xv1YZzbzIE6t8pcvi/fL35Ifnu 2kVZQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=oCHmQgDNAHt1YzJVmw17mSCx9MJxtZT7bDbEFpyRx J4=; b=IQNUfEdfj09nbD2BMAKtkKhgN1qGF3O8POaCuQhsJG33IEfqdOyMb1nNN TFV3PI45ObCw+89ixgzrn6XS4PGLZA2ALxLCi8dufQW7NOpaSZ0erj0qmlpEbr4c bmbrI+uZVYbkSTqWrL7KRDQwWrUJQ2otd2mSUDZWh9oDN5+zeuyC57sDqLXHVopV HCognkEyCvP+YVvn2L17LZsBmku9O19hF71BIIgedkQd0OkJlUm1ob/FGaVDAghx 2DrfJKohcMyKWCjmFKza1eyW9U/51hHfq5EclSeVNP0iFKec1I11JODrED5Gl8ho 91CYqHgLgy2ehMRODo4o1S1rCIPHg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrleelgdeijecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffg ggjggtgfesthejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegr ughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepph hoshhtghhrvghsqhhlrdhorhhgnecukfhppeejuddrvdduvddrudehtddrvddtvdenucfr rghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrh drtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id AA3A2E4412; Mon, 11 Feb 2019 11:07:46 -0500 (EST) Subject: Re: Copy entire schema A to a different schema B To: Tiffany Thang , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <07d00cdd-19a5-8fcf-072b-7e1346fc372b@aklaver.com> Date: Mon, 11 Feb 2019 08:07:45 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/11/19 8:00 AM, Tiffany Thang wrote: > Hi, > To copy the source schema A to target schema B in the same database in > PG10.3, I use psql to dump schema A and manually removes anything > specific to the schema in the text dump file before importing into > schema B. How do I achieve the same exporting from Schema A and > importing into schema B using pg_dump with the -Fc option? Since the Use the -f option to pg_restore: https://www.postgresql.org/docs/10/app-pgrestore.html So something like: pg_restore -f text_file.sql the_binary_file.out This will get you back to a text file you can manipulate. > dump file generated is binary, I could not make modifications to the > file. Is the procedure the same in version 11? > > Thank. > > Tiff -- Adrian Klaver adrian.klaver@aklaver.com