Re: [GENERAL] Column rename in an extension update script
Julien Rouhaud <julien.rouhaud@dalibo.com>
From: Julien Rouhaud <julien.rouhaud@dalibo.com>
To: Philippe BEAUDOIN <phb.emaj@free.fr>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-05-02T19:45:26Z
Lists: pgsql-hackers, pgsql-general
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
Commits
-
Ensure commands in extension scripts see the results of preceding DDL.
- 9209e07605af 10.0 landed
- d56b8b41b32b 9.6.3 landed
- d0d3a57bfa18 9.5.7 landed
- c9d6c564f4b1 9.2.21 landed
- c6b3d07061b8 9.4.12 landed
- 062824edd953 9.3.17 landed
-
Stamp 9.6.2.
- 6a18e4bc2d13 9.6.2 cited