pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Day, David <david.day@redcom.com>
To: Luca Ferrari <fluca1978@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: RE: Rename a column if not already renamed.?
Date: Tue, 20 Aug 2019 19:50:35 +0000
Message-ID: <c493cce5a73f468d91633f3d2daae284@redcom.com> (raw)
In-Reply-To: <CAKoxK+5X5pwc97Jwt+jPGi6Nnp2JUnQccAUJstfu_3dKY3b-wA@mail.gmail.com>
References: <ef59a820008b4d3299428db52ecc32e0@redcom.com>
	<CAKoxK+5X5pwc97Jwt+jPGi6Nnp2JUnQccAUJstfu_3dKY3b-wA@mail.gmail.com>

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


view thread (11+ messages)  latest in thread

Message-ID: <c493cce5a73f468d91633f3d2daae284@redcom.com>
Permalink:  ../c493cce5a73f468d91633f3d2daae284@redcom.com/
Also on:    postgresql.org/message-id/c493cce5a73f468d91633f3d2daae284@redcom.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: david.day@redcom.com, fluca1978@gmail.com
  Subject: Re: Rename a column if not already renamed.?
  In-Reply-To: <c493cce5a73f468d91633f3d2daae284@redcom.com>
  References: <ef59a820008b4d3299428db52ecc32e0@redcom.com> <CAKoxK+5X5pwc97Jwt+jPGi6Nnp2JUnQccAUJstfu_3dKY3b-wA@mail.gmail.com> <c493cce5a73f468d91633f3d2daae284@redcom.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox