Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a9bHu-0005rR-Lb for pgsql-admin@arkaria.postgresql.org; Thu, 17 Dec 2015 16:20:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a9bHu-0007EA-8R for pgsql-admin@arkaria.postgresql.org; Thu, 17 Dec 2015 16:20:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a9bGE-0004kN-PR for pgsql-admin@postgresql.org; Thu, 17 Dec 2015 16:18:34 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a9bGA-0006rn-Q0 for pgsql-admin@postgresql.org; Thu, 17 Dec 2015 16:18:34 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 204382037C for ; Thu, 17 Dec 2015 11:18:29 -0500 (EST) Received: from web6 ([10.202.2.216]) by compute5.internal (MEProxy); Thu, 17 Dec 2015 11:18:29 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=Lnjysp21Lrt5FT1wrkfBMStV9GU=; b=NrPVix z0amETv/ntkYD1MjI53UeKZ0gUB5utCd4jlxBBIJJEXXTrvmMPQRd0iqx443a7CC DUHHlEho25ZMlKJG6LYY/RaeonIhOpDRV6uzj1IJ35V1y8Du1mk3uSVwrNJAOpGf MsFgDYmjlxRHFsAq7HKYzVnfbUwhono2e2/Js= DKIM-Signature: v=1; a=rsa-sha1; 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-sasl-enc:x-sasl-enc; s=smtpout; bh=Lnjysp21Lrt5FT1 wrkfBMStV9GU=; b=rKtNslzXGNLJmGpg6Z6Zz+pZAOX/GTU9ojsy/VtgQqtsOuE VPEHfuhBloWCZ95SVxa2evG8Xd691ppgVqCF1Ijz7KOHGuOj/BX6vVk9jaxX31Il XZnby7yR5ufouvleXpG2FpLd0HDkycGXAJO4LqiGaIY/HEoEynxVB5rvxdeA= Received: by web6.nyi.internal (Postfix, from userid 99) id EA793436A4; Thu, 17 Dec 2015 11:18:28 -0500 (EST) Message-Id: <1450369108.2740801.470182945.59E4E975@webmail.messagingengine.com> X-Sasl-Enc: vYQqJNYAoPgzbse1lcZs1Uo97as6U9MH8SuaTIuwpaFZ 1450369108 From: CN To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: multipart/alternative; boundary="_----------=_145036910827408010"; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-a93c17cb Subject: Re: feature request: pg_restore renaming target schema Date: Fri, 18 Dec 2015 00:18:28 +0800 In-Reply-To: References: <1450338245.2626908.469822713.6C14EE8F@webmail.messagingengine.com> <1450365586.2726209.470114761.326B7E39@webmail.messagingengine.com> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --_----------=_145036910827408010 Content-Transfer-Encoding: 7bit Content-Type: text/plain On Thu, Dec 17, 2015, at 11:34 PM, John Scalia wrote: > Maybe a bit off-postgresql, but why couldn't you just add to your > existing automations script, Use sed or your favorite stream editor > and have that do the renaming in the dump output? FWIW, Jay > or over the web I thought this approach before I raised this request. I had peeked the dumped file and had a feeling that manipulating the dumped file with stream editors was infeasible because I thought that the source schema name was scrambled everywhere in the dumped file, data included. Having received your message, I started to think that the approach I gave up in the very beginning might actually be the feasible one - thinking that you would not have mentioned it otherwise! Hence I went back and took a more thorough look at the dumped file and happily to find that it *appears* to me that I only need to edit the first several lines of the dumped file in addition to such lines: ALTER FUNCTION .my_function(....) OWNER TO .... With that said, the appearance pattern of source schema name in the dumped file seems to be predictable. I will study more to make sure stream editors can do this job. Many thanks for the hint! Best Regards, CN -- http://www.fastmail.com - The professional email service --_----------=_145036910827408010 Content-Transfer-Encoding: 7bit Content-Type: text/html
On Thu, Dec 17, 2015, at 11:34 PM, John Scalia wrote:
Maybe a bit off-postgresql, but why couldn't you just add to your existing automations script, Use sed or your favorite stream editor and have that do the renaming in the dump output?
FWIW,
Jay                          or over the web 
 
I thought this approach before I raised this request. I had peeked the dumped file and had a feeling that manipulating the dumped file with stream editors was infeasible because I thought that the source schema name was scrambled everywhere in the dumped file, data included.
 
Having received your message, I started to think that the approach I gave up in the very beginning might actually be the feasible one - thinking that you would not have mentioned it otherwise!
 
Hence I went back and took a more thorough look at the dumped file and happily to find that it *appears* to me that I only need to edit the first several lines of the dumped file in addition to such lines:
 
ALTER FUNCTION <schema name>.my_function(....) OWNER TO ....
 
With that said, the appearance pattern of source schema name in the dumped file seems to be predictable. I will study more to make sure stream editors can do this job.
 
Many thanks for the hint!
 
Best Regards,
CN
-- 
http://www.fastmail.com - The professional email service
--_----------=_145036910827408010--