RE: Rename a column if not already renamed.? - Mailing list pgsql-general

From Day, David
Subject RE: Rename a column if not already renamed.?
Date
Msg-id c493cce5a73f468d91633f3d2daae284@redcom.com
Whole thread Raw
In response to Rename a column if not already renamed.?  ("Day, David" <david.day@redcom.com>)
Responses Re: Rename a column if not already renamed.?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Rename a column if not already renamed.?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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.3
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 <david.day@redcom.com>
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 <david.day@redcom.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

pgsql-general by date:

Previous
From: Luca Ferrari
Date:
Subject: Re: Rename a column if not already renamed.?
Next
From: Adrian Klaver
Date:
Subject: Re: Rename a column if not already renamed.?