Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMDoK-0000RX-EM for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Mar 2021 17:48:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lMDoI-0001oy-Qe for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Mar 2021 17:48:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMDoI-0001op-JP for pgsql-hackers@lists.postgresql.org; Tue, 16 Mar 2021 17:48:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMDoG-0003ak-HE for pgsql-hackers@postgresql.org; Tue, 16 Mar 2021 17:48:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 12GHmb3r3360175; Tue, 16 Mar 2021 13:48:37 -0400 From: Tom Lane To: Robert Haas cc: Mark Dilger , Noah Misch , Peter Geoghegan , Thomas Munro , "Andrey M. Borodin" , Stephen Frost , Michael Paquier , Amul Sul , Dilip Kumar , Andres Freund , PostgreSQL-development Subject: Re: pg_amcheck contrib application In-reply-to: References: <9E76E46A-48B2-4869-BD0C-422204C1F767@enterprisedb.com> <20210313184612.GA3195145@rfd.leadboat.com> <930621E5-5D10-456D-8CE4-CF629A6C4669@enterprisedb.com> <20210313191841.GB3195145@rfd.leadboat.com> <3012106.1615827854@sss.pgh.pa.us> <3053552.1615834640@sss.pgh.pa.us> <20210316060913.GA3323238@rfd.leadboat.com> <7BCE9084-9381-471F-90F2-FAD99B7FE3DB@enterprisedb.com> <3254547.1615910855@sss.pgh.pa.us> <7CFAF7EF-4EA7-4CB6-B2C7-EC7F4512AE50@enterprisedb.com> <16B79A18-48F3-404D-8DC5-53528E85A7AC@enterprisedb.com> Comments: In-reply-to Robert Haas message dated "Tue, 16 Mar 2021 12:56:40 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3360173.1615916917.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 16 Mar 2021 13:48:37 -0400 Message-ID: <3360174.1615916917@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Tue, Mar 16, 2021 at 12:51 PM Mark Dilger > wrote: >> It shows them all has having attalign =3D 'd', but for some array types= the alignment will be 'i', not 'd'. So it's lying a bit about the conten= ts. But I'm now confused why this caused problems on the two hosts where = integer and double have the same alignment? It seems like that would be t= he one place where the bug would not happen, not the one place where it do= es. > Wait, so the value in the attalign column isn't the alignment we're > actually using? I can understand how we might generate tuples like > that, if we pass the actual type to construct_array(), but shouldn't > we then get garbage when we deform the tuple? No. What should be happening there is that some arrays in the column get larger alignment than they actually need, but that shouldn't cause a problem (and has not done so, AFAIK, in the decades that it's been like this). As you say, deforming the tuple is going to rely on the table's tupdesc for alignment; it can't know what is in the data. I'm not entirely sure what's going on, but I think coming at this with the mindset that "amcheck has detected some corruption" is just going to lead you astray. Almost certainly, it's "amcheck is incorrectly claiming corruption". That might be from mis-decoding a TOAST-referencing datum. (Too bad the message doesn't report the TOAST OID it probed for, so we can see if that's sane or not.) regards, tom lane