Re: Column rename in an extension update script

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Philippe BEAUDOIN <phb(dot)emaj(at)free(dot)fr>, pgsql-general(at)postgresql(dot)org
Subject: Re: Column rename in an extension update script
Date: 2017-05-03 17:29:57
Message-ID: 649.1493832597@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
> On 04/30/2017 11:54 PM, Philippe BEAUDOIN wrote:
>> 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.

> From the error it looks to me like the statements are each run in a
> separate session and the UPDATE is not seeing the ALTER TABLE.

No, it's in the same session; the problem is the lack of a
CommandCounterIncrement call between the ALTER's update and the parsing
of the next statement. That means the update isn't visible yet,
even in its own session. See the fix here:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9209e07605afe0349660447f20d83ef165cdd0ae

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Philippe BEAUDOIN 2017-05-03 17:36:58 Re: Column rename in an extension update script
Previous Message Adrian Klaver 2017-05-03 17:10:44 Re: Column rename in an extension update script

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-05-03 17:33:05 Re: CTE inlining
Previous Message Alvaro Herrera 2017-05-03 17:27:46 Re: WITH clause in CREATE STATISTICS