Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eh4N0-0004Fc-BJ for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Feb 2018 02:12:58 +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 1eh4Mx-0006Kd-PL for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Feb 2018 02:12:55 +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 1eh4Mx-0006KT-FK for pgsql-hackers@lists.postgresql.org; Thu, 01 Feb 2018 02:12:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eh4Mu-0002nJ-JT for pgsql-hackers@postgresql.org; Thu, 01 Feb 2018 02:12:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w112Cp8N022959; Wed, 31 Jan 2018 21:12:51 -0500 From: Tom Lane To: Yugo Nagata cc: pgsql-hackers@postgresql.org Subject: Re: CURRENT OF causes an error when IndexOnlyScan is used In-reply-to: <20180201014444.f78358df.nagata@sraoss.co.jp> References: <20180201013349.937dfc5f.nagata@sraoss.co.jp> <20180201014444.f78358df.nagata@sraoss.co.jp> Comments: In-reply-to Yugo Nagata message dated "Thu, 01 Feb 2018 01:44:44 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22957.1517451171.1@sss.pgh.pa.us> Date: Wed, 31 Jan 2018 21:12:51 -0500 Message-ID: <22958.1517451171@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Yugo Nagata writes: > I'm sorry the patch attached in the previous mail is broken and > not raises a compile error. I attached the fixed patch. This patch is almost certainly wrong: you can't assume that the scan-level state matches the tuple we are currently processing at top level. Any sort of delaying action, for instance a sort or materialize node in between, would break it. We need to either fix this aspect: >> IndexOnlyScan returns a virtual tuple that doesn't have system >> column, so we can not get ctid in the same way of other plans. or else disallow using IndexOnlyScan when the ctid is needed. regards, tom lane