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 1wtStP-001HCt-2P for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Aug 2026 16:30:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wtStP-000J6K-0t for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Aug 2026 16:30:26 +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 1wtStO-000J6C-30 for pgsql-hackers@lists.postgresql.org; Mon, 10 Aug 2026 16:30:26 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wtStK-000000000ch-3L72 for pgsql-hackers@postgresql.org; Mon, 10 Aug 2026 16:30:26 +0000 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-4a456e44e01so986994b6e.1 for ; Mon, 10 Aug 2026 09:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786379420; x=1786984220; darn=postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=UadNxpY5YEhHHwG6rH0MNTiCmfN4uoCXIzXqGZbYUEo=; b=s5WEZlTWE8zpvX+P9qohPngsQu0Ckw68BLwdmPOOp97QoP3TmEkQOeopJRPzvSPG6D FhHEfymo2QaW/KKD/P5UHvJboQCBRVDEduuLmDYCDg1gLPPmBs1JPePD5BMMWF7e1xXZ N9hym8Y+BRyq2NDbSSBKrNWexaEE4B4Y7mg+AWSSv+fz5Pm4iENUrHLQuOPkFHLjn2UX sE/kwkz4woEsDHlGZuexe1dk/GZtgo09MhWXdb9bZ8HbceQIOVdMhFv9IfAyXtwOGvI3 PMtnA//hkTzfetedRW0+3Nxz5zmQmqN5kkHI1u0rLPkep0JVcUSqIICteoGhHcRVWdEd ByXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786379420; x=1786984220; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=UadNxpY5YEhHHwG6rH0MNTiCmfN4uoCXIzXqGZbYUEo=; b=h0j4TZ71D6D7KEAA8JqW+R91kk8/v4vtl8MTvFKGJttNSQjbx9suJkvBhPff3ZPJjr BZqgjpHhPcPaXtCoeKqPfOU3y8N59wl+ewEgLvVp5zTvrFzuBVsIeW8hUoaokQF4AzfT areZDHi5ooFz4UQNTzUGqvIvveWS1Y/GfSTftZhth7FMiMz1dtTHC25TBUBaaVb7DbMz DmZNAtJH5RvVmK+1G34019jW4ohB54GMzfLF9iBXk0FpHn8Q1XSSlqrSd0hyFqP4fewo dN/03tiGhxAspNJU3Sscp7Gv4d5A4QywMEggbCI6Fj+eWtE2vmNkM1mv0vNLfVXIC6/1 PFqg== X-Forwarded-Encrypted: i=1; AHgh+RoJwqo7hWJg59oYmeF0AP1/t8fdBUkE5j2srhy78dcsSteHbdIBjplCxNRgNxL+hAAiJGrAAd5kakQ5Tc95@postgresql.org X-Gm-Message-State: AOJu0YyEwdB2XLTNg1H1UOXsD0/kNg/bZcJYU5Bo2wrAzxvkI4P0lAEL vsSSBpgDXlubrU8San04UnFnr0KSXJGxZMz3zrCZqBwNStkJsjRc7f2J X-Gm-Gg: AR+sD10fRFtAX+5EqlOqgW2yzdNO54J6olK54peX039R3lh5MSQlnEMZ5oeH/FvGqqK UXb3zzwNp7PTlMiygh01XiYN1aWxPIpaY4AhWWvOfBtm6OwmjSfQ/yhrVV3d1QOWOpiO0uzBrHL wfNYJvwI1vJVfYqtRdJ1tUEfxTjWqQjUqtDI0mcp+biR9QB04aSIvIBH+eVTUP0qClCjCPT6SMi CIS+cxAipW6FhG9fpEU4YtmaskhVqp/cFPafMFxKi85S6O8E3cRy034tiTI4cTXSLXuOrEXkPUh lXuX/Yy6HFEIhhvIxHB0BHjeTICd6cxa+89AFTCXeUH0IKfB+oV1zCsqIsgIovG7WBpLndq7SnE nc0UfNZkukMCd+xhsp9Kdm9qySwDsxUNjggDrjJSQ8v9nok7ARiOGq27aeRHmQxkeDusCynYvw8 OdJ40EV1HFG3jfekpD+xnKDZaGBfu3PvFf+SxIVFB3/zTy0aqTfVYa+TvottUuuZChd3TogOVDw Ho8jFMAUEAnQzVAXoN/5cptmykBl+jvpYCvhQaTAYFhkjrhFpFBTWLxTzc= X-Received: by 2002:a05:6808:1b90:b0:4a3:95f3:68e with SMTP id 5614622812f47-4afaddfbde6mr23145972b6e.9.1786379420316; Mon, 10 Aug 2026 09:30:20 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b1af63f393sm6577963b6e.16.2026.08.10.09.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 09:30:19 -0700 (PDT) Date: Mon, 10 Aug 2026 11:30:17 -0500 From: Nathan Bossart To: Greg Burd Cc: solai v , Nikita Malakhov , Michael Paquier , pgsql-hackers Subject: Re: problems with toast.* reloptions Message-ID: References: <896e1dbc-5ca1-4d9d-9f85-ae5a2ccac4f4@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <896e1dbc-5ca1-4d9d-9f85-ae5a2ccac4f4@app.fastmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Aug 09, 2026 at 09:37:49AM -0400, Greg Burd wrote: > Am I misunderstanding this? It seems to me that making autovacuum_enabled > a ternary and then merging it means a heap table with > autovacuum_enabled=false and some toast.* option set now stops > autovacuuming the TOAST table. > > [...] > > So main enabled=PG_TERNARY_FALSE + toast unset -> toast enabled becomes > PG_TERNARY_FALSE -> av_enabled is false. Today's all-or-nothing bug > leaves that TOAST table getting vacuumed. I agree the new behavior > matches the documented contract, but it is a behavior change for the > person who disabled autovac on a table they vacuum by hand and never > thought about the TOAST side. Wraparound is still forced, but ordinary > dead-tuple bloat on the TOAST relation is now on them. So, maybe a line > in the commit message and in the CREATE TABLE docs to make that more > explicit would help people avoid making that mistake in practice? Eh... I don't see much reason to worry about making relopts work how they're documented. I mean, that's the whole point of this patch. You could make roughly the same argument about every other reloption with a corresponding TOAST setting. From asking around, I get the idea that setting toast.* relopts is pretty rare, anyway. Perhaps there's an argument for improving the docs to make this behavior a little more apparent, but I think we can take care of that separately. > In merge_autovac_opts() the four offset arrays keyed by "which sentinel > means unset", is that duplicating knowledge that already lives in the > relopt tables in reloptions.c? > > [...] > > Add an AutoVacOpts field, or change a field's default sentinel, and > forget to update the matching array here, and the merge silently keeps > the TOAST table's default instead of inheriting, nothing fails to compile > and no test goes red. Can this be driven off the relopt metadata > (relopt_parse_elt already knows each option's type and default) instead > of the hand-maintained offset arrays? I'm looking into this. Since this is almost certainly a master-only change at this point, it seems reasonable to spend some more time on making this stuff less fragile. > On testing: the coverage doesn't touch the risky code. There's one > injection-point case, and it's manual VACUUM only, index_cleanup/truncate > only: > > +-- TOAST table inherits main table's resolved values > +CREATE TABLE vac_tab_toast_inherit(i int, j text) WITH > + (autovacuum_enabled=false, > + vacuum_index_cleanup=false, > + vacuum_truncate=false, toast.vacuum_truncate=true); > +VACUUM vac_tab_toast_inherit; > +DROP TABLE vac_tab_toast_inherit; > > Nothing exercises the autovacuum decision path, autovacuum_enabled > inheritance, or any of the numeric AutoVacOpts that merge_autovac_opts() > actually resolves which is precisely the code I'm worried about above. > FWIW the pg_stat_get_autovacuum_scores() SRF that 0005 extends looks like > it could drive a deterministic test of the autovac path (compute the > decision without spawning a worker), which sidesteps the flakiness worry > raised upthread. Will add some more coverage. > In summary, solid work and I hope it lands. Just a few small issues to > clean up. Thanks for reviewing. -- nathan