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 1i0APs-0006Nx-Qf for pgsql-general@arkaria.postgresql.org; Tue, 20 Aug 2019 20:07:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i0APq-0003PW-1s for pgsql-general@arkaria.postgresql.org; Tue, 20 Aug 2019 20:07:38 +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 1i0APo-0003PO-RX for pgsql-general@lists.postgresql.org; Tue, 20 Aug 2019 20:07:37 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i0APm-00013x-2k for pgsql-general@postgresql.org; Tue, 20 Aug 2019 20:07:35 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 625E5220AA; Tue, 20 Aug 2019 16:07:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 20 Aug 2019 16:07:33 -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=z TTSv/7KUJFjA3h0DJ1BAtHBDywDJNWhjPxYxElk+dM=; b=jfAcm2rNSTf2r0pjn 33IYlwEUJyS6fZ+qojSt/ufwIgghqdUGJqiZAyrQc+8rVjMMWaKykc56LjDN1wky ORaW8IhPxG6qZGjvmumTcaYUii50V5OdE5Aa3YHQdvm/IoueBi0eN+UnsYqomW8u odm83XY7+ZRUEc80HpCTZpHJ5GpmZXrY7G0QsZWqJQSSD8oQsSYSqzeQj4Yr3Rq3 kPA3C2s+BRYMhVWW2RCf7OXIzuXJIEMcdlGg8ZQkw0I34rbB7HAa12nJvUtV5DRq nIg55aaX0xOTtePS0l9koOmyt3YJWtbPXQ6vwoAsuH+1/yI3Fz04JMm+C6AoAbQF Sw5nA== 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=zTTSv/7KUJFjA3h0DJ1BAtHBDywDJNWhjPxYxElk+ dM=; b=Pj40fFczy7+NKM5KLWIEAu8j1Nncnh4dV2FESu2ORH30PoBEL1Os2SkvI t3xqvgX/7ZmS5am4PH7UazGYfEIQPMtcmyPzSXCHKwnyLSaxPBS4M2YEPj0m9yd0 wo2EID9BqAm/cJVeOrG7EyEtklqephRPWbjWMoYBTp/df6optCWm+a98RzieGTC0 dk/0hAHeazyg6XKL0tLoZWM64Ec/PqpxuS9KLxrVcuFq1r/8rGq7YQlgUiJtvHXj q0dJyPCwPbf6B9rbuX4LxKWajnnROcQRZYq8L+MRBDW3sggtL0SotZKCQrk8GoPO Maw9Z3O4PVn7BkOBzuNhxY3DXM54Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeguddgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecukfhppeejgedrleegrdejfedrvddvvdenucfrrghrrghmpehmrghilhhfrhho mheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvg hrufhiiigvpedt X-ME-Proxy: Received: from ranger.suse (unknown [74.94.73.222]) by mail.messagingengine.com (Postfix) with ESMTPA id 30C0C8005A; Tue, 20 Aug 2019 16:07:32 -0400 (EDT) Subject: Re: Rename a column if not already renamed.? To: "Day, David" , Luca Ferrari Cc: "pgsql-general@postgresql.org" References: From: Adrian Klaver Message-ID: <23685a61-6e3a-4b09-a2da-dc316e1917a0@aklaver.com> Date: Tue, 20 Aug 2019 13:07:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.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 8/20/19 12:50 PM, Day, David wrote: > Thanks for the feedback. > > The error is something like column already exists and > Quoting issue is Unlikely, and as I mentioned it works as expected if Im repeating the patch in 11 The above and below us are the parts I am not understanding. Can you provide us a step-by-step(workflow) for what you are doing? > And I assume would if I was in 9.6. > > I suspect it has something to do with the content, or lack of, in the pg_attribute table following an upgrade. > > -----Original Message----- > From: Luca Ferrari [mailto:fluca1978@gmail.com] > Sent: Tuesday, August 20, 2019 3:41 PM > To: Day, David > Cc: pgsql-general@postgresql.org > Subject: Re: Rename a column if not already renamed.? > > On Tue, Aug 20, 2019 at 9:07 PM Day, David wrote: >> EXECUTE format ('ALTER TABLE %s RENAME %s TO %s', schema_table_, >> old_name_, new_name); > > Hard to say without the error, but any chance there is a quoting problem? > EXECUTE format ('ALTER TABLE %s RENAME %I TO %I', schema_table_, old_name_, new_name); > > Luca > -- Adrian Klaver adrian.klaver@aklaver.com