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 1i0e0o-0006I0-Jy for pgsql-general@arkaria.postgresql.org; Thu, 22 Aug 2019 03:43:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i0e0l-0004T1-QN for pgsql-general@arkaria.postgresql.org; Thu, 22 Aug 2019 03:43:43 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1i0e0k-0004Sq-FJ for pgsql-general@lists.postgresql.org; Thu, 22 Aug 2019 03:43:43 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i0e0c-00021M-Pg for pgsql-general@postgresql.org; Thu, 22 Aug 2019 03:43:41 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id EB8EF2208A; Wed, 21 Aug 2019 23:43:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 21 Aug 2019 23:43:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=Q I2e8ToeFV7HgGnZwCkCMCc9YYF2DSvaYA0vkdGunoQ=; b=o/7cnH4bxO22RzNk3 TfS0l0c+/9bRMpICfIsCqUkiurzOrafC4RfV7+eWwhtIJ0DeXN+HIEG/inm6pUU8 SH9HW5WTswczzJliBB4AZa39ogbKKXxu7XrFRsoa6yjPhJ5RLyFnXCYsuyEfmd13 +BvEl44JCDkyb6eXVONt70Hu/2uz9jERWsErv7+x5ot7IxQGv4a8i6qOQ9cMqEe8 y0w2Kx37deUuIsdIvuxPIPJT+JYMKdm4hvG9iNZvEIVQvzb4lPTa1XDJQjoc4WXZ AknYmYHGsKnvvZJlMiTo4yqvYMbQnJGq/sFvGHw0/xCGlFcrj9iWVjURi+hGzGJ+ Stf8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm3; bh=QI2e8ToeFV7HgGnZwCkCMCc9YYF2DSvaYA0vkdGun oQ=; b=wLpXhqg1xH91r+s3JQF3+ztDpFn3Mvpk+4K9FRaf2M6FLi5M5s4p6HSdX MD+3kuL3bqMAZl5wHg+cQyN+XDaz464DdrKxt7qNfQXnw4P9yzaoDoX5EvKZhE3e YJ67N1izfgsk80P15L8V1ULAFH59Ie/89J+eOm5I8eQmKx5hMMSjL7DHH77HcUuC uKRUu4Q/pGK2gZadX/neOT6qdv4PogYJ5ZHa75yB/iLzhfhJSNXLNgICKx28ekVX gWG4J+MNYcsxuy6CpjSFIRVgPqckbLxOzYrNcbpjipbbW1oKm2fBDi/DjsJWtx5x uZVeoJIKcHyamH2g3WC82gj20vQ3A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeggedgjeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphepjedurddvuddvrdduhedtrddvtddvnecurfgrrhgrmhepmhgrihhlfhhr ohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsth gvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 100CDD60057; Wed, 21 Aug 2019 23:43:31 -0400 (EDT) Subject: Re: Rename a column if not already renamed.? To: "Day, David" , Tom Lane Cc: Luca Ferrari , "pgsql-general@postgresql.org" References: <17271.1566334606@sss.pgh.pa.us> <0d2329c38d244c72907c70297416287d@redcom.com> From: Adrian Klaver Message-ID: Date: Wed, 21 Aug 2019 20:43:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <0d2329c38d244c72907c70297416287d@redcom.com> 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 8/21/19 11:58 AM, Day, David wrote: > Restoring into 11.3 instance the 9.6 dump ? -> yes. > > For the upgrade scenario, I confirmed that both old column name and new name are in the pg_attribute table at the time the patch attempts to rename it. > Why both is a big question. I been playing around with that and the only way I can see it happening is that both columns actually exist in the table. This leads to: 1) Examine the output of the pg_dump file to see if the table comes over with both columns. 2) Examine the table in the 11.3 instance to see if has both columns. An indication to me that patch process is adding back the old column. 3) If neither 1) or 2) examine the patch process to see if it has both columns in the table at some point in time and then removes the old column. > However, > It is easy enough to re-write the column rename function to deal with the simultaneous possibility. I will include the redefined function in the merge patch and see how it goes. > > I'll update the thread after some further exploration. > > Thanks all for your assistance. > > -- Adrian Klaver adrian.klaver@aklaver.com