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 1f4C3r-0004Dg-Gg for pgsql-general@arkaria.postgresql.org; Thu, 05 Apr 2018 21:04:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f4C3q-0003Ad-BM for pgsql-general@arkaria.postgresql.org; Thu, 05 Apr 2018 21:04:46 +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.89) (envelope-from ) id 1f4C3p-0003AT-W3 for pgsql-general@lists.postgresql.org; Thu, 05 Apr 2018 21:04:46 +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 1f4C3n-0008D7-I3 for pgsql-general@postgresql.org; Thu, 05 Apr 2018 21:04:44 +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 w35L4cdb025545; Thu, 5 Apr 2018 17:04:38 -0400 From: Tom Lane To: adsj@novozymes.com (Adam =?utf-8?Q?Sj=C3=B8gren?=) cc: pgsql-general@postgresql.org, Alvaro Herrera Subject: Re: ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100 In-reply-to: <87y3i1flgn.fsf@tullinup.koldfront.dk> References: <7pefuv53dl.fsf@novozymes.com> <871siqcdjh.fsf@tullinup.koldfront.dk> <87efmpllwg.fsf@tullinup.koldfront.dk> <20180117025021.GA39977@paquier.xyz> <874lnlc6ja.fsf@tullinup.koldfront.dk> <7632.1516209379@sss.pgh.pa.us> <87k1tlel41.fsf@tullinup.koldfront.dk> <17892.1522942621@sss.pgh.pa.us> <877eplej3o.fsf@tullinup.koldfront.dk> <87y3i1flgn.fsf@tullinup.koldfront.dk> Comments: In-reply-to adsj@novozymes.com (Adam =?utf-8?Q?Sj=C3=B8gren?=) message dated "Thu, 05 Apr 2018 22:27:04 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25543.1522962278.1@sss.pgh.pa.us> Date: Thu, 05 Apr 2018 17:04:38 -0400 Message-ID: <25544.1522962278@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk adsj@novozymes.com (Adam =?utf-8?Q?Sj=C3=B8gren?=) writes: >> [... still waiting for the result, I will return with what it said >> when the server does ...] > It did eventually finish, with the same result: Huh. So what we have here, apparently, is that regular MVCC snapshots think there is exactly one copy of the 1698936148/0 row, but TOAST fetches think there is more than one. This is darn odd, not least because we never do UPDATEs in toast tables, only inserts and deletes, so there certainly shouldn't be update chains there. It seems like you've got some corner case wherein SnapshotToast sees a row that isn't visible according to MVCC --- probably a row left over from some previous cycle of life. That is, I'm imagining the OID counter wrapped around and we've reused a toast OID, but for some reason there's still a row in the table with that OID. I'm not sure offhand how we could get into such a state. Alvaro, does this ring any bells (remembering that this is 9.3)? regards, tom lane