Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Anssi Kääriäinen <anssi(dot)kaariainen(at)thl(dot)fi>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Date: 2014-12-20 21:56:52
Message-ID: CAM3SWZT=HptrGyihZiyT39sPBhp+CXOTW=MhNFzXiLf-Jh4QVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 18, 2014 at 9:31 AM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
>> So I think there needs to be some kind of logic to de-recognize the table
>> alias "foo".
>>
>> Once I rewrote the query to use TARGET and EXCLUDED correctly, I've put this
>> through an adaptation of my usual torture test, and it ran fine until
>> wraparound shutdown. I'll poke at it more later.
>
> Oops. I agree with your diagnosis, and will circle around to fix that
> bug in the next revision

Attached patch fixes the bug. I'm not delighted about the idea of
cutting off parent parse state (the parse state of the insert) within
transformUpdateStmt() only once we've used the parent state to
establish that this is a "speculative"/auxiliary update, but it's
probably the path of least resistance here.

When this is rolled into the next version, there will be a testcase.

Thanks
--
Peter Geoghegan

Attachment Content-Type Size
target_ref_bugfix.patch text/x-patch 895 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Adam Brightwell 2014-12-20 23:12:46 Re: Role Attribute Bitmask Catalog Representation
Previous Message Peter Geoghegan 2014-12-20 21:14:25 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}