Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x6V3R-000Gz7-10 for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Sep 2026 15:26:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x6V3Q-002T2L-27 for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Sep 2026 15:26:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x6V3Q-002T2D-0M for pgsql-hackers@lists.postgresql.org; Tue, 15 Sep 2026 15:26:40 +0000 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x6V3L-00000000awM-1dnj for pgsql-hackers@lists.postgresql.org; Tue, 15 Sep 2026 15:26:39 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 6EE207A01DC; Tue, 15 Sep 2026 11:26:33 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-02.internal (MEProxy); Tue, 15 Sep 2026 11:26:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burd.me; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1789485993; x=1789572393; bh=JHhGEjiBS/ zriZ10VRnSDe6d3q+yZKxFaLiO7hEmyB4=; b=pIbyJDiXYh5YXWhBa6uMBGCfC5 m2fut7Z2Pas0oKekVwszNrU+swGG/bYh9ZSlkC+0NHAZ9jDwIscaahH4yiAPmR5z SC3lujPvabX3cVY4kAzPBU8XlZBC4PIE3kV8EDgeNnVzWROJfocg7DT1aMOiizwY jJbUDj7Ibp+DuN/2Wu1mGAFbpszJNXXTo/hrdrbFc0XJrEyE6uk03FkV0vLQQiE4 XfQlEW77ofPEhH7WQzAwthCaZX880zsEu9pyLEM3n/ohpoGfLIqHNbjqCLHmovHk 8Ij4imiRu6QP4cx6d0VE2x8gqenmy94gPmwyuywsxhpiMbq2tLfJgEZb3/hQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1789485993; x=1789572393; bh=JHhGEjiBS/zriZ10VRnSDe6d3q+yZKxFaLi O7hEmyB4=; b=DHboGmEq61Dg0UnKkbPlbSFaV2PBRfbOBwHH4YAx1zbSJxRgJO9 BxcjGc31aUs5PZtar75xVa6mmp1JywKYl7CYX9/IA781Wk9mKNC+YBmH/wLqUq/U pCSGjIsCqEz9/M1b76d5PFTCLhzIkfkoXyhysRzqXLyyzeH82HxepGyPenciCp9C 3+10e//gagBOwwPFHk2uH/S/iQnhrfXNgMcwQUxCThVkgq9MyU1OGrwpwZqH3qJP eFMdQAHKWnQA6kFCuvdnH3h6uJO4WP4IYn8lt4Hcyi/jlhMzwyFCroK20Y/h7o1y RYnpur7akZBCHvALsAi8AoKReX/1bmn9RYA== X-ME-Sender: X-ME-Proxy-Cause: dmFkZTGk/a5VU933r8LojZ+CIFUsHgbNL6L/y/Ma+JLTrPtZFClglh6pik+cMlxAaZF2Dw BdQz3IJWunc/1w/wEqGRzerunRiitszrYFb9qMEr9VpCTkequzib4JjwtNVC+0d/q8VYlc lOWEctInePXHtaYqthQ5g0boPFytZHqgKk8bTaf2eqDYhcArjMqwmSyIoirycIc5mR5NgG wOlaGIAO9s+guj30fp11RuovfZfFdxgT3CIYSm0K9WFV8jaz29W/QUC310kCEP4s6G3meD UVDoU1tlvRL2DWhxaGV7mZzsFznl4diMJUuYF7itsxENok7WkYhiAQbPH6WuLsOgBiaRLl sOFM1YbB9BHVKet27Fz2sChJ5g7uzYMjuFaUKnXz62d1PB3W5WeG0Mc86VwRe/fsh2yiNR IL4iP55kD0PrSsRO7o+p1ocN2/FHnJCU7ZMUnMt8771jc9KmvkC1P7u2qnuUdgTobldpwd a5x+Z0dXcfgy0EY7mTNUP2xhLcVESJtFViZc0Bp3X2Ry2d1H9oS9YEgJD01XV/I6I4NXt8 HcEhkntA4LL5qWP7xKC7Z2qRZlhLxNCnYn5cewbuMvK6yA6jsYe2yA2BofWGn0XQYMJ0PK jlNkoQ1x8uXE3zTLa/T7WKR+jIiOKVCWBOUn0jaPMAvHCjgXCkR//nI1SpUQ X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id B757E70006B; Tue, 15 Sep 2026 11:26:32 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AndmbSv9Jwpo Date: Tue, 15 Sep 2026 11:26:11 -0400 From: "Greg Burd" To: "Michael Paquier" , "Bharath Rupireddy" Cc: "Yugo Nagata" , "PostgreSQL Hackers" Message-Id: <5c7124c4-c481-403c-b02d-cc80eaae94ef@app.fastmail.com> In-Reply-To: References: <4272005a-ca62-46be-aab3-8678187d84cd@app.fastmail.com> Subject: Re: Support for 8-byte TOAST values, round two Content-Type: multipart/mixed; boundary=81814454e0bd92f475094e2c7ca38c0aac8fae6c List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --81814454e0bd92f475094e2c7ca38c0aac8fae6c Content-Type: text/plain Content-Transfer-Encoding: 7bit On Tue, Sep 15, 2026, at 3:08 AM, Michael Paquier wrote: > On Mon, Sep 14, 2026 at 12:26:54PM -0700, Bharath Rupireddy wrote: >> v18-0001-Add-support-for-oid8-TOAST-values.patch: It looks good to me. >> v18-0002-Add-battery-of-tests-related-oid8.patch: It looks good to me. >> v18-0003-Add-support-for-TOAST-pointers-as-oid8.patch: It looks good to me. > Hello Michael, > One thing that neither you nor Greg pointed out is a disturbance I > have found in amcheck. Fair hit, and thanks for catching it. I read that hunk across several versions and never questioned the direction of the inference. Deriving the expected chunk size from the vartag is backwards in a corruption checker, since the vartag is part of what is under suspicion; the chunk_id type from the cached toast_rel is the trustworthy side, with the vartag then checked against it. I will be looking at amcheck differently from now on. > To me, applying the value set in the reloption at the moment of the dump > and not the chunk_id type feels like a natural thing to do. We still have > time to decide which behavior makes more sense for this release, but > choosing what the reloption holds at the time of the dump is a property > I'd prefer keep. I confirmed Bharath's case on f292187f375: create with oid8, load values with the counter past 2^32, then ALTER TABLE t8 RESET (toast_value_type); leaves reloptions null while chunk_id stays oid8, pg_dump then emits no WITH clause at all, and the restore comes back with an oid TOAST table. Data is intact and the IDs are simply reassigned small, so on a table this size nothing is lost. The part that gives me pause is the interaction with the case you raised upthread yourself: an oid8 table with more than four billion live values, dumped and restored into an oid TOAST table, spins in GetNewOidWithIndex(). RESET is the one step that gets a user there without ever asking for it. The dump carries no trace of the property that was dropped, so the first sign of trouble is a restore that does not finish, on exactly the tables big enough to have needed oid8. I do not think that argues against your semantics for the reloption in general, which I agree read naturally. It argues that a reset on a relation whose TOAST relation is already oid8 is the case worth treating specially. One observation on Bharath's 0001 while I am here: I do not think it actually conflicts with what you wrote. It applies the reloption when one is present, and only reads pg_attribute when there is none, so "applying the value set in the reloption at the moment of the dump" still holds under it. The two of you differ over the reloption-absent case, where there is no value set to apply, rather than over which of the two wins. Attached is a much smaller thing, offered to make the discussion concrete rather than as the answer. Report the loss at the point where it happens, and leave pg_dump alone entirely. =# ALTER TABLE t8 RESET (toast_value_type); WARNING: TOAST relation of "t8" keeps "oid8" as the type of its "chunk_id" DETAIL: The type in use is only read when the TOAST relation is created. HINT: Set "toast_value_type" to "oid8" to have a dump and restore preserve it. Only a reset naming toast_value_type reports; resetting other options on the same relation stays quiet, as does a reset on a relation whose TOAST relation uses oid, and the documented upgrade path of setting oid8 is untouched. Worth noting that the tests you committed in c68cba09dd7 already reset the option on toasttest_oid8, so the warning lands there and the expected output records it, which is the whole change outside tablecmds.c. If you would rather the dump carry the type, Bharath's 0001 is the better patch and this one should be dropped. My preference is either of them over the current behaviour. His 0002 on the migration docs seems worth having either way, and independent as you say. best. -greg --81814454e0bd92f475094e2c7ca38c0aac8fae6c Content-Disposition: attachment; filename*0="0001-Warn-when-a-reset-of-toast_value_type-drops-oid8-fro.pat"; filename*1="ch" Content-Type: application/octet-stream; name="=?UTF-8?Q?0001-Warn-when-a-reset-of-toast=5Fvalue=5Ftype-drops-oid8-fro.?= =?UTF-8?Q?patch?=" Content-Transfer-Encoding: base64 RnJvbSA2M2ZiMGVhMTNlODY3NjBhYjA0NjBiZjdmM2RkMTY1YmFmMzIwMzJkIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBHcmVnIEJ1cmQgPGdyZWdAYnVyZC5tZT4KRGF0ZTog VHVlLCAxNSBTZXAgMjAyNiAwNzo0NjozOSAtMDQwMApTdWJqZWN0OiBbUEFUQ0hdIFdhcm4g d2hlbiBhIHJlc2V0IG9mIHRvYXN0X3ZhbHVlX3R5cGUgZHJvcHMgb2lkOCBmcm9tIGEgZHVt cAoKdG9hc3RfdmFsdWVfdHlwZSBpcyByZWFkIG9ubHkgd2hlbiBhIFRPQVNUIHJlbGF0aW9u IGlzIGNyZWF0ZWQsIHNvIGEKcmVzZXQgbGVhdmVzIHRoZSBUT0FTVCByZWxhdGlvbiBhbG9u ZTogYSByZWxhdGlvbiBjcmVhdGVkIHdpdGggb2lkOAprZWVwcyBpdCwgYW5kIHBnX2F0dHJp YnV0ZSBiZWNvbWVzIHRoZSBvbmx5IHBsYWNlIHJlY29yZGluZyB0aGUgdHlwZSB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