pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <julien.rouhaud@dalibo.com>
To: Philippe BEAUDOIN <phb.emaj@free.fr>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: [GENERAL] Column rename in an extension update script
Date: Tue, 2 May 2017 21:45:26 +0200
Message-ID: <24fbcf75-04d2-9d10-ac12-c99fe4ca96a4@dalibo.com> (raw)
In-Reply-To: <2cf7941e-4e41-7714-3de8-37b1a8f74dff@free.fr>
References: <2cf7941e-4e41-7714-3de8-37b1a8f74dff@free.fr>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

moving this thread to -hackers, since this looks like a bug.

On 01/05/2017 08:54, Philippe BEAUDOIN wrote:
> Hi all,
> 
> I am coding an update script for an extension. And I am in trouble when
> trying to rename a column of an existing table.
> 
> Just after the ALTER TABLE statement, I want to access this table. But
> at this time, the altered column is not visible with its new name.
> 

I can reproduce this issue.

It looks like this is due to missing cache invalidation between the
ALTER TABLE execution and next query planning (failure happens during
pg_analyze_and_rewrite()).

AFAICT, CommandCounterIncrement() is responsible for handling
invalidation messages, but in execute_sql_string() this function is
called before executing a Stmt instead of after.  Moving the
CommandCounterIncrement() just before the PopActiveSnapshot() call (and
removing the final one) fixes this issue for me, but I have no idea if
this is the right fix.

-- 
Julien Rouhaud
http://dalibo.com - http://dalibo.org


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (6+ messages)  latest in thread

Message-ID: <24fbcf75-04d2-9d10-ac12-c99fe4ca96a4@dalibo.com>
Permalink:  ../24fbcf75-04d2-9d10-ac12-c99fe4ca96a4@dalibo.com/
Also on:    postgresql.org/message-id/24fbcf75-04d2-9d10-ac12-c99fe4ca96a4@dalibo.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 using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: julien.rouhaud@dalibo.com, phb.emaj@free.fr, pgsql-hackers@postgresql.org
  Subject: Re: [GENERAL] Column rename in an extension update script
  In-Reply-To: <24fbcf75-04d2-9d10-ac12-c99fe4ca96a4@dalibo.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