| From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
|---|---|
| To: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Ajit Awekar <ajitpostgres(at)gmail(dot)com> |
| Subject: | Re: Allow table AMs to define their own reloptions |
| Date: | 2026-10-19 12:55:09 |
| Message-ID: | 5a619b3f-d045-40f5-aaa3-094195c0ee35@dunslane.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2026-10-11 Su 6:26 PM, Zsolt Parragi wrote:
>> That requires AMs to inherit standard option names rather than
>> redefine
> It looks a lot better this way, but shouldn't the documentation
> mention somewhere that AMs that don't do this, like
> dummy_custom_table_am can fail to restore --no-table-access-method
> dumps from other AMs?
>
> +
> +/* The standard options, all of which dummy_table_am accepts */
> +static const relopt_parse_elt dt_std_options[] = {
> + {"fillfactor", RELOPT_TYPE_INT,
> + offsetof(struct DummyTableOptions, std.fillfactor)},
>
> and
>
> + for (int j = 0; j < lengthof(dt_std_options); j++)
> + {
> + add_reloption_to_kind(dt_std_options[j].optname, dt_relopt_kind);
> + dt_relopt_tab[i++] = dt_std_options[j];
> + }
> +
>
> Wouldn't a helper be useful for this based on / around
> stdRdOptionsTab, so that it doesn't require this much fragile
> copy-pasting?
Hi, thanks (again) for the review. here's a v13 that I think addresses
your points.
Changes since v12:
- 0001: new add_std_reloptions_to_kind(), which makes all the
standard options valid for an AM's relopt_kind and copies their
parse table entries, for an AM whose options struct begins with a
StdRdOptions. NUM_STD_RELOPTIONS gives the number of entries, and
a static assertion keeps it in step with stdRdOptionsTab.
dummy_table_am uses it instead of its own copy of the table.
- 0001: fix tableam.h comments that referred to the old title of the
documentation section.
- 0002: tableam.sgml now says that a --no-table-access-method dump
can only be restored if the default access method accepts every
standard option set on the dumped tables, so an AM that supplies
amoptions should accept them all unless it has a good reason not to.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
| Attachment | Content-Type | Size |
|---|---|---|
| v13-0001-Add-amoptions-callback-to-table-access-methods.patch | text/x-patch | 63.4 KB |
| v13-0002-pg_dump-Set-table-AM-specific-storage-parameters.patch | text/x-patch | 25.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ilia Evdokimov | 2026-10-19 13:04:54 | Re: Fold NOT IN / <> ALL expressions containing NULL to FALSE |
| Previous Message | Tom Lane | 2026-10-19 12:20:43 | Re: fix more casting away of qualifiers |