Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePSoA-0003fr-2i for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Dec 2017 12:40:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePSo9-0004pj-Ev for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Dec 2017 12:40:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ePOLc-00013Z-CB for pgsql-bugs@lists.postgresql.org; Thu, 14 Dec 2017 07:54:28 +0000 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ePOLZ-0005Z5-D4 for pgsql-bugs@postgresql.org; Thu, 14 Dec 2017 07:54:26 +0000 Received: by mail-lf0-x234.google.com with SMTP id i2so5526508lfe.9 for ; Wed, 13 Dec 2017 23:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=zg59+kFv1mHcxTP/0Q9U8Pq5vm+Ons2QDP5GCMVll3M=; b=sU+DhyOujfqnAc/uiuaXrozW6QByWtKp2XkAN+1mtqoZqCa1RQ8kCdWYHcJumrbxuB sgmIiml0p2UZIMHs6TFPoDUQGjxl37uv9g3EM6hJIcRe6mOn6IqAaNp2wReohb0aeHxo l82pO4zFbhYScvp37v/J7iNLQIeKm2pYpm8dg4tqZYxVYaO7G4md7pwsvsRJP9ggFpIV 89XkUzSipnLi3F/M4hPfWPszahold6bH1V7uiyzEBdb5FZbJ2Zk9YJQYwmJ6lWj4FN3g 5pptuviR9zrQMa3JkHzPa4RyXirYBVJpWlaWI26jHETruRlAaqNZFx7tq8BzNx5yakTa vNqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=zg59+kFv1mHcxTP/0Q9U8Pq5vm+Ons2QDP5GCMVll3M=; b=h+WUjgb66D1tz+8wVQLsNKuBzV8EbreQOc1PXeAPAUMFxCJhjGX14AjuVuJ8nKDKW2 hEzDfRCxtSpdZrpwAgI1YNvaRAGtdggfb0A7iANddFurI5w33vXz7ehrM8WbmDsxkEED ZVssqqD6/ZmYD2DrFjcl0eL8YuFPWHv4Ljwv1pnmcKk6tmJQvHo0DCE7fQSxSTIh7iL4 eunSPpkMc1k7tN1G9HSE24Yv6rrBrbX2v21seQLjQxeEi8WMQ02FrqawQW/s7riE4yuQ yxKvv9cUpzdGp4dUQhyHfre1NQFybR7fJ56sascu6CvBA67dxCFfzjNyhwNbUn41nOqF cvfA== X-Gm-Message-State: AKGB3mJz5XiMQ15TuaZAoHB0tJtl3eL30F+lP6Q9dAZR+unVIdVoGWF+ orqvtRSuJHuzo5y/MDvSXuxkJg== X-Google-Smtp-Source: ACJfBovz9Cxs8BfT5LM+KBz1tigTWWGkvZaLG2PN71qW3+qSFSIriFz2AblyY0GDt7K/a9HPlj8dbg== X-Received: by 10.46.70.18 with SMTP id t18mr3082210lja.120.1513238061529; Wed, 13 Dec 2017 23:54:21 -0800 (PST) Received: from [192.168.1.3] ([89.223.47.214]) by smtp.googlemail.com with ESMTPSA id y3sm622282ljd.62.2017.12.13.23.54.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 23:54:20 -0800 (PST) Subject: Re: BUG #14972: row duplicate on first SELECT from CTE (by JOIN/FOR UPDATE) from which UPDATE performed recently To: "David G. Johnston" Cc: pgsql-bugs@postgresql.org References: <20171213191216.20144.83388@wrigleys.postgresql.org> From: Evgeniy Kozlov Message-ID: <75050b5d-b426-500d-e6bd-d7025a1d018d@gmail.com> Date: Thu, 14 Dec 2017 10:54:19 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------EC8910E5B197033516FDD7D1" Content-Language: ru-RU-yo List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------EC8910E5B197033516FDD7D1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 2017-12-13 23:14 (+03), David G. Johnston wrote: > On Wed, Dec 13, 2017 at 12:12 PM, >wrote: > > The following bug has been logged on the website: > > Bug reference:      14972 > Logged by:          Evgeniy Kozlov > Email address:      dsuchka@gmail.com > PostgreSQL version: 9.5.5 > Operating system:   gentoo, debian > Description: > > Since ON CONFLICT does not work with partitions, I have designed an > aggregation appender by hand using UPDATE (for existed rows) + > INSERT (for > new ones). Unexpectedly I got a strange result as a count of > updated (really > joined) rows running that function cuncurrently on 9.5.5 and 9.5.7 > (9.5.2 > works correctly). > The got value exceeds the expected result by 1 > > > ​Can you run this against 9.5.10 and see if it is still a problem?  > Its seems the last couple of bug fix patches covered something that > sounds familiar. > > David J. Just tested on 9.5.10 and 9.6.6 — both have the same problem. Best regards, Evgeniy Kozlov. --------------EC8910E5B197033516FDD7D1 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

2017-12-13 23:14 (+03), David G. Johnston wrote:

On Wed, Dec 13, 2017 at 12:12 PM, <dsuchka@gmail.com> wrote:
The following bug has been logged on the website:

Bug reference:      14972
Logged by:          Evgeniy Kozlov
Email address:      dsuchka@gmail.com
PostgreSQL version: 9.5.5
Operating system:   gentoo, debian
Description:

Since ON CONFLICT does not work with partitions, I have designed an
aggregation appender by hand using UPDATE (for existed rows) + INSERT (for
new ones). Unexpectedly I got a strange result as a count of updated (really
joined) rows running that function cuncurrently on 9.5.5 and 9.5.7 (9.5.2
works correctly).
The got value exceeds the expected result by 1

​Can you run this against 9.5.10 and see if it is still a problem?  Its seems the last couple of bug fix patches covered something that sounds familiar.

David J.
Just tested on 9.5.10 and 9.6.6 — both have the same problem.

Best regards, Evgeniy Kozlov.
--------------EC8910E5B197033516FDD7D1--