Re: Allow table AMs to define their own reloptions

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: 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-14 21:46:18
Message-ID: CAN4CZFO+NqeYE65rcV77150e0sQn3+wN1_N8aCtapeC9Kt_tTQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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)

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-08-14 22:37:53 Preserve statistics targets with ALTER TABLE ALTER COLUMN TYPE
Previous Message Sami Imseih 2026-08-14 21:26:25 Re: Report index currently being vacuumed in pg_stat_progress_vacuum