=== Applying patches on top of PostgreSQL commit ID cc053b6e127763e4168f18585ca90a67600c270e === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Tue Sep 29 01:58:26 UTC 2026 On branch cf/4337 nothing to commit, working tree clean === using 'git am' to apply patch ./v40-0001-Allow-to-prolong-life-span-of-transition-tables-.patch === Applying: Allow to prolong life span of transition tables until transaction end === using 'git am' to apply patch ./v40-0002-Add-relation-option-incremental_view_maintenance.patch === Applying: Add relation option incremental_view_maintenance Using index info to reconstruct a base tree... M src/backend/access/common/reloptions.c M src/include/access/reloptions.h M src/include/utils/rel.h Falling back to patching base and 3-way merge... Auto-merging src/include/utils/rel.h Auto-merging src/include/access/reloptions.h Auto-merging src/backend/access/common/reloptions.c CONFLICT (content): Merge conflict in src/backend/access/common/reloptions.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Add relation option incremental_view_maintenance When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v40-0002-Add-relation-option-incremental_view_maintenance.patch === patching file src/backend/access/common/reloptions.c Hunk #1 succeeded at 163 with fuzz 2 (offset 52 lines). Hunk #2 FAILED at 120. Hunk #3 succeeded at 175 with fuzz 2 (offset 13 lines). Hunk #4 FAILED at 181. Hunk #5 succeeded at 198 (offset -1 lines). Hunk #6 succeeded at 248 (offset -1 lines). Hunk #7 succeeded at 257 (offset -1 lines). Hunk #8 succeeded at 266 (offset -1 lines). Hunk #9 succeeded at 275 (offset -1 lines). Hunk #10 succeeded at 284 (offset -1 lines). Hunk #11 succeeded at 293 (offset -1 lines). Hunk #12 succeeded at 302 (offset -1 lines). Hunk #13 succeeded at 311 (offset -1 lines). Hunk #14 succeeded at 320 (offset -1 lines). Hunk #15 succeeded at 329 (offset -1 lines). Hunk #16 succeeded at 338 (offset -1 lines). Hunk #17 succeeded at 346 (offset -1 lines). Hunk #18 succeeded at 354 with fuzz 1 (offset -1 lines). Hunk #19 succeeded at 363 (offset -1 lines). Hunk #20 succeeded at 372 (offset -1 lines). Hunk #21 succeeded at 416 (offset -1 lines). Hunk #22 succeeded at 432 (offset -1 lines). Hunk #23 succeeded at 441 (offset -1 lines). Hunk #24 succeeded at 450 (offset -1 lines). Hunk #25 succeeded at 459 (offset -1 lines). Hunk #26 succeeded at 468 (offset -1 lines). Hunk #27 succeeded at 572 (offset 9 lines). Hunk #28 FAILED at 2034. Hunk #29 succeeded at 2391 (offset 203 lines). 3 out of 29 hunks FAILED -- saving rejects to file src/backend/access/common/reloptions.c.rej patching file src/include/access/reloptions.h patching file src/include/utils/rel.h Hunk #1 succeeded at 376 (offset 20 lines). Hunk #2 succeeded at 442 (offset 28 lines). Unstaged changes after reset: M src/backend/access/common/reloptions.c M src/include/access/reloptions.h M src/include/utils/rel.h Removing src/backend/access/common/reloptions.c.rej === using 'git apply' to apply patch ./v40-0002-Add-relation-option-incremental_view_maintenance.patch === Applied patch to 'src/backend/access/common/reloptions.c' with conflicts. Applied patch to 'src/include/access/reloptions.h' cleanly. Applied patch to 'src/include/utils/rel.h' cleanly. U src/backend/access/common/reloptions.c diff --cc src/backend/access/common/reloptions.c index ea9a0417909,de21ad1507f..00000000000 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@@ -109,9 -109,18 +109,21 @@@ static relopt_bool boolRelOpts[] }, { { ++<<<<<<< ours ++======= + "autovacuum_enabled", + "Enables autovacuum in this relation", + RELOPT_KIND_HEAP | RELOPT_KIND_TOAST | RELOPT_KIND_MATVIEW, + ShareUpdateExclusiveLock + }, + true + }, + { + { ++>>>>>>> theirs "user_catalog_table", "Declare a table as an additional catalog table, e.g. for the purpose of logical replication", - RELOPT_KIND_HEAP, + RELOPT_KIND_HEAP | RELOPT_KIND_MATVIEW, AccessExclusiveLock }, false @@@ -345,10 -355,10 +366,10 @@@ static relopt_int intRelOpts[] { "log_autovacuum_min_duration", "Sets the minimum execution time above which vacuum actions by autovacuum will be logged", - RELOPT_KIND_HEAP | RELOPT_KIND_TOAST, + RELOPT_KIND_HEAP | RELOPT_KIND_TOAST | RELOPT_KIND_MATVIEW, ShareUpdateExclusiveLock }, - -1, -1, INT_MAX + -2, -1, INT_MAX }, { { @@@ -2126,114 -1983,65 +2147,173 @@@ static const relopt_parse_elt stdRdOpti bytea * default_reloptions(Datum reloptions, bool validate, relopt_kind kind) { ++<<<<<<< ours ++======= + static const relopt_parse_elt tab[] = { + {"fillfactor", RELOPT_TYPE_INT, offsetof(StdRdOptions, fillfactor)}, + {"autovacuum_enabled", RELOPT_TYPE_BOOL, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, enabled)}, + {"autovacuum_parallel_workers", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, autovacuum_parallel_workers)}, + {"autovacuum_vacuum_threshold", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_threshold)}, + {"autovacuum_vacuum_max_threshold", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_max_threshold)}, + {"autovacuum_vacuum_insert_threshold", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_ins_threshold)}, + {"autovacuum_analyze_threshold", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_threshold)}, + {"autovacuum_vacuum_cost_limit", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_limit)}, + {"autovacuum_freeze_min_age", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_min_age)}, + {"autovacuum_freeze_max_age", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_max_age)}, + {"autovacuum_freeze_table_age", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_table_age)}, + {"autovacuum_multixact_freeze_min_age", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_min_age)}, + {"autovacuum_multixact_freeze_max_age", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_max_age)}, + {"autovacuum_multixact_freeze_table_age", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_table_age)}, + {"log_autovacuum_min_duration", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, log_vacuum_min_duration)}, + {"log_autoanalyze_min_duration", RELOPT_TYPE_INT, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, log_analyze_min_duration)}, + {"toast_tuple_target", RELOPT_TYPE_INT, + offsetof(StdRdOptions, toast_tuple_target)}, + {"autovacuum_vacuum_cost_delay", RELOPT_TYPE_REAL, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_delay)}, + {"autovacuum_vacuum_scale_factor", RELOPT_TYPE_REAL, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_scale_factor)}, + {"autovacuum_vacuum_insert_scale_factor", RELOPT_TYPE_REAL, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_ins_scale_factor)}, + {"autovacuum_analyze_scale_factor", RELOPT_TYPE_REAL, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_scale_factor)}, + {"user_catalog_table", RELOPT_TYPE_BOOL, + offsetof(StdRdOptions, user_catalog_table)}, + {"parallel_workers", RELOPT_TYPE_INT, + offsetof(StdRdOptions, parallel_workers)}, + {"vacuum_index_cleanup", RELOPT_TYPE_ENUM, + offsetof(StdRdOptions, vacuum_index_cleanup)}, + {"vacuum_truncate", RELOPT_TYPE_TERNARY, + offsetof(StdRdOptions, vacuum_truncate)}, + {"vacuum_max_eager_freeze_failure_rate", RELOPT_TYPE_REAL, + offsetof(StdRdOptions, vacuum_max_eager_freeze_failure_rate)}, + {"incremental_view_maintenance", RELOPT_TYPE_BOOL, + offsetof(StdRdOptions, incremental_view_maintenance)} + }; + ++>>>>>>> theirs return (bytea *) build_reloptions(reloptions, validate, kind, sizeof(StdRdOptions), - tab, lengthof(tab)); + stdRdOptionsTab, + lengthof(stdRdOptionsTab)); +} + +/* + * find_reloption + * Look up a reloption of the given kind by name. + * + * Returns NULL if no such option can be set on relations of that kind. Note + * that names are unique only within a kind; "fillfactor", for example, is + * declared separately for heaps and for several index access methods. + */ +static relopt_gen * +find_reloption(const char *name, relopt_kind kind) +{ + if (need_initialization) + initialize_reloptions(); + + for (int i = 0; relOpts[i]; i++) + { + if ((relOpts[i]->kinds & kind) != 0 && + strcmp(relOpts[i]->name, name) == 0) + return relOpts[i]; + } + + return NULL; +} + +/* + * merge_toast_reloptions + * Fill in a TOAST table's unset options from its main table's. + * + * Any option that may be set on a TOAST table but was not is taken from + * main_opts. Either argument may be NULL; if both are, NULL is returned. + * Otherwise, the options to use are returned. + * + * An option counts as unset while it still holds the default declared for it + * above, which works because nothing a TOAST table accepts has a default the + * user could also set (see assert_toast_defaults_unsettable()). + * + * If the return value is not NULL, it is palloc'd. + */ +StdRdOptions * +merge_toast_reloptions(const StdRdOptions *toast_opts, + const StdRdOptions *main_opts) +{ + StdRdOptions *ret; + + /* if both arguments are NULL, return NULL */ + if (toast_opts == NULL && main_opts == NULL) + return NULL; + + /* if one argument is NULL, return the non-NULL one */ + ret = palloc_object(StdRdOptions); + if (toast_opts == NULL || main_opts == NULL) + { + memcpy(ret, main_opts ? main_opts : toast_opts, sizeof(StdRdOptions)); + return ret; + } + + /* replace unset TOAST relopts with the main table's */ + memcpy(ret, toast_opts, sizeof(StdRdOptions)); + for (int i = 0; i < lengthof(stdRdOptionsTab); i++) + { + const relopt_parse_elt *elem = &stdRdOptionsTab[i]; + relopt_gen *gen; + char *toast_val; + const char *main_val; + + /* skip anything that cannot be set on a TOAST table */ + gen = find_reloption(elem->optname, RELOPT_KIND_TOAST); + if (gen == NULL) + continue; + + toast_val = (char *) ret + elem->offset; + main_val = (const char *) main_opts + elem->offset; + + switch (gen->type) + { + case RELOPT_TYPE_TERNARY: + if (*(pg_ternary *) toast_val == PG_TERNARY_UNSET) + *(pg_ternary *) toast_val = *(const pg_ternary *) main_val; + break; + + case RELOPT_TYPE_INT: + if (*(int *) toast_val == ((relopt_int *) gen)->default_val) + *(int *) toast_val = *(const int *) main_val; + break; + + case RELOPT_TYPE_REAL: + if (*(double *) toast_val == ((relopt_real *) gen)->default_val) + *(double *) toast_val = *(const double *) main_val; + break; + + case RELOPT_TYPE_ENUM: + if (*(int *) toast_val == ((relopt_enum *) gen)->default_val) + *(int *) toast_val = *(const int *) main_val; + break; + + default: + elog(ERROR, "reloption \"%s\" has a type a TOAST table cannot inherit", + elem->optname); + } + } + + return ret; } /*