Re: Rename a column if not already renamed.?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "Day, David" <david(dot)day(at)redcom(dot)com>, Luca Ferrari <fluca1978(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Rename a column if not already renamed.?
Date: 2019-08-20 20:07:31
Message-ID: 23685a61-6e3a-4b09-a2da-dc316e1917a0@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)gmail(dot)com]
> Sent: Tuesday, August 20, 2019 3:41 PM
> To: Day, David <david(dot)day(at)redcom(dot)com>
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: Rename a column if not already renamed.?
>
> On Tue, Aug 20, 2019 at 9:07 PM Day, David <david(dot)day(at)redcom(dot)com> 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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message chiru r 2019-08-20 20:32:25 Two Postgres master process are showing - one is on and off
Previous Message Day, David 2019-08-20 19:50:35 RE: Rename a column if not already renamed.?