Unexpected update behaviour - Mailing list pgsql-general

From Victor Yegorov
Subject Unexpected update behaviour
Date
Msg-id CAGnEboiorcnbvNwNqV+mS1rALG9DjE_SL44bUjOCbx8Lkw_+Rw@mail.gmail.com
Whole thread Raw
Responses Re: Unexpected update behaviour  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Greetings.

I've hit a strange issue. This is a simplified setup.
First, run create.sql to get a couple of tables.
Then, run the update query.

Tested on 9.2.6 and 9.3.2.

Now:
- if I remove the UNION ALL part of the inner query, UPDATE works;
- if I move the `raw` subquery into the CTE, UPDATE works (but takes
  hours on my full data);
- if I convert this UPDATE into a SELECT, I get the row to be updated.

Could you kindly explain me why the query as it is updates no records?


--
Victor Y. Yegorov
Attachment

pgsql-general by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Grouping, Aggregate, Min, Max
Next
From: Roy Anderson
Date:
Subject: Data Guard for Postgres?