Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jDZl6-0007Fu-5U for pgsql-general@arkaria.postgresql.org; Sun, 15 Mar 2020 20:21:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jDZl4-0006pJ-Ql for pgsql-general@arkaria.postgresql.org; Sun, 15 Mar 2020 20:21:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jDZl3-0006p9-Pd for pgsql-general@lists.postgresql.org; Sun, 15 Mar 2020 20:21:13 +0000 Received: from mout.gmx.net ([212.227.17.21]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jDZky-0000gj-Gd for pgsql-general@lists.postgresql.org; Sun, 15 Mar 2020 20:21:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1584303664; bh=ANc0NxvnXI62O9lBL6ccAS0nw/oq88UmWAAavE/2Pak=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=K1F9fdduN6dKDtNndwzyUi272QMfxFd2XRrXtO6PTdBgPWgEFa+nMw7PzPsFSvKLU 97mBBDrb6lsk5z2g8umOB/3o2TGqRlUF3fR1z1q/6Dmi48SXKrrOka5IWkXVBzo4Ye QEkrH7/P2EFkEgApTOIuEhHrALq4Q7Y9MOVQC3Qk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([89.14.78.216]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MAfYm-1j2bOK04XQ-00B2uH for ; Sun, 15 Mar 2020 21:21:04 +0100 Received: from ncq by hermes with local (Exim 4.92) (envelope-from ) id 1jDZkr-00039x-As for pgsql-general@lists.postgresql.org; Sun, 15 Mar 2020 21:21:01 +0100 Date: Sun, 15 Mar 2020 21:21:01 +0100 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: unexpected chunk number 2 (expected 0) for toast value ... in pg_toast_18536 Message-ID: <20200315202100.GO467@hermes.hilbert.loc> References: <20200315182349.GL467@hermes.hilbert.loc> <20200315192037.GM467@hermes.hilbert.loc> <3b7214bd-d0b5-e66f-fd29-240f1eb56cdf@aklaver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3b7214bd-d0b5-e66f-fd29-240f1eb56cdf@aklaver.com> Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) User-Agent: Mutt/1.10.1 (2018-07-13) Sender: X-Provags-ID: V03:K1:Ye526lD+vX7gibNK2pZ2jeltd50VrRGChnUfEyHsg3f8zdG6I4I 4itpe9RnEHIHFTcTeVmS0j3vnGGgmh8Tq4n4T/SDoRhAbxVgOUeYqRO+fBMcqZkWw1R0bmE uztvy6O4npYkbxa0SmENHxLO0oyWRuThGHydMs/IOaSLz8M51G3tz4jtjvmWAMiXXHIcVql dNfwnHmNDvUVyEzxdPONw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Kl3kJed0PYU=:OD9nTcSoV2KVx18FeyNzHY KhvyimzqnjHJX7Eh0koLG0W2kl1aWjMVyNRorKeQkQlnW/KiKzujsxumzdw61adyIjjrlpMQp Y7YQbXgtjzyt+6mSDFLKURLVdjjyz/gmQI67LkX2YxjWS6fdlhm7HNndjf1OxM3OVP86uWv9y fXQgRGPLVDe8Lu2+hImnktBZzdvVeR98qUb/9qDLq70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UX Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Mar 15, 2020 at 12:58:53PM -0700, Adrian Klaver wrote: > > > We then tried to DELETE the offending row > > > > > > delete from blobs.doc_obj where pk =3D 82224; > > > > > > but that, again, shows the "unexpected chunk" problem. > > > > According to > > > > http://www.databasesoup.com/2013/10/de-corrupting-toast-tables.html > > > > an UPDATE of the row is recommended -- should that work > > better than a DELETE ? > > > > I can't find documentation pointing to a fundamental > > implementation difference that suggests so. > > https://www.postgresql.org/docs/12/storage-toast.html#STORAGE-TOAST-ONDI= SK > > "During an UPDATE operation, values of unchanged fields are normally > preserved as-is; so an UPDATE of a row with out-of-line values incurs no > TOAST costs if none of the out-of-line values change." However, where is the fault in my thinking ? -> An UPDATE actually *would* change the TOASTed BYTEA field (which is cor= rupt). I had hoped that the DELETE would NOT have to touch the TOAST table at all (and thereby not check the chunks) as "all it needs to do" is mark the row in the *primary* table as not-needed-anymore. I must be misunderstanding something. Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B