Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1slrZ2-001bjK-4U for pgsql-general@arkaria.postgresql.org; Wed, 04 Sep 2024 15:04:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1slrYz-00B45o-A1 for pgsql-general@arkaria.postgresql.org; Wed, 04 Sep 2024 15:04:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1slrYy-00B44f-UN for pgsql-general@lists.postgresql.org; Wed, 04 Sep 2024 15:04:53 +0000 Received: from fhigh1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1slrYu-0008XA-QP for pgsql-general@lists.postgresql.org; Wed, 04 Sep 2024 15:04:52 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2B85811400EC; Wed, 4 Sep 2024 11:04:47 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 04 Sep 2024 11:04:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1725462287; x=1725548687; bh=YC+mYmvmgUiEBqutuCZgSmqK4FSXCiNeuya+O23MIVs=; b= 1D86zczIdKabpKkUnYjgnkipwVqlAVqVwYTrv9a8cqMq5GkMPalPoOOTi1VrL6Lt gXcb5Kk1DIbzjn/ptqPtQ6lp2tfSbfTG7lM2RMqAbh50SUzeH/ghqX/Io6FVCa16 uI03la+JVroE6yXtYWpUiuy1PtAE6NIHojxXt2QcBe2IJ5FQXR7m9dj89QsLH+uv BbR/jO3RP/VRphG7cv2vMi7JHpUKkAPJ7rz1cY3zO23rbOM4uOlkGSQsUOQk9AQi GTB3/8WsMkhycl1EFPsRpax0RXjNIZtOBsR8Gjp82rH0GTRvPokHgHCVaO08b19F 90kl7sic884oZYcA8s3tdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1725462287; x= 1725548687; bh=YC+mYmvmgUiEBqutuCZgSmqK4FSXCiNeuya+O23MIVs=; b=T ou+aK8imxZKlfB1UJmWHbzYzdZsiygdWPzjO8zmzKwa6NWBAF70K1ZMNeDuzPLpx 0nEnGUqV6Rd6HIS2wlrL5m4+vz6R4TRIvSNbG2Rt80HGWPpQGy9niuNY3ZTUan5o SMZinyfrWB5WnWTgUxoZ2FzR8r6gPFfGo8UBWfwfpVHt6opjUXuHDQ3F0bvzyKaG Npdki5WI7GMoReVx4b0f2D4PT8eUcvmMmRT1oYUHYGoLiDQKUAE3YcJY1lk05GO+ Y0cS/Yt2QpWcOJt8FxcqwS+LAQAFJswduRU/u0BurTQBmX6wUF09wzZ5WjWeZWQg p3Hd6KDvwCMQ7JK+I898g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudehjedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdej necuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepfeegfeeiuedtgffgteeg gfehkeejheetieeliefgteeikeejvdeiveeigfehvedtnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghk lhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepshgrmhekledrghesghhmrghilhdrtghomhdprhgtphhtthhopehushhm rghnrdhksegsihhtnhhinhgvrdhnvghtpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrh grlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Sep 2024 11:04:46 -0400 (EDT) Message-ID: Date: Wed, 4 Sep 2024 08:04:45 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Issue with Restore dump with plpythonu, plpython3u installed on postgres16 To: Sam Son Cc: Muhammad Usman Khan , pgsql-general@lists.postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/4/24 03:48, Sam Son wrote: > Hi Adrian, Muhammad, > > Thanks for the quick response. > > For new I cannot do changes in old version DB, since it is deployed > remotely and i dont have any access. And it has to be done from multiple > servers. > > As a work around I tried two solutions. Both of which depend on the plpythonu functions running with plpython3u, in other words that they are Python3 compatible. Have you verified that? > > *Solution 1:* > > After downloading and extracting the dump, convert the pgdump file to > sql file which is editable. > > *    pg_restore -f out_dump.sql dump.pgdump* > > Replace all the plpythonu references with plputhon3u. > > Restore using the sql file. > > *    sudo -H -u postgres psql -p 5433 -d db_name <  out_dump.sql* I would suggest working on the schema portion separate from the data: pg_restore -s -f out_dump_schema.sql dump.pgdump* Do your search and replace, restore to database and then: pg_restore -a ... dump.pgdump* Where -a is data only. In fact if you have control of the pg_dump break it into two parts: pg_dump -s ... --schema pg_dump -a ... --data only > > > *Solution 2:* > > After downloading and extracting the dump, get the list of items in dump > (Schemas, tables, table data, Index, functions, etc). > > *    pg_restore -l dump.pgdump > dump.txt* > > Delete all the function references which have plpython3u. I'm guessing you meant plpythonu above. > *Question:* > > Our database size is 500GB, > > Do we see any performance impact using solution 1. Since solution 1 is > using sql file load and solution 2 is using pg_restore directly. > > Kindly recommend what to choose, solution 1 or solution 2 or any other > workaround to restore. Personally I would go with solution 1 with the modifications I suggested. > > > Thanks, > Samson G > -- Adrian Klaver adrian.klaver@aklaver.com