Re: Allow table AMs to define their own reloptions

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Julien Tachoires <julien(at)tachoires(dot)me>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow table AMs to define their own reloptions
Date: 2026-06-03 23:02:11
Message-ID: ea1c4d33-0780-473c-96dc-1468cf733a04@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2025-05-26 Mo 7:06 AM, Julien Tachoires wrote:
> On Sat, Mar 29, 2025 at 08:46:01AM +0100, Julien Tachoires wrote:
>> On Sun, Mar 02, 2025 at 02:23:54PM +0100, Julien Tachoires wrote:
>>> On Sun, Mar 02, 2025 at 09:56:41AM +0100, Julien Tachoires wrote:
>>>> With the help of the new TAM routine 'relation_options', table access
>>>> methods can with this patch define their own reloptions
>>>> parser/validator.
>>>>
>>>> These reloptions can be set via the following commands:
>>>> 1. CREATE TABLE ... USING table_am
>>>> WITH (option1='value1', option2='value2');
>>>> 2. ALTER TABLE ...
>>>> SET (option1 'value1', option2 'value2');
>>>> 3. ALTER TABLE ... SET ACCESS METHOD table_am
>>>> OPTIONS (option1 'value1', option2 'value2');
>>>>
>>>> When changing table's access method, the settings inherited from the
>>>> former TAM can be dropped (if not supported by the new TAM) via: DROP
>>>> option, or, updated via: SET option 'value'.
>>>>
>>>> Currently, tables using different TAMs than heap are able to use heap's
>>>> reloptions (fillfactor, toast_tuple_target, etc...). With this patch
>>>> applied, this is not the case anymore: if the TAM needs to have access
>>>> to similar settings to heap ones, they have to explicitly define them.
>>>>
>>>> The 2nd patch file includes a new test module 'dummy_table_am' which
>>>> implements a dummy table access method utilized to exercise TAM
>>>> reloptions. This test module is strongly based on what we already have
>>>> in 'dummy_index_am'. 'dummy_table_am' provides a complete example of TAM
>>>> reloptions definition.
>>>>
>>>> This work is directly derived from SadhuPrasad's patch here [2]. Others
>>>> attempts were posted here [1] and here [3].
>>>>
>>>> [1] https://www.postgresql.org/message-id/flat/429fb58fa3218221bb17c7bf9e70e1aa6cfc6b5d.camel%40j-davis.com
>>>> [2] https://www.postgresql.org/message-id/flat/CAFF0-CG4KZHdtYHMsonWiXNzj16gWZpduXAn8yF7pDDub+GQMg(at)mail(dot)gmail(dot)com
>>>> [3] https://www.postgresql.org/message-id/flat/AMUA1wBBBxfc3tKRLLdU64rb.1.1683276279979.Hmail.wuhao%40hashdata.cn
>>> Please find a new version including minor fixes: 'TAM' terms are
>>> replaced by 'table AM'
>> Please find a new rebased version.
> New rebased version.
>

This thread seems to have gone dormant, sadly. Here's a fresh attempt I
made (with assistance from Claude), before I was aware of the existence
of this and other efforts. I think it meets most of the previous
objections, and is in line with what we do for Index AMs.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Attachment Content-Type Size
v1-0001-Add-amoptions-callback-to-table-access-methods.patch text/x-patch 50.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2026-06-03 23:03:20 Re: Heads Up: cirrus-ci is shutting down June 1st
Previous Message Joel Jacobson 2026-06-03 22:19:54 Re: PostgreSQL 19 Beta 1 release announcement draft