Re: Allow table AMs to define their own reloptions

From: Junwang Zhao <zhjwpku(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, Julien Tachoires <julien(at)tachoires(dot)me>
Subject: Re: Allow table AMs to define their own reloptions
Date: 2026-08-17 09:45:48
Message-ID: CAEG8a3JGpua_tW-NwSgHFjaYJFBJ7HxjPbGVm9w4KLzrNiC4-w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 15, 2026 at 5:46 AM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>
> Hello!
>
> +dummy_table_am behaves like a heap table but accepts a different
> +set of reloptions:
> +
> + - "fillfactor" (inherited from the core heap registration via
> + add_reloption_to_kind)
>
> +bool
> +RelationHasStdRdOptions(Relation relation)
> +{
> + if (relation->rd_options == NULL)
> + return false;
> + if (relation->rd_tableam == NULL)
> + return false;
> + return relation->rd_tableam->amoptions == NULL;
> +}
>
> dummy_table_am seems to accept but ignore fillfactor options with
> this, which based on the documentation above seem unintended?
>
> CREATE TABLE heap_ff10 (a int) WITH (fillfactor=10);
> CREATE TABLE dummy_ff10 (a int) USING dummy_table_am WITH (fillfactor=10);
>
> INSERT INTO heap_ff10 SELECT generate_series(1,200000);
> INSERT INTO dummy_ff10 SELECT generate_series(1,200000);
>
> SELECT relname, relpages,
> pg_size_pretty(pg_relation_size(oid)) AS size
> FROM pg_class
> WHERE relname IN ('heap_ff10','dummy_ff10')
> ORDER BY relname;
> relname | relpages | size
> ------------+----------+---------
> dummy_ff10 | 885 | 7080 kB
> heap_ff10 | 9091 | 71 MB
> (2 rows)
>

I think this might be due to the fact that dummy_table_am doesn't
handle the `fillfactor` itself, since it's just a test module, I think
it's ok.

> Also it isn't critical for the current tests, but it doesn't seem to
> support text columns, so that contradicts the generic behaves like
> heap claim a bit:
>
> CREATE TABLE t_txt (a int, b text) USING dummy_table_am;
> ERROR: only heap AM is supported
>
>

--
Regards
Junwang Zhao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-08-17 09:53:10 Re: Correct some doc items due to the REPACK
Previous Message Alexander Korotkov 2026-08-17 09:42:15 Re: Function scan FDW pushdown