Re: Refactor code around GUC default_toast_compression
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-05-01T22:43:44Z
Lists: pgsql-hackers
Attachments
- v2-0001-Refactor-some-code-logic-around-GUC-default_toast.patch (text/plain) patch v2-0001
On Fri, May 01, 2026 at 02:44:07PM +0530, Ayush Tiwari wrote: > 1. The patch includes an unrelated hunk in > doc/src/sgml/ref/alter_index.sgml, adding text about `ALTER INDEX ... > ATTACH PARTITION`. That looks like an accidental carry-over from another > patch and shouldn't be there ig. Sorry about that. That feels like a rebase fart. > 2. The comment in src/include/access/toast_compression.h describing > default_toast_compression looks stale after this change? It still says > that the GUC value is one of the char values stored in > pg_attribute.attcompression, but the patch changes it to use the new > ToastCompressionGucValue enum values instead.(Maybe I'm > missing something) Nope, you are missing nothing. I was re-reading the patch and I think that we could just remove the whole paragraph. Even by doing so we lose no information. > 3. One minor point: CompressionIdToMethod() seems to be added as a public > helper, but I could not find any callers in this patch. Oops, removed. I may have used it at some point. > Also, > pg_column_compression() still keeps its own cmid-to-name switch. If the > intent is to centralize these mappings in the registry, perhaps that code > could use the new helper path as well, otherwise the unused helper may > not be necessary yet (though it might be in future). Yes, this is part of the extra tweaks that would be needed when added a new compression method. This part looks at a varlena pointer, retrieves the on-disk ID. So this is left as-is on purpose, like the direct TOAST decompress business based on varlena pointers. Attached is a v2, to keep the CI happy for as long as we can use it. -- Michael