Skip to content

PG19 Merge#15

Open
fizaaluthra wants to merge 3 commits into
yugabyte:merge1from
fizaaluthra:yb-pg19-merge-final
Open

PG19 Merge#15
fizaaluthra wants to merge 3 commits into
yugabyte:merge1from
fizaaluthra:yb-pg19-merge-final

Conversation

@fizaaluthra

Copy link
Copy Markdown
Member

Based off of YB master commit 728cbe7cd353a7cb94465a87da8b5ad327a8af74

Resolution notes in pg19mergeresolutions.md

@fizaaluthra fizaaluthra requested a review from jasonyb May 7, 2026 21:16
@fizaaluthra fizaaluthra force-pushed the yb-pg19-merge-final branch from 37d41bb to 8d9de09 Compare May 11, 2026 18:58
@jasonyb

jasonyb commented May 11, 2026

Copy link
Copy Markdown

This merge is with random pg master commit 90630ec?

@jasonyb

jasonyb commented May 11, 2026

Copy link
Copy Markdown

(I believe this PR does not belong on yugabyte/yugabyte-db as this will never be merged. If you wanted to show the merge for review, it would have better been suited to be on your fork. Unless you intentionally wanted it as a public record to be present in parallel with what actually gets committed.)

@jasonyb jasonyb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review for nodeModifyTable.c:

It is confusing when "parameter" and "argument" are not used to distinguish signature names from passed in expressions. For example, "PG commit 80feb72 added existing as the new oldSlot parameter to ExecUpdate." and "YB commit 161efd6fe7dfa52896dd7e5c0c8641082ab4ef1d and a87fee24675c52723ac4dc9495acf344c165761c changed PG parameters conflictTid, NULL to ybTid, ybOldTuple." both mean arguments. existing is an argument; oldSlot is a parameter.

ExecInitStoredGenerated

  • Resolution regarding PG 7fee787 and YB not documented. It seems you accidentally labelled this under ExecComputeStoredGenerated.

ExecInitGenerated

  • Same.

ExecUpdateAct

  • I don't see anything about if (context->mtstate->operation == CMD_MERGE) PG c649fa2.

Will followup with execIndexing.c review.

Comment thread src/backend/executor/nodeModifyTable.c Outdated
Comment thread src/backend/executor/nodeModifyTable.c Outdated
Comment thread src/backend/executor/nodeModifyTable.c Outdated
@fizaaluthra fizaaluthra force-pushed the yb-pg19-merge-final branch from 8d9de09 to 66c0536 Compare June 1, 2026 21:18
@fizaaluthra

Copy link
Copy Markdown
Member Author

@jasonyb:
I don't see a ExecInitStoredGenerated(just ExecInitGenerated). Addressed everything else I believe.

@fizaaluthra fizaaluthra force-pushed the yb-pg19-merge-final branch from 66c0536 to c26d98e Compare June 1, 2026 21:24
Status as of this commit:
- Compiles in both release and debug builds on macOS
  (./yb_build.sh release --clean / ./yb_build.sh debug --clean).
- initdb fails (still to be fixed)
- Third-party extensions and pg_stat_statements excluded from the build
  pending follow-up work.

Conflict resolutions:

All these files share the same pattern: PG replaced `/* FALL THRU */` / `/* FALLTHROUGH */` / `/* fall through */` comments with the `pg_fallthrough;` macro. YB independently added `yb_switch_fallthrough()` macro calls for the same purpose. Both macros expand to `__attribute__((fallthrough))`, so `pg_fallthrough;` is sufficient.

- src/port/snprintf.c, contrib/btree_gin/btree_gin.c, contrib/pgcrypto/pgp-info.c, src/backend/access/transam/xlogrecovery.c, src/backend/regex/regc_lex.c, src/backend/regex/regcomp.c, src/backend/replication/walreceiver.c, src/backend/replication/walreceiverfuncs.c, src/backend/utils/adt/xml.c, src/backend/utils/sort/tuplestore.c, src/interfaces/libpq/fe-secure.c, src/pl/tcl/pltcl.c, src/timezone/zic.c, src/backend/executor/nodeHash.c, src/pl/plpgsql/src/pl_exec.c, src/tools/pg_bsd_indent/parse.c, src/backend/utils/adt/formatting.c, src/backend/utils/adt/jsonpath.c, src/backend/utils/mb/mbutils.c, src/interfaces/ecpg/pgtypeslib/interval.c, src/common/hashfn.c, src/backend/partitioning/partprune.c, src/common/wchar.c, contrib/pg_trgm/trgm_gin.c, contrib/pg_trgm/trgm_gist.c, src/backend/executor/nodeTidrangescan.c, src/backend/optimizer/util/clauses.c, src/backend/executor/nodeHashjoin.c:
    - all `pg_fallthrough` / `yb_switch_fallthrough()` conflict sites:
        - PG commit 8354b9d6b602ea549bc8d85cb404771505662a7b replaced fallthrough comments with `pg_fallthrough;` macro.
        - YB added `yb_switch_fallthrough()` macro calls for the same purpose (various YB commits per file).
        - Took PG's `pg_fallthrough;`. Both macros are functionally identical (`__attribute__((fallthrough))`), and PG's is the standard going forward.

LSM AM checks: PG commit ce62f2f2a0a48d021f250ba84dfcab5d45ddc914 generalized many `BTREE_AM_OID` checks using new fields (`amconsistentequality`, `amconsistentordering`, `amtranslatestrategy`, `amtranslatecmptype`). YB had added explicit `LSM_AM_OID` checks at those same sites. All such conflicts are resolved by taking PG's generalized form; LSM is covered because `ybcinhandler` sets these fields to the btree equivalents. See src/backend/access/yb_access/yb_lsm.c entry below for the ybcinhandler update.

- src/backend/access/yb_access/yb_lsm.c (ybcinhandler):
    - PG commit ce62f2f2a0a48d021f250ba84dfcab5d45ddc914 added `amconsistentequality`, `amconsistentordering`, `amtranslatestrategy`, and `amtranslatecmptype` to `IndexAmRoutine`.
    - YB added explicit `LSM_AM_OID` checks at those sites.
    - Took PG's generalized form; added `amconsistentequality=true`, `amconsistentordering=true`, `amtranslatestrategy=bttranslatestrategy`, `amtranslatecmptype=bttranslatecmptype` to `ybcinhandler`.

- src/backend/jit/jit.c:
    - `jit_enabled` declaration: PG commit 7f8c88c2b872cb74882ab93dcb05529dab2a10bc changed jit default to off; YB commit c1a4632453751094ada4a39ec26f97c7170d2567 added `/* YB: changed to false */` comment. Kept PG's declaration with YB comment.

- src/backend/catalog/partition.c:
    - `build_attrmap_by_name` call:
        - kept both PGG (`bool missing_ok`) and YB (`bool yb_ignore_type_mismatch`) arguments.

- src/backend/access/common/attmap.c:
    - `build_attrmap_by_name` definition and `build_attrmap_by_name_if_req` call: kept both PG and YB parameters/arguments.

- src/include/access/attmap.h:
    - `build_attrmap_by_name` declaration:
        - kept both PG and YB parameters.

- src/backend/storage/lmgr/s_lock.c:
    - copyright header comment: PG updated copyright year to 2026; YB added `YB: change 2 or so minutes to 30 seconds.` comment. Kept both.

- src/backend/utils/adt/int8.c:
    - includes: PG added `#include "utils/fmgroids.h"`, removed `#include "utils/lsyscache.h"`; YB added `#include <inttypes.h>`. Kept PG's `fmgroids.h` and YB's `<inttypes.h>`.

- src/backend/utils/sort/logtape.c:
    - `thisbuf` / `datablocknum` declarations:
        - adjacent line conflict.
        - PG commit b1e5c9fa9ac4399895bf312398c5d441baba0c3b changed `long datablocknum` to `int64 datablocknum`.
        - YB added null-pointer guard for `thisbuf` with explanatory comment.
        - Combined both: YB's changes + PG's `int64` type.

- src/bin/pg_upgrade/controldata.c:
    - shutdown check: PG removed `\n` from `"shut down"` comparison; YB added `!is_yugabyte_enabled() &&` guard. Combined both.

- src/test/regress/pg_regress.c:
    - psql binary name: PG added `-q` flag; YB renamed `psql` to `ysqlsh`. Combined: `"\"%s%sysqlsh\" -X -q"`.

- src/test/regress/regress.c:
    - includes and macros: PG added `TEXTDOMAIN` macro; YB added `#include "utils/syscache.h"`. Kept both: YB's include first, then PG's macro.

- src/backend/utils/hash/dynahash.c:
    - `HASH_ENTER_NULL` case reordering: PG commit 9c911ec065df0f660e3add65d986f95928914375 moved `case HASH_ENTER: case HASH_ENTER_NULL:`; YB had added `yb_switch_fallthrough()`. Took PG's changes.

- src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c:
    - `break` vs `yb_switch_fallthrough()`: PG changed to `break;` before `default:`; YB had `yb_switch_fallthrough();`. Took PG's `break;`.

- contrib/isn/isn.c:
    - `break` vs `yb_switch_fallthrough()`: same as big5.c above.

- contrib/auto_explain/auto_explain.c:
    - PG_MODULE_MAGIC + includes:
        - PG commit 9324c8c580655800331b0582b770e88c01b7a5c4 introduced `PG_MODULE_MAGIC_EXT` macro.
        - YB added `#include "pg_yb_utils.h"`.
        - Kept YB include + PG's `PG_MODULE_MAGIC_EXT`.
    - GUC variables:
        - PG commit e972dff6c30447ebcfa2f8601b67f926247463b6 added `auto_explain_log_extension_options` and related structs.
        - YB commit 2ff1d9624194b36973e92d03205c8797f648ae75 added `auto_explain_log_dist`. YB commit 5cf466690abb9c5bb78fbe13c5dc404751c28f50 added `auto_explain_log_debug` and `yb_auto_explain_debug_metrics_needed`.
        - Kept both. PG GUCs, then YB GUCs appended after PG GUCs, YB variables section placed after the GUCs, before the `auto_explain_option` structs.

- contrib/fuzzystrmatch/fuzzystrmatch.c:
    - PG_MODULE_MAGIC + includes:
        - PG changed to `PG_MODULE_MAGIC_EXT`.
        - YB added `#include "common/pg_yb_common.h"`.
        - Kept YB include + PG's `PG_MODULE_MAGIC_EXT`.

- contrib/pgcrypto/px-crypt.c:
    - crypt generator table:
        - PG commit 749a9e20c9790006f3af47f7a8faf4ad8dc358d9 added `sha256crypt` and `sha512crypt` entries.
        - YB commit d6368fb4ad6b9f2ed38d4967800de38c13074289 renamed 4 existing entries.
        - Kept YB's `yb_` prefixed names for existing entries + PG's new sha entries with original names.

- contrib/pgcrypto/px-crypt.h:
    - function declarations:
        - PG commit 749a9e20c9790006f3af47f7a8faf4ad8dc358d9 added sha256/sha512 declarations.
        - YB commit d6368fb4ad6b9f2ed38d4967800de38c13074289 added `yb_` prefix to 4 existing declarations.
        - Kept YB's `yb_` prefixed declarations + PG's new sha declarations. Add a YB_TODO_PG19MERGE to add a `yb_` prefix to the new functions.

- contrib/pg_trgm/trgm_regexp.c:
    - printSourceNFA, variable declarations:
        - PG commit cdaa67565867ba443afb66b9e82023d65487dc7c moved `int state` and `int i` into for-loop declarations.
        - YB commit d714b60297567789913c68f5937e5e16943ce6d9 added `const char *yb_tmp_dir = YbGetTmpDir();`.
        - Kept only YB's `yb_tmp_dir`.

- src/backend/nodes/nodeFuncs.c:
    - exprType() switch:
        - PG added `case T_MergeSupportFunc`.
        - YB added `case T_YbBatchedExpr`.
        - Kept both cases (PG first, YB after).
    - expression_tree_mutator T_MergeSupportFunc / T_YbBatchedExpr:
        - PG added `T_MergeSupportFunc` handler and removed `(Node *)` cast from `copyObject()`.
        - YB added `T_YbBatchedExpr` handler.
        - Kept PG's `T_MergeSupportFunc` (without cast) then YB's `T_YbBatchedExpr`.
    - expression_tree_mutator T_PartitionPruneStepCombine / T_YbPartitionPruneStepFuncOp:
        - PG removed `(Node *)` cast from `copyObject()` return.
        - YB added `T_YbPartitionPruneStepFuncOp` handler.
        - Kept PG's cast-free return + YB's new handler.

- src/backend/parser/parse_relation.c:
    - `selectedCols` / attribute number:
        - PG commit a61b1f74823c9c4f79c95226a461f1e7a367764b moved `selectedCols` from `RangeTblEntry` to `RTEPermissionInfo` (`perminfo->selectedCols`).
        - YB commit 1308c0d131c1344a290d7ab491e186e4850fb5cb replaced `FirstLowInvalidHeapAttributeNumber` with `YBGetFirstLowInvalidAttributeNumberFromOid(rte->relid)` (later touched by commit 06cd4073e15e99b983787faaa1fb5f9f717a5e04).
        - Combined both: `perminfo->selectedCols` with YB's attribute number function.

- src/backend/optimizer/prep/prepjointree.c:
    - PlannerInfo fields:
        - PG added `subroot->assumeReplanning = false`.
        - YB added `yb_cur_batched_relids` and other `yb_` batching fields.
        - Kept both: PG's field first, then YB's batching fields.

- src/backend/access/common/toast_compression.c:
    - default compression method:
        - PG commit 34dfca293432e206b8f80431f81535aff69782ca introduced `DEFAULT_TOAST_COMPRESSION` macro.
        - YB commit 40f556645f42e36ae80df470ba0c428d778b0c0b hardcoded `TOAST_LZ4_COMPRESSION`.
        - Took PG's `DEFAULT_TOAST_COMPRESSION` (which selects LZ4 if available).

- src/backend/access/index/indexam.c:
    - new functions:
        - PG commit c1ec02be1d79eac95160dea7ced32ace84664617 added `index_insert_cleanup()`.
        - YB added `yb_index_delete()` and `yb_index_update()`.
        - Kept both: PG's function first, then YB's functions.

- src/backend/access/table/toast_helper.c:
    - Datum/pointer conversion:
        - PG commit 0f5ade7a367c16d823c75a81abb10e2ec98b4206 wrapped `value` in `DatumGetPointer`.
        - YB PG15 initial merge 55782d561e55ef972f2470a4ae887dd791bb4a97 wrapped `value` in `PointerGetDatum`.
        - Took PG's `DatumGetPointer(value)`.

- src/backend/access/transam/xlog.c:
    - GUC defaults:
        - adjacent line conflict.
        - PG commit 8d140c58229d6224882f881d9b62ba06236e71d3 renamed `sync_method` to `wal_sync_method`.
        - YB commit 22b6a4730da37612836f17fc29d54790c78db952 changed `wal_level` default to `WAL_LEVEL_LOGICAL` with explanatory comment.
        - Kept PG's `wal_sync_method` + YB's `WAL_LEVEL_LOGICAL` default.

- src/backend/bootstrap/bootparse.y:
    - includes:
        - PG added `#include "bootparse.h"`.
        - YB added YB includes.
        - Kept both.

- src/backend/bootstrap/bootscanner.l:
    - token definitions:
        - PG commit 3e4bacb171001644583ac14e29ae1b09ce818c92 changed `yylval.kw` to `yylval->kw`.
        - YB commit be0908b45827c69ff010d9263ff865310ce722a1 added `yb_declare` and `primary` tokens.
        - Used PG's `yylval->kw` arrow syntax for all entries + adding YB's new tokens.

- src/backend/libpq/crypt.c:
    - includes and variables:
        - PG added `password_expiration_warning_threshold` and `md5_password_warnings`.
        - YB added YB includes (`pg_yb_utils.h`, `ybc_pggate.h`).
        - Kept both: YB includes first, then PG's variables.

- src/backend/commands/view.c:
    - includes and function declaration:
        - PG commit 20e58105badff383bd43f0b97e532771768f94df renamed `checkViewTupleDesc` to `checkViewColumns`.
        - YB added YB includes.
        - Kept YB includes + PG's renamed function declaration.

- src/backend/commands/dropcmds.c:
    - ownership check:
        - PG commit afbfc02983f86c4d71825efa6befd547fe81a926 changed `pg_namespace_ownercheck` to `object_ownercheck`.
        - YB commit cc010e90cb8c9634ea678f4c9b5b1f4a8b9a51f5 added `&& !is_yb_db_admin_droppable_object` guard (later touched by commit 06cd4073e15e99b983787faaa1fb5f9f717a5e04).
        - Combined both: PG's `object_ownercheck` + YB's admin guard.

- src/backend/replication/repl_gram.y:
    - snapshot_action alternatives:
        - PG added `K_UPLOAD_MANIFEST`.
        - YB added `K_YB_SEQUENCE`, `K_YB_HYBRID_TIME`, `K_YB_ROW`, `K_YB_TRANSACTION`.
        - Kept both: PG's entry first, then YB's entries.

- src/bin/psql/startup.c:
    - SetVariableHooks calls:
        - PG added `WATCH_INTERVAL` hook.
        - YB added `YB_DISABLE_ERROR_PREFIX` hook.
        - Kept both.

- src/backend/utils/adt/regexp.c:
    - RE_compile_and_cache variable declarations:
        - PG commit bea3d7e3831fa6a1395eadbad7d97cebc7aa8aee added `MemoryContext oldcontext`.
        - YB commit a20d9474f423a1d365c2eb2e25eea0d70646a166 added `cached_re_str *re_array = YbGetReCacheInfo().array`.
        - Kept both declarations.

- src/backend/nodes/read.c:
    - function definitions and ifdef guard:
        - PG commit a292c98d62ddc0ad681f772ab91bf68ee399cb4b changed `#ifdef WRITE_READ_PARSE_PLAN_TREES` to `#ifdef DEBUG_NODE_TESTS_ENABLED`.
        - YB added `ybDeserializeNode()` function.
        - Kept YB's function + PG's `DEBUG_NODE_TESTS_ENABLED` guard.

- src/backend/commands/constraint.c:
    - index_insert call:
        - PG commit 41d2c6f952edc4841763d05296b65f3c0edad4f2 added `index_insert_cleanup()` call after `index_insert()`.
        - YB commit 73bad43e870fa2d596e3ab09ca7ac1b4d44f2e75 added `false /* yb_shared_insert */` argument.
        - Kept both: YB's extra argument + PG's cleanup call.

- src/backend/executor/nodeBitmapIndexscan.c:
    - `tbm_create` call:
        - PG commit 041e8b95b8cd251bfec6a3c9c3dd6614de6a4c9b changed `work_mem * 1024L` to `work_mem * (Size) 1024`.
        - YB (commit a81450b9dbcb1690b9bfdbd547e458ec589651e9 and others) changed `tbm` to `bitmap`.
        - Kept both `(Size)` and `bitmap`

- src/backend/executor/nodeBitmapOr.c:
    - `tbm_create` call:
        - same as above

- src/backend/utils/sort/sortsupport.c:
    - `amcanorder` check: generalized AM check pattern

- src/backend/utils/adt/jsonb_util.c:
    - `uniqueifyJsonbObject` call and fallthrough:
        - PG changed `uniqueifyJsonbObject` and added `pg_fallthrough`.
        - YB added `yb_switch_fallthrough()`.
        - Took PG's new API + `pg_fallthrough`.

- src/backend/replication/logical/worker.c:
    - `ExecuteTruncateGuts` final argument:
        - PG added `!MySubscription->runasowner` argument.
        - YB added `false /* yb_is_top_level */` argument.
        - Kept both arguments: PG's first, then YB's.

- src/backend/optimizer/plan/setrefs.c:
    - set_subqueryscan_references:
        - PG added `record_elided_node()` call.
        - YB added some logic to deal with hint aliases.
        - Kept both: PG's `record_elided_node()` first, then YB's hint alias block.

- src/backend/optimizer/util/appendinfo.c:
    - add_row_identity_columns:
        - PG commit 5f2e179bd31e5f5803005101eb12a8d7bf8db8f3 removed `commandType == CMD_MERGE ||` from the if condition.
        - YB added an if `IsYBRelation` block and moved PG's if block into an else-if.
        - Put YB's `IsYBRelation` block first, then PG's condition (without `CMD_MERGE`) in `else if`.

- src/backend/postmaster/autovacuum.c:
    - `InitPostgres` call:
        - PG commit 15b4c46c328b25be9463db6d2960eeb16a784aad replaced two boolean params (`load_session_libraries`, `override_allow_connections`) with a single bitwise `flags` param (`INIT_PG_OVERRIDE_ALLOW_CONNS`).
        - YB commit caa636fcd02f59d0dfab103b52fd59703745ff64 removed a previously-YB-added `session_id` parameter from `InitPostgres`, reformatting the call onto one line in the process.
        - Took PG's version.

- src/backend/utils/adt/dbsize.c:
    - calculate_indexes_size:
        - PG commit b0a55e43299c4ea2a9a8c757f9c26352407d0ccc changed `rd_node` to `rd_locator`.
        - YB commit 8b2f5c5165700db851a1429bd6e92f157c1ca4b1 added `IsYBRelation(idxRel)` check with YB-specific `YBCPgGetTableDiskSize` call, and moved the PG code to the else block.
        - Kept YB's `IsYBRelation` block first, PG's `rd_locator`-based loop in the `else` branch.

- src/backend/commands/copyfrom.c:
    - CopyFromErrorCallback:
        - PG commit 97da48246d34807196b404626f019c767b7af0df added `relname_only` early-return logic, and PG commit a2145605ee3d92faccd769010059b110c44104ff changed `cstate->opts.binary` to `cstate->opts.format == COPY_FORMAT_BINARY`.
        - YB PG15 initial merge 55782d561e55ef972f2470a4ae887dd791bb4a97 added `pgstat_progress_update_param(PROGRESS_COPY_STATUS, CP_ERROR)`.
        - Kept both: YB's progress update first, then PG's relname_only guard.

- src/backend/commands/createas.c:
    - ExecCreateTableAs:
        - PG commit 4b74ebf726d444ba820830cad986a1f92f724649 added `RefreshMatViewByOid()` call for materialized views.
        - YB commit 159dde75013bf54db488e4959bc9b2011cda254d added `yb_xcluster_automatic_mode_target_ddl` block.
        - Kept both: PG's refresh call first, then YB's xCluster block.

- src/backend/executor/nodeSubplan.c:
    - ExecHashSubPlan:
        - PG commit 0f5738202b812a976e8612c85399b52d16a0abb6 changed `FindTupleHashEntry` API to use `lhs_hash_expr` instead of `lhs_hash_funcs`. PG commit abdeacdb0920d94dec7500d09f6f29fbb2f6310d removed `ExecClearTuple(slot)` calls and early returns, replacing them with a `result` variable assignment.
        - YB commit 49ed1065dabd2a9456b830c69b4bb8d584491ff8 added `node->hashtable->keyColIdx` as an extra argument to `FindTupleHashEntry`.
        - Took PG's changes, while keeping YB's `node->hashtable->keyColIdx` argument.

- src/backend/tcop/pquery.c:
    - CreateQueryDesc top of the function:
        - PG commit 1b105f9472bdb9a68f709778afafb494997267bd changed to `palloc_object(QueryDesc)`.
        - YB added `YbPgMemResetStmtConsumption()` call.
        - Kept YB's `YbPgMemResetStmtConsumption()` + PG's `palloc_object`.
    - CreateQueryDesc field assignment:
        - PG commit 2c16deee2f7d52d6567dcbad046f74a8e880ee52 changed `totaltime` to `query_instr`.
        - YB commit 536e4b1974268041302274d6a45ffba157d10283 added `yb_query_stats` field initialization.
        - Kept PG's `query_instr` + YB's `yb_query_stats`.

- src/bin/psql/tab-complete.in.c:
    - match_previous_words:
        - PG commit 4b3d173629f4cd7ab6cd700d1053af5d5c7c9e37 added `SPLIT PARTITION` completions. PG commit f2e4cc427951b7c46629fb7625a22f7898586f3a added `MERGE PARTITIONS` completions.
        - YB commit ec65f397d75beeec92182b8902ae7e1c41aa7c11 added `ALTER TABLEGROUP` completions (originally placed below TABLESPACE; PG15 initial merge commit 55782d561e55ef972f2470a4ae887dd791bb4a97 moved it above TABLESPACE, right after DETACH PARTITION).
        - Kept both: PG's partition completions first, then YB's tablegroup completions.

- src/bin/pg_dump/pg_dump.h:
    - DumpableObjectType enum:
        - PG commit 9a17be1e244a45a77de25ed2ada246fd34e4557d added `DO_SUBSCRIPTION_REL` and bumped `NUM_DUMPABLE_OBJECT_TYPES`.
        - YB added `DO_TABLEGROUP`.
        - Kept both: `DO_SUBSCRIPTION_REL` then `DO_TABLEGROUP`, `NUM_DUMPABLE_OBJECT_TYPES` set to `DO_TABLEGROUP + 1`.

- src/bin/pg_dump/pg_dump_sort.c:
    - `dbObjectTypePriority` array:
        - PG commit afd8ef39094b0dff9d1f2bfecb1d9fa056b85e19 changed to C99 designated initializer syntax. PG also added `DO_SUBSCRIPTION_REL` and `DO_REL_STATS` entries.
        - YB commit 01a8c97ac545386c3439f231e5da6a43492f7020 added `DO_TABLEGROUP` entry.
        - Took PG's designated initializer style + adding `[DO_TABLEGROUP] = PRIO_TABLEGROUP,`.

- src/bin/pg_dump/pg_backup.h:
    - _dumpOptions struct:
        - PG commit 67a2fbb8f9e9f75df08208e75da412c43a814688 added `restrict_key` field.
        - YB added YB-specific fields (`no_tablegroups`, etc.).
        - Kept both: PG's field first, then YB's fields.

- src/bin/pg_dump/common.c:
    - flagInhAttrs:
        - PG commit 8bf6ec3ba3a44448817af47a080587f3b71bee08 refined condition to `foundSameGenerated && !foundDiffGenerated` with `DUMP_COMPONENT_NONE`.
        - YB commit 6deb862d0affa6124c446098d94ec944405ffaae added `!dopt->include_yb_metadata` guard.
        - Combined PG's refined logic with YB's metadata guard.

- contrib/seg/Makefile:
    - REGRESS list:
        - PG commit 681d9e4621aac0a9c71364b6f54f00f6d8c4337f (CVE-2023-2454 fix) added `security` test. PG commit 68dfecbef210dc000271553cfcb2342989d4ca0f added `partition` test.
        - YB only has `seg`. YB did import PG commit 681d9e4621aac0a9c71364b6f54f00f6d8c4337f via commit dac89aaf39b11c794c4d9eb2e9a6db76a3d19c97, but it omit the test files and the Makefile change.
        - Took PG's `security seg partition`. The test files `security.sql` and `security.out` are present in PG19.

- src/backend/access/Makefile:
    - SUBDIRS:
        - PG commit 449e798c77ed9a03f8bb04e5d324d4e3cfbbae8e added `sequence` subdirectory. PG also changed to multi-line backslash format.
        - YB PG15 initial merge commit 55782d561e55ef972f2470a4ae887dd791bb4a97 added `yb_access` and `ybgin` subdirectories.
        - Kept PG's multi-line format with `sequence` + YB's `yb_access` and `ybgin`.

- src/backend/access/heap/heapam_handler.c:
    - heapam_relation_copy_for_cluster switch block:
        - PG commits 28d534e2ae0ac888b5460f977a10cd9bb017ef98 wrapped the switch block inside `if (!concurrent)` (for REPACK CONCURRENTLY), increasing indentation by one level. PG commit 852558b9ec9d54194195a7b7418d57e83a2fda70 changed `LockBuffer(buf, BUFFER_LOCK_SHARE)` to `LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE)` with detailed comment about hint bits. PG commit 8354b9d6b602ea549bc8d85cb404771505662a7b replaced `/* fall through */` comment with `pg_fallthrough;` inside the `HEAPTUPLE_RECENTLY_DEAD` case.
        - YB added `yb_switch_fallthrough()` after the `HEAPTUPLE_RECENTLY_DEAD` fall-through comment.
        - Took PG's changes.

- src/backend/access/index/genam.c:
    - systable_beginscan:
        - PG added an `Assert`.
        - YB added `IsYBRelation` early return to `ybc_systable_beginscan`.
        - Kept both: PG's assert first, then YB's `IsYBRelation` early return.

- src/backend/catalog/system_functions.sql:
    - function definitions:
        - PG commits 759b03b24ce96f0ba6d734b570d1a6f4a0fb1177 and f95d73ed433207c4323802dc96e52f3e5553a86c simplified creation of built-in functions with default arguments and non-default ACLs so that they no longer require definitions in system_functions.sql, only entries in pg_proc.dat
        - YB commits fc46b4029bf6762522eac4c8160cfb4ff3c5390d and c23b217504aa5fc7437977cf763c35d7f8468398 added YB-specific parameters to `pg_create_logical_replication_slot`.
        - Took PG's removal. YB's parameters will be handled in `pg_proc.dat`.

- src/backend/catalog/system_views.sql:
    - pg_replication_slots view columns: PG added columns; YB added columns. Kept both: PG's first, YB's appended.

- src/backend/catalog/toasting.c:
    - index_create() call:
        - PG commit 23382b0f8b21e3f5330d765d1abfcef58d086111 renamed variables (`collationIds`, `opclassIds`). PG commit 784162357130f63b5130cd6517db21451692f9b3 added first `NULL` argument, PG commit 6a004f1be87d34cfe51acf2fe2552d2b08a79273 added second `NULL` argument.
        - YB added YB-specific trailing parameters (`skip_index_backfill`, `is_colocated`, etc.) (last touched by lint changes 06cd4073e15e99b983787faaa1fb5f9f717a5e04).
        - Combined PG's renamed variables + YB's extra trailing parameters.

- src/backend/commands/collationcmds.c:
    - pg_import_system_collations locale handling:
        - PG commit bf03cfd162176d543da79f9398131abc251ddbb9 refactored to `create_collation_from_locale()` (which includes the ASCII filter internally).
        - YB commit 6c8deb0504274a16bae390dcbabf45aa5ac23fbb added `YBIsSupportedLibcLocale` filter.
        - Kept YB's locale filter before PG's `create_collation_from_locale()` call. (PG's ASCII filter is now after YB's locale filter).

- src/backend/executor/execScan.c:
    - ExecScan:
        - PG commit fb9f955025f7609fd3da0d7e33b77438ddc765de refactored ExecScan to call `ExecScanExtended()`.
        - YB added `yb_exec_params.limit_use_default = true`.
        - Kept PG's changes and moved YB's logic to `ExecScanExtended()` (in execScan.h).

- src/backend/lib/Makefile:
    - OBJS list:
        - PG commit 5af0263afd7beaf947e22115b7e9ade000b0387d removed `binaryheap.o`.
        - YB added `yb_percentile.o`.
        - Kept PG's removal of `binaryheap.o` and keeping YB's `yb_percentile.o`.

- src/backend/optimizer/path/equivclass.c:
    - end-of-file - new functions:
        - PG added new functions.
        - YB added `yb_find_ec_member_for_var`.
        - Kept both.

- src/backend/optimizer/prep/prepunion.c:
    - choose_hashed_setop function:
        - PG commit 8d96f57d5cc79c0c51050bb707c19bf07d2895eb removed `choose_hashed_setop`.
        - YB modified `choose_hashed_setop` with `IsYugaByteEnabled()` logic.
        - Left the function commented out with a YB_TODO_PG19MERGE.

- src/backend/replication/logical/origin.c:
    - replorigin_state_clear catalog deletion:
        - PG commit 3e577ff602fe3438ac60771c4a6d027d881619b0 removed `replorigin_drop_guts`, refactored it into `replorigin_state_clear` and moved the catalog tuple deletion logic into `replorigin_drop_by_name`.
        - YB commit 98b8079235fc30bf0f8365e48601999ca2cb3be7 and others added DDL transaction nesting logic inside `replorigin_drop_guts` and changed the CatalogTupleDelete call.
        - Accepted PG's changes and keeping YB's DDL nesting logic and CatalogTupleDelete call inside `replorigin_drop_by_name`.

- src/backend/replication/logical/Makefile:
    - OBJS list: PG added `applyparallelworker.o` and `conflict.o`; YB added `yb_decode.o` and `yb_virtual_wal_client.o`. Kept both: YB objects first, then PG's.

- src/backend/replication/logical/snapbuild.c:
    - includes and struct definition:
        - PG commit e2fd615ecc177493b9a961a640ec0dcc4a25755c moved `struct SnapBuild` definition to `snapbuild_internal.h`.
        - YB added `#include "pg_yb_utils.h"`.
        - `struct SnapBuild` has no YB-specific fields; kept YB's include, accepted PG's removal of the struct (now in `snapbuild_internal.h`).

- src/backend/rewrite/rewriteDefine.c:
    - DefineQueryRewrite:
        - PG commit b23cd185fd5410e5204683933f848d4583e34b35 completely removed the logic for converting relation to view
        - YB added a check to prevent converting system tables
        - Accepted PG's removal, discarding YB's changes

- src/backend/storage/ipc/ipci.c:
    - AttachSharedMemoryStructs:
        - PG commits 283e823f9dcb03d0be720928b261628af06d3fd4 (new shmem registration mechanism) through 9b5acad3f40fa6015f367fbf887ae5c1a93a3698 (convert all remaining subsystems) replaced all individual `*ShmemInit()` calls with `ShmemAttachRequested()` and `RegisterShmemCallbacks` API.
        - YB added `YbAshShmemInit()`, `YbQueryDiagnosticsShmemInit()`, `YbQpmShmemInit()`, `YbTerminatedQueriesShmemInit()`.
        - Took PG's `ShmemAttachRequested()` + appending YB's shmem init calls. Added YB_TODO_PG19MERGE to verify if YB calls need changes.

- src/backend/utils/adt/network.c:
    - match_network_subset: generalized AM check pattern.

- src/backend/utils/init/miscinit.c:
    - GetBackendTypeDesc switch:
        - PG commit dbf8cfb4f02eb9ec5525de1761675f9babfd30e3 replaced explicit case list with `PG_PROCTYPE` macro from `proctypelist.h`.
        - YB added `YB_YSQL_CONN_MGR`, `YB_YSQL_CONN_MGR_WAL_SENDER`, `YB_AUTO_ANALYZE_BACKEND`, `YB_INDEX_BACKFILL_DDL`, `YB_MATVIEW_REFRESH_DDL` cases.
        - Took PG's macro expansion + appending YB's custom cases after. Add a YB_TODO_PG19MERGE to use PG macro for YB cases as well.

- src/backend/utils/misc/Makefile:
    - OBJS list:
        - PG added `conffiles.o`.
        - YB added `pg_yb_utils.o`, `yb_ash.o`, `yb_exceptions_for_func_pushdown.o`, etc.
        - Kept both: YB objects first, then PG's `conffiles.o`.

- src/backend/utils/misc/help_config.c:
    - mixedStruct union moved into config_generic:
        - PG commit a13833c35f9e07fe978bf6fad984d6f5f25f59cd moved the `mixedStruct` union into `config_generic` and removed the standalone `mixedStruct` (union of config_* types) typedef. Function signatures changed from `mixedStruct *` to `const struct config_generic *`.
        - YB commit 399c47632a45b66545b7f4579cbaa1d70abc2c89 added `struct yb_config_oid oid` member to `mixedStruct`.
        - Accepted PG's removal of standalone `mixedStruct` in `help_config.c`. Removed `struct yb_config_oid oid` from the union for now as it needs to be reworked (either integrated into PG's new `config_generic`, or kept as the PG15 form with the embedded `config_generic` -- see build fixes).

- src/bin/pg_dump/Makefile:
    - pg_dumpall / ysql_dumpall target:
        - PG commit c1da7281060d646f863e920a1aac3b9dbc997672 removed dumputils.o and added `$OBJS`.
        - YB changed to `ysql_dumpall` and uses `$(YB_CCLD)`.
        - Accepted PG's changes and keeping YB's `ysql_dumpall`, `$(YB_CCLD)`.

- src/bin/pg_waldump/.gitignore:
    - file entries:
        - PG commit db6957bae8d7716785aa3748b25a9a4b7c3ff304 added `/rmgrdesc_utils.c` entry.
        - YB commented out the source file entries.
        - Took YB's commented-out style for `*desc.c` files (symlinked by YB's build, per commit 56b36bdb38c7fea8a13a5e489e08046b289623f5) + keeping PG's `/rmgrdesc_utils.c` uncommented for now (not matched by the `*desc.c` wildcard in the Makefile, so it gets copied not symlinked). Added a YB_TODO_PG19MERGE comment to consider adding `rmgrdesc_utils.c` to the symlink list in the Makefile.

- src/include/Makefile:
    - SUBDIRS: PG added `archive`, switched to multi-line backslash format; YB added `ybgate`. Kept PG's format with `archive` + YB's `ybgate`.

- src/include/access/amapi.h:
    - IndexAmRoutine struct fields:
        - PG added `amtranslatestrategy` and `amtranslatecmptype` function pointers.
        - YB added additional fields.
        - Kept both: PG's functions pointers first, then YB's fields.

- src/include/access/heapam.h:
    - function declarations:
        - PG replaced `heap_inplace_update` with `heap_inplace_update_and_unlock` (commit a07e03fd8fa7daf4d1356f7cb501ffe784ea6257) and added new functions.
        - The PG15 backpatch for a07e03fd8fa7daf4d1356f7cb501ffe784ea6257 retained `heap_inplace_update` as deprecated, which arrived in YB via merge commit e99df6f4d97e5c002d3c4b89c74a778ad0ac0932.
        - YB also added `yb_shared_update` parameter to `heap_inplace_update`.
        - Accepted PG's declarations only.

- src/backend/access/heap/heapam.c:
    - heap_inplace_unlock / heap_inplace_update:
        - See above resolution.  Dropped `heap_inplace_update` declaration and definition from `heapam.c` - no callers exist in YB. Added a YB_TODO_PG19MERGE to a comment in `ybModifyTable.c` referencing this function.

- src/include/access/htup_details.h:
    - HeapTupleNoNulls / HeapTupleHeaderHasNulls:
        - PG changed `HeapTupleNoNulls` from a macro to an inline function.
        - YB commit 12e23adb6ac517cde3bacfcbe64a8292470701cf added `HeapTupleHeaderHasNulls`
        - Kept PG's inline `HeapTupleNoNulls` and making YB's macro an inline function as well.

- src/include/access/tupconvert.h:
    - `execute_attr_map_cols` signature:
        - PG commit bfcf1b34805f70df48eedeec237230d0cc1154a6 renamed parameter from `inbitmap` to `in_cols`.
        - YB commit bb737232781348657e8efc44e89c7f38c6c63013 added `Relation rel` parameter. Although this commit is a PG import, the additional parameter was a YB change.
        - Combined both: PG's `in_cols` name + YB's extra parameter renamed to `yb_rel`.

- src/include/access/xact.h:
    - Isolation level comment block:
        - PG changed the comment.
        - YB added a YB note in the comment.
        - Kept PG's rewritten comment and appending YB's Read Committed note.

- src/include/catalog/catversion.h:
    - CATALOG_VERSION_NO:
        - PG updated to `202604061`.
        - YB has `202209061` with a comment about not needing to bump on import.
        - Took PG's version `202604061` and keeping YB's comment.

- src/include/catalog/heap.h:
    - InsertPgAttributeTuples signature:
        - adjacent line conflict.
        - PG commit d939cb2fd612acde0304913213cfbdb01994e682 changed `Datum *attoptions` to `const FormExtraData_pg_attribute tupdesc_extra[]`.
        - YB added `bool yb_relisshared` parameter.
        - Took PG's new parameter type and appending YB's `bool yb_relisshared`.

- src/include/catalog/pg_default_acl.h:
    - Default ACL object types:
        - PG added `DEFACLOBJ_LARGEOBJECT 'L'`.
        - YB added `DEFACLOBJ_TABLEGROUP 'g'`.
        - Kept both defines, PG's first then YB's.

- src/include/catalog/pg_opfamily.h:
    - Boolean opfamily macro:
        - adjacent line conflict.
        - PG commit ff720a597c0a53a8fcdf2cf4e45248dc5c37f9ab renamed `IsBooleanOpfamily` to `IsBuiltinBooleanOpfamily` with a comment about non-core opfamilies.
        - YB commit 5c6b021522ac936a5e5150f79c1a2de61a481a3e added `BOOL_LSM_FAM_OID` to the condition.
        - Used PG's macro name `IsBuiltinBooleanOpfamily` and adding YB's `BOOL_LSM_FAM_OID` to the OR condition.

- src/include/commands/copy.h:
    - `DoCopy` declaration and batch macro:
        - PG commit bfcf1b34805f70df48eedeec237230d0cc1154a6 renamed `DoCopy` parameter from `state` to `pstate`.
        - YB added `DEFAULT_BATCH_ROWS_PER_TRANSACTION` macro and `yb_default_copy_from_rows_per_transaction` extern.
        - Kept YB's macro/extern first, then PG's `DoCopy` declaration.

- src/include/commands/copyfrom_internal.h:
    - `CopyInsertMethod` enum:
        - PG updated enum comments.
        - YB added a comment about `YBCExecuteInsert`.
        - Took PG's enum descriptions and keeping YB's comment about YB insert methods.

- src/include/commands/explain.h:
    - ExplainState extraction:
        - PG commit c65bc2e1d14a2d4daed7c1921ac518f2c5ac3d17 moved `ExplainState` to `explain_state.h`, leaving only a forward declaration.
        - YB commit 536e4b1974268041302274d6a45ffba157d10283 added `YbExplainExecStats` struct YB also has a bunch of YB fields in `ExplainState`.
        - Took PG's forward declaration in `explain.h` + adding YB include. YB-specific fields moved to `explain_state.h` where PG relocated the struct.

- src/include/commands/repack.h:
    - `finish_heap_swap` signature:
        - PG renamed `minMulti` to `cutoffMulti`.
        - YB commit ce62d6c567cb358a9595def17d9092b27b7e26b4 added `yb_copy_split_options` parameter (last touched by 5627af5d6009b6d5b14bbbb552f6fd2a9ae43c3a). YB commit 03507f91525729e1eb0e2790c1a96e3a5c19e4e3 added `changedIndexNames`, `changedIndexSplitOpts` parameters.
        - Used PG's `cutoffMulti` name and appending YB's extra parameters.

- src/include/commands/tablecmds.h:
    - `ExecuteTruncateGuts` signature:
        - PG added `bool run_as_table_owner`.
        - YB added `bool yb_is_top_level`.
        - Kept both parameters, PG's first then YB's.

- src/include/executor/execExpr.h:
    - ExprEvalStep union members:
        - PG commit 6ee30209a6f161d0a267a33f090c70c579c87c00 added `is_json` struct. PG commit 6185c9737cf48c9540782d88f12bd2912d6ca1cc added `jsonexpr`, `jsonexpr_coercion` structs.
        - YB commit ada31e719db783e6c26b1b0b8c9447174ad7cbc5 added `row_array_compare` struct.
        - Kept PG's JSON structs first, then YB's `row_array_compare`.

- src/include/executor/execdesc.h:
    - QueryDesc instrumentation field:
        - PG commit 2c16deee2f7d52d6567dcbad046f74a8e880ee52 changed `totaltime` to `query_instr` with updated comment.
        - YB commit 536e4b1974268041302274d6a45ffba157d10283 added `yb_query_stats` field.
        - Took PG's `query_instr`, appending YB's `yb_query_stats`, add a YB_TODO_PG19MERGE to update the YB comment and verify if the note about the life cycle still applies to `query_instr`.

- src/include/fmgr.h:
    - FmgrInfo struct:
        - adjacent line conflict.
        - PG commit 4bd91912987d794c48dd4ba4c337906bd23759be changed fmgr.h typedefs to use `Node *fn_expr`.
        - YB commit 544122690311196d40059d9ea1311211df216247 added `void *fn_alt` (last touched by lint fix f0f54c4a7ade831f367aceb936800cbe18bf4822).
        - Took PG's `Node *fn_expr` type and adding YB's `void *fn_alt` field.

- src/include/libpq/libpq-be.h:
    - Port struct fields:
        - PG commit d951052a9e02bfacad8bd6f0f53a4dcd3b7e6d1f moved `authn_id` and its comment block out of `Port` into a new `ClientConnectionInfo` struct.
        - YB has YB fields.
        - Kept YB's fields after `hba`.

- src/include/nodes/nodeFuncs.h:
    - End-of-file declarations:
        - PG commit 1c27d16e6e5c1f463bbe1e9ece88dda811235165 removed the `struct PlanState;` forward declaration and the `planstate_tree_walker` function declaration from the end of the file (moved to the top of the file).
        - YB commit 9ed10e1cc21f64540dd775993ca59adacac48284 added `YbPlanStateTryGetAggrefs` declaration after `planstate_tree_walker`.
        - Kept YB's `YbPlanStateTryGetAggrefs` declaration.

- src/include/optimizer/pathnode.h:
    - Function declarations:
        - PG commit 8e11859102f947e6145acdd809e5cdcdfbe90fa5 added `create_rel_agg_info`.
        - YB added YB functions.
        - Kept PG's function first, then appended YB's functions.

- src/include/optimizer/paths.h:
    - Function declarations:
        - PG added `ec_clear_derived_clauses`.
        - YB added `yb_find_ec_member_for_var`.
        - Kept both declarations.

- src/include/optimizer/planner.h:
    - Function declarations:
        - PG added some functions.
        - YB added YB functions.
        - Kept PG's declarations first, then YB's.

- src/include/optimizer/restrictinfo.h:
    - Inline function and declarations:
        - PG commit 2453196107de66cff0257feef2ff8585dcf9d924 moved `clause_sides_match_join` inline function here.
        - YB added YB batching-related functions (`yb_can_hash_batched_rinfo`, `yb_can_batch_rinfo`).
        - Kept PG's inline function, then appended YB's batching functions.

- src/include/partitioning/partdesc.h:
    - Function declarations:
        - PG commit e033696596566d422a0eae47adca371a210ed730 changed the `#endif` guard comment from `PARTCACHE_H` to `PARTDESC_H`.
        - YB added `RelationBuildPartitionDesc` extern declaration before `#endif`.
        - Kept YB's extern declaration before `#endif` with PG's corrected `PARTDESC_H` guard name.

- src/include/partitioning/partprune.h:
    - Function declarations:
        - PG (commit d4d1fc527bdb333d818038081c17ed7d9b1697c1 and others) changed `make_partition_pruneinfo` return type to `int` and removed `struct` keyword from parameter types.
        - YB added `yb_oids` parameter to `prune_append_rel_partitions`.
        - Took PG's `int` return type and adding YB's `yb_oids` parameter.

- src/include/postmaster/postmaster.h:
    - Function declarations:
        - PG commit f1baed18bc3db50c72bfb00b6247b47689158445 added `#ifdef WIN32` block.
        - YB commit 44a0bfb01cc0678246350160782898b80cc3ded5 added `YbProcessStartupPacket` and related declarations.
        - Kept both: YB's declarations, then PG's `#ifdef WIN32` block.

- src/include/regex/regguts.h:
    - `STACK_TOO_DEEP` / `CANCEL_REQUESTED` area:
        - PG commit db4f21e4a34b1d5a3f7123e28e77f575d1a971ea removed the `CANCEL_REQUESTED` macro.
        - YB commit 8033dd42d675e62a16f7322f20b146c3cdf63e06 modified PG's `STACK_TOO_DEEP` macro (with `IsMultiThreadedMode()` check).
        - Kept YB's modified `STACK_TOO_DEEP`. Removed the `CANCEL_REQUESTED` macro.

- src/include/replication/logicalproto.h:
    - `logicalrep_write_update` signature:
        - PG (commit e65dbc9927fb86aa3c8a914ede6a6ae934384f5a and others) added `PublishGencolsType include_gencols_type` parameter, changed formatting.
        - YB commit fddfec620d291de3423277812bbe6097dfcbce3d added `bool *yb_old_is_omitted` and `bool *yb_new_is_omitted` parameters (last touched by merge commit c177183b65d47090b59af81d15e09329ae065571).
        - Kept PG's `include_gencols_type` parameter first, then appending YB's `yb_old_is_omitted` and `yb_new_is_omitted` parameters.

- src/include/replication/output_plugin.h:
    - OutputPluginOptions fields:
        - PG added `bool need_shared_catalogs`.
        - YB added `List *yb_publication_names`.
        - Kept both.

- src/include/parser/kwlist.h:
    - new keywords (3 conflicts):
        - PG added `"node"`, `"source"`, `"split" -> SPLIT`, `"target"`
        - YB added `"split" -> _YB_SPLIT_P`,`"nonconcurrently" -> _YB_NONCONCURRENTLY_P`, `"tablets" -> _YB_TABLETS_P`.
        - Interleaved the non-conflicting entries alphabetically. For the `"split"` collision, dropped YB's `_YB_SPLIT_P` and renamed the YB grammar to use PG's `SPLIT` token in gram.y. Safe because PG's `SPLIT` appears only in `ALTER TABLE ... SPLIT PARTITION` (alter_table_cmd) while YB's `SPLIT` appears only in `YbOptSplit` under CREATE TABLE/INDEX, with disjoint lookaheads (`PARTITION` vs `'('`/`INTO`/`AT`).

- src/include/storage/proc.h:
    - PGPROC struct layout:
        - PG commit 2e0853176f8f28a7684aa8b5af73446332960725 rearranged fields and added "Status reporting" header.
        - YB added YB fields.
        - Kept PG's layout with "Status reporting" section, then appending all YB-specific fields after `wait_event_info`.

- src/include/tcop/tcopprot.h:
    - Signal handler declarations:
        - PG commit 3691edfab97187789b8a1cbb9dce4acf0ecd8f5a changed `FloatExceptionHandler` to use `pg_noreturn`. PG commit 0da096d78e1e49645ff9baf6e425d3c47c5a5dc0 changed `RecoveryConflictInterrupt` to `HandleRecoveryConflictInterrupt`.
        - YB commit ca25fb9eb52b8bdbdc66987edcf5596ad61b7da9 added `YbCriticalSignalHandler`.
        - Took PG's `pg_noreturn` and `HandleRecoveryConflictInterrupt` + adding YB's `YbCriticalSignalHandler`.

- src/include/utils/catcache.h:
    - Cache statistics types:
        - PG commit 9c047da51f270b25fe03ee114e1de0c64aa9cc18 changed `long` to `uint64` for `cc_invals`, `cc_lsearches`, `cc_lhits`.
        - YB added `yb_cc_size_bytes` field (as `long`).
        - Took PG's `uint64` types and keeping YB's `yb_cc_size_bytes` (with `uint64`).

- src/include/utils/guc_tables.h:
    - GUC struct definition:
        - PG commit a13833c35f9e07fe978bf6fad984d6f5f25f59cd reorganized GUC structs, moving type-specific structs above `config_generic`, effectively moving `config_generic` down within the file.
        - YB commit 450c0dd0d5b8e3e0d0bbb0314c01f3a0b78cf746 added `ysql_conn_mgr_saved_default` field and `YB_GUC_VALUE_RESET`/`YB_GUC_DEFAULT_RESET` defines.
        - Kept PG's struct definition and adding YB's field and defines in the new location.

- contrib/file_fdw/file_fdw.c:
    - PG_MODULE_MAGIC_EXT:
        - PG commit 55527368bd07248e91e3d37a782bf66b76f06865 replaced `PG_MODULE_MAGIC` with `PG_MODULE_MAGIC_EXT`.
        - YB added YB includes.
        - Kept YB includes then PG's `PG_MODULE_MAGIC_EXT`.
    - NextCopyFrom on_error handling:
        - PG (commit a1c4c8a9e1e3a53996dafa1f4ee6d4f7de2c58b2 and others) wrapped `NextCopyFrom` in an outer `if`, added `on_error`/`reject_limit` retry loop with `goto retry`, and switched 2nd arg from `NULL` to `econtext`.
        - YB commit d3a6eb327e90ae0f5b659c9027828030ed987062 added a trailing `skip_row` bool parameter to `NextCopyFrom`
        - Kept PG's changes, and passing `false /* skip_row */` for the YB parameter.

- contrib/postgres_fdw/option.c:
    - postgres_fdw_validator:
        - PG commit 8ad51b5f446b5c19ba2c0033a0f7b3180b3b6d95 added `analyze_sampling` `else if` validation branch.
        - YB commit 67eb85a7d65146ffeca9730c0e5a99c20419fa68 added `server_type` `else if` validation branch.
        - Kept both: PG's `analyze_sampling` branch first, then YB's `server_type` branch.
    - InitPgFdwOptions:
        - PG commit a2eb99a01e015a76682911ae3980762f6ee6ac8c changed `gssdeleg` to `gssdelegation`.
        - YB commit 67eb85a7d65146ffeca9730c0e5a99c20419fa68 added `server_type` entry.
        - Kept both: PG's `gssdelegation` entry first, then YB's `server_type` entry.

- contrib/postgres_fdw/deparse.c:
    - deparseFromExprForRel:
        - PG commit 824dbea3e41efa3b35094163c834988dea7eb139 added a `JOIN_SEMI` branch and moved the existing JOIN ON deparse into the `else` arm.
        - YB added `context.yb_min_attr = fpinfo->yb_min_attr;` to the context init.
        - Took PG's restructuring and adding YB's `yb_min_attr` assignment in each new `context` init site.
    - deparseUpdateSql/deparseDeleteSql variables (2 conflicts):
        - PG added `additional_conds` variable.
        - YB added `yb_min_attr` variable.
        - Kept both variables.

- doc/src/sgml/ref/allfiles.sgml:
    - SGML entity declarations:
        - PG commit 2f094e7ac691abc9d2fe0f4dcf0feac4a6ce1d9c added `createPropertyGraph` and `dropPropertyGraph` entities.
        - YB commit 7ad368777cdc4a1037c0ab277ef978bf73140bda added `createProfile` and `dropProfile` entities.
        - Kept both: PG's entities first, then YB's.

- src/backend/access/brin/brin.c:
    - Below header file includes:
        - PG commit b437571714707bc6466abde1a0af5e69aaade09c added parallel index build code below the header file includes.
        - YB added YB include `#include "utils/guc.h"`.
        - Kept PG's changes and dropping YB's include since PG commit 0a20ff54f5e66158930d5328f89f087d4e9ab400 already added `#include "utils/guc.h"` above.
    - table_index_build_range_scan call:
        - PG commit 7f798aca1d5df290aafad41180baea0ae311b4ee removed `(void *)` cast from `state` argument.
        - YB commit 3ccf55af8c24e0f4bb112d8aee08d4434cebd979 introduced `bfinfo`/`bfresult`. The `NULL` trailing arguments were added during the PG15 initial merge(55782d561e55ef972f2470a4ae887dd791bb4a97).
        - Took PG's cast removal and keeping YB's trailing `bfinfo`/`bfresult` arguments.

- src/backend/access/transam/varsup.c:
    - shmem variables:
        - PG commit b31ba5310b5176402b60abc0454a033b1210ab75 renamed `ShmemVariableCache` to `TransamVariables`, and other commits c6d55714ba4c282dcf5fb5fe5ef2a5cad0b06e81 added more code below.
        - YB added `YB_OID_PREFETCH` and `ysql_upgrade_next_oid`.
        - Kept YB's original ordering: `YB_OID_PREFETCH` define right after `VAR_OID_PREFETCH`, then PG's `TransamVariables` and shmem API, then `ysql_upgrade_next_oid`.
    - GetNewObjectId:
        - PG commit b31ba5310b5176402b60abc0454a033b1210ab75 changed `ShmemVariableCache` references to  `TransamVariables`.
        - YB commit ca30a3ab5252858103cf6f3f92697821e9b718df added `YBCReserveOids` path. YB commit 8a3278d913d0d0cb4dcf7cc9df98c630e2bd456f added `ysql_enable_pg_per_database_oid_allocator` guard.
        - Changed YB's `YBCReserveOids` block to use `TransamVariables` (renamed from `ShmemVariableCache`); preserved PG's changes in the else block.

- src/backend/bootstrap/bootstrap.c:
    - includes and globals:
        - PG commit 935e675f3c9efd0e39bf33db15ab85049cc4ee7c removed `bootstrap_data_checksum_version` global.
        - YB has YB includes.
        - Kept YB includes, dropping `bootstrap_data_checksum_version`.
    - scanner init / YBCCreateDatabase:
        - PG commit 3e4bacb171001644583ac14e29ae1b09ce818c92 added `boot_yylex_init`.
        - YB commit ca30a3ab5252858103cf6f3f92697821e9b718df added `YBCCreateDatabase` call.
        - Kept both: PG's `boot_yylex_init` block then YB's `YBCCreateDatabase` block.

- src/backend/catalog/Makefile:
    - build system (2 conflicts):
        - PG commit 6ab2e8385d55e0b73bb8bbc41d9c286f5f7f357f moved all bki-generation machinery out of src/backend/catalog/Makefile and into src/include/catalog/Makefile, and slimmed install-data/uninstall-data here to just the static *.sql files.
        - YB content inside the conflict markers: YB pg_yb_*.h in `CATALOG_HEADERS`; YB *.dat in `POSTGRES_BKI_DATA`; `yb_bki-stamp` rule (yb_genbki.pl -> yb_postgres.bki) wired into distprep + header-stamp; `yb_postgres.bki` install line; uninstall additions ( `yb_system_functions.sql`, `yb_system_views.sql`); `clean`/`maintainer-clean` covering yb_bki-stamp + yb_postgres.bki.
        - Took PG's install-data, PG's slim uninstall-data list extended with YB's three additions (`yb_system_functions.sql`, `yb_system_views.sql`). Ported YB pg_yb_*.h, YB *.dat, `yb_bki-stamp` rule (wired into `generated-headers`), and `yb_postgres.bki` install/uninstall/clean into `src/include/catalog/Makefile`. Dropped `header-stamp` dep + `distprep` wiring since PG removed those.

- src/backend/catalog/pg_publication.c:
    - includes:
        - PG added published_rel, removed publication_translate_columns.
        - YB added YB includes and `yb_pg_relation_is_publishable` declaration.
        - Combined both changes.
    - is_table_publication / yb_pg_relation_is_publishable:
        - PG commit 493f8c6439cf64d75883c650b5dd573d8fe0664b added `is_table_publication()`. PG commit 7054186c4ebe24e63254651e2ae9b36efae90d4e added `check_and_fetch_column_list()`.
        - YB commit ef3577d3cd65a3fbc8de9cff0c36c5fafc026dc3 added `yb_pg_relation_is_publishable` call in `pg_relation_is_publishable`.
        - Kept PG's new functions and YB's modification to `pg_relation_is_publishable`.

- src/backend/catalog/pg_shdepend.c:
    - dependency type cases:
        - PG added `SHARED_DEPENDENCY_INITACL` case.
        - YB added `SHARED_DEPENDENCY_PROFILE` case.
        - Kept both cases.
    - end-of-file functions:
        - PG added `shdepReassignOwned_Owner()` and `shdepReassignOwned_InitAcl()`.
        - YB added YB functions.
        - Kept both.

- src/backend/catalog/pg_type.c:
    - includes and declarations:
        - PG commit 70988b7b0a0bd03c59a2314d0b5bcf2135692349 removed `makeUniqueTypeName`.
        - YB added YB includes.
        - Kept YB's includes, removed `makeUniqueTypeName`.
    - IsYsqlUpgrade guard:
        - PG changed the comment below the YB block.
        - YB added `IsYsqlUpgrade` early-return guard.
        - Kept YB's guard block with PG's comment wording.

- src/backend/commands/alter.c:
    - ExecRenameStmt:
        - PG commit 2f094e7ac691abc9d2fe0f4dcf0feac4a6ce1d9c added `case OBJECT_PROPGRAPH`.
        - YB added an argument to the `RenameRelation` call.
        - Kept PG's case and YB's argument.
    - AlterObjectNamespace_oid:
        - PG commit 89e5ef7e21812916c9cf9fcf56e45f0f74034656 switched from `OCLASS_*` enum values (via `getObjectClass()`) to direct `*RelationId` constants, and replaced the explicit "ignore" case list with `default:` + Assert.
        - YB added `OCLASS_YBTBLGROUP`, `OCLASS_YBPROFILE`, `OCLASS_YBROLE_PROFILE` to the explicit "ignore" case list.
        - Took PG's `default:` + Assert, which implicitly covers YB's object classes.

- src/backend/commands/copy.c:
    - attribute number computation:
        - PG commit a61b1f74823c9c4f79c95226a461f1e7a367764b moved `attno` definition and added `Bitmapset **bms` variable.
        - YB replaced `FirstLowInvalidHeapAttributeNumber` with `YBGetFirstLowInvalidAttributeNumber`.
        - Kept PG's definition placement and `bms` variable, using YB's attribute number function.
    - COPY options:
        - PG added `force_array`, `on_error`, `log_verbosity`, `reject_limit` options.
        - YB added YB options `rows_per_transaction`, `skip`, `disable_fk_check`, `replace`.
        - Kept PG's options first, then YB options.

- src/backend/commands/copyfromparse.c:
    - CopyGetData:
        - PG added `WAIT_EVENT_COPY_FROM_READ`.
        - YB added conditional `WAIT_EVENT_YB_COPY_COMMAND_STREAM_READ`.
        - Took PG's wait event. Added a YB_TODO_PG19MERGE.
    - NextCopyFrom:
        - PG commit 7717f63006935de00fafd000bff450280508adf1 refactored inline text/binary parsing into `CopyFromOneRow` callback.
        - YB added `skip_row` parameter for skipping format checking on invalid rows.
        - Took PG's callback approach. Added YB_TODO_PG19MERGE to port `skip_row` logic into the new callbacks.

- src/backend/commands/foreigncmds.c:
    - CreateForeignServer pointer check:
        - PG commit a5b35fcedb542587e7d8b8fcd21a2e0995b82d2f removed `PointerIsValid()`.
        - YB added `yb_validate_server_options()`.
        - Kept YB's validation call with PG's `DatumGetPointer != NULL` style.
    - AlterForeignServer:
        - Same pattern. Resolved same way.

- src/Makefile.global.in:
    - CPPFLAGS:
        - PG commits 65c298f61fc70f2f960437c05649f71b862e2c48, 8eadd5c73c44708ecd45b9fd3ac54a550511d16f added `LIBNUMA_CFLAGS`, `LIBURING_CFLAGS`. PG commit 4300d8b6a79d61abb5ca9f901df7bde7a49322b6 changed from `:= ... $(CPPFLAGS)` to `+=`.
        - YB added `YB_SRC_ROOT` check and `-I$(YB_SRC_ROOT)/src`.
        - Used PG's `+=` style with all flags plus YB's `YB_SRC_ROOT` guard and `-I` path.
    - prove_installcheck:
        - PG commit aeb8ea361a0a321a0e1cbc79a4cd3ec0b1191bf2 added `share_contrib_dir`.
        - YB commit 745bd761e6926c5816a0716716d8548eacbb3d96 imported PG commit c098509927f9a49ebceb301a2cb6a477ecd4ac3c which added `REGRESS_SHLIB`. PG later removed it in commit a0fc813266467d666b8f09ccccaccb700326a296 (moved to `src/test/recovery/Makefile` only, the only test that needs it); however, the YB PG15 merge did not drop it.
        - Kept PG's `share_contrib_dir` and dropping `REGRESS_SHLIB`.
    - pg_config_ext.h / stamp-ext-h rule:
        - PG commit 962da900ac8f0927f1af2fd811ca67fa163c873a removed `pg_config_ext.h` and `stamp-ext-h`.
        - YB commit c5ddc7bad7137d51a5c4ec6416bbea7492aeb133 had added `YB_PG_SKIP_CONFIG_STATUS` guard to `stamp-ext-h`.
        - Dropped both entries (accepting PG's removal).

- src/backend/access/common/reloptions.c:
    - untransformRelOptions pstrdup:
        - PG commit 6710e83a675eda798544fea4cdcb89eef7f39403 removed `pstrdup` calls on both `s` and `p` (passing them directly to `makeDefElem`/`makeString`).
        - YB commit 0d9ced1053242ed270d75c5d2b5a02bc4190a900 added `pfree(s)`.
        - Took PG's change, discarding YB side.
    - StdRdOptions:
        - PG commits 4d6a66f675815a5d40a650d4dcfb5ddb89c6ad2f, 052026c9b903380b428a4c9ba2ec90726db81288 changed to `vacuum_truncate` to `TERNARY` type and added `vacuum_max_eager_freeze_failure_rate`.
        - YB added YB options.
        - Kept PG's changes first, then YB options.
    - partitioned_table_reloptions:
        - PG commit 4f981df8e0b7bc00d22ab0db65579589c9d4bb8c changed to error out instead of running validation when reloptions are set for a partitioned table.
        - YB commit b5f581483f31dddacdb0ccff2d8d51a116ab0662 added support for specifying colocation reloption for parent partitioned tables.
        - Kept YB's `IsYugaByteEnabled()` block first, then PG's error.

- src/backend/access/nbtree/nbtutils.c:
    - btree preprocessing split (3 conflicts):
        - PG commit 597b1ffbf12352a3863a894f16741864aaf2242f moved most of this file (`_bt_preprocess_array_keys`, `_bt_sort_array_elements`, `_bt_compare_array_elements`, `_bt_find_extreme_element`, `_bt_preprocess_keys`, `_bt_compare_scankey_args`, `_bt_fix_scankey_strategy`, `_bt_mark_scankey_required`, `_bt_check_rowcompare`, `BTSortArrayContext`) into a new file `nbtpreprocesskeys.c`. The new `_bt_sort_array_elements` is `static` and has a different signature (`ScanKey, FmgrInfo *sortproc, bool, Datum*, int` instead of `IndexScanDesc, ScanKey, bool, Datum*, int`).
        - YB un-static-ified `_bt_sort_array_elements` (and dropped its forward decl), added an `IsYugaByteEnabled() && !RegProcedureIsValid(cmp_proc)` fallback inside it that uses `lookup_type_cache(elemtype, TYPECACHE_CMP_PROC)`, added `utils/builtins.h` and `utils/typcache.h` includes, and exposed `extern int _bt_sort_array_elements(...)` in nbtree.h. yb_scan.c calls it with the old signature.
        - Took PG's slim nbtutils.c (dropped the YB `utils/builtins.h` / `utils/typcache.h` includes since the YB-modified function moved out); removed the YB-added extern from nbtree.h; wrapped the yb_scan.c call site with YB_TODO_PG19MERGE (commented out via `//`, set `*culled_num_elems = num_valid;` as placeholder) since the new function is `static` AND has an incompatible signature - YB caller needs to be rewritten to resolve the FmgrInfo (with the YB fallback) up front and call the new function (after exposing it or adding a wrapper in nbtpreprocesskeys.c).

- src/backend/catalog/namespace.c:
    - MatchNamedCall signature:
        - Adjacent line conflict.
        - PG added `fgc_flags` parameter.
        - YB added `YbBuildTempNameSuffix` declaration.
        - Kept both.
    - temp namespace naming:
        - PG commit 024c521117579a6d356050ad3d78fdc95e44eefa renamed `MyBackendId` to `MyProcNumber`.
        - YB commit bde7acd5bd33240037fd389849c28015705a959d added temp namespace suffix.
        - Ported YB's suffix logic to use PG's `MyProcNumber`.

- src/backend/commands/event_trigger.c:
    - EventTriggerSupportsObjectType:
        - PG replaced the explicit ObjectType case enumeration (and the "intentionally no default" comment) with `default: return true;`.
        - YB added `OBJECT_YBPROFILE` / `OBJECT_YBTABLEGROUP` cases (return false).
        - Inserted YB's two cases before PG's `default: return true;`; dropped YB's "intentionally no default" comment block since PG added a default.
    - EventTriggerSupportsObject:
        - PG renamed `EventTriggerSupportsObjectClass(ObjectClass objclass)` to `EventTriggerSupportsObject(const ObjectAddress *object)` and switched the switch from `OCLASS_*` enum cases to `<TableName>RelationId` cases on `object->classId`; also added `default: return true;`.
        - YB added `OCLASS_YBTBLGROUP`, `OCLASS_YBPROFILE`, `OCLASS_YBROLE_PROFILE` cases (return false).
        - Ported YB's cases to PG's RelationId style: `YbTablegroupRelationId`, `YbProfileRelationId`, `YbRoleProfileRelationId`, placed before `default: return true;`. Added `catalog/pg_yb_tablegroup.h`, `pg_yb_profile.h`, `pg_yb_role_profile.h` includes for the RelationId macros.
    - palloc_array:
        - PG changed to use `palloc_array`.
        - YB added `else command->d.atscfg.dictIds = NULL;` guard.
        - Kept PG's `palloc_array` and YB's `else` NULL guard.

- contrib/postgres_fdw/postgres_fdw.c:
    - PG_MODULE_MAGIC and YB includes:
        - PG commit 55527368bd07248e91e3d37a782bf66b76f06865 replaced `PG_MODULE_MAGIC` with `PG_MODULE_MAGIC_EXT`.
        - YB added YB-specific includes.
        - Kept YB includes then PG's `PG_MODULE_MAGIC_EXT`.
    - postgresGetForeignPaths:
        - PG commit 9e9931d2bf40e2fea447d779c2e133c2c1256ef3 adds 4th argument (NIL) to `add_paths_with_pathkeys_for_rel` call.
        - YB wraps call in `yb_server_type` check.
        - Kept YB's conditional guard; updated to PG's 4-arg signature.
    - postgresBeginForeignScan:
        - PG commit 599b33b9492dfefd1219c1d31801f40b3ba90b0d changed and moved `user_id` assignment.
        - YB commit 54ec9a1a2e2c94dfb0e59516fcfcb4e66149cf19 added federated YugabyteDB server type checking.
        - Kept YB's federated server checks and discarded the old `user_id` assignment.
    - fetch_more_data function restructure:
        - PG commit 80aa9848befc13c188d2775a859deaf172fdd3a2 removed the `PG_TRY()` block, simplified `pgfdw_get_result` (2 args to 1) and `pgfdw_report_error` (5 args to 3).
        - YB commit 65ec75f603937d63636c1668aeeca64970b9a226 added `else if (fsstate->yb_gvr)` branch, moved error check from `else` branch to a common location after the if/else if/else, and added conditional `eof_reached` for `yb_gvr`. However, the error check inside the `if (async_capable)` branch was not removed (likely an oversight). YB commit ec3a95daf09e888a177cce8d2de00bcb7627c3ef changed the YB block to use `YbGlobalViewReadExecScan`.
        - Took PG's changes (no `PG_TRY()`, new API signatures, per-branch error checks); applied YB's additions: `else if (fsstate->yb_gvr)` branch (with its own per-branch error check, matching PG's style) and conditional `eof_reached`. Kept per-branch error checks instead of YB's common check to match PG's style.

- contrib/test_decoding/test_decoding.c:
    - PG_MODULE_MAGIC + extern decls:
        - PG commit 55527368bd07248e91e3d37a782bf66b76f06865 replaced PG_MODULE_MAGIC with PG_MODULE_MAGIC_EXT; commit fd4bad1655391582f639527c325fc4a99680cc64 dropped `_PG_init`/`_PG_output_plugin_init` extern decls.
        - YB added pg_yb_utils.h include.
        - Kept YB include + PG_MODULE_MAGIC_EXT; dropped externs.
    - tuple_to_stringinfo unchanged-toast branch:
        - PG commit 0f5ade7a367c16d823c75a81abb10e2ec98b4206 wrapped `origval` with `DatumGetPointer()`.
        - YB added `yb_send_unchanged_toasted ||` short-circuit.
        - Combined.
    - pg_decode_change tuple_to_stringinfo calls (4 conflicts):
        - PG commit 08e6344fd6423210b339e92c069bb979ba4e7cd6 removed ReorderBufferTupleBuf; `change->data.tp.{new,old}tuple` is now `HeapTuple` (no `->tuple`/`->yb_is_omitted`).
        - YB added a `yb_is_omitted` arg.
        - Used `change->data.tp.{new,old}tuple` directly and passing `NULL /* YB_TODO_PG19MERGE: yb_is_omitted */`. yb_is_omitted storage needs rework (there's a more detailed TODO in `reorderbuffer.h`).

- src/backend/Makefile:
    - SUBDIRS list:
        - PG reformatted SUBDIRS and added some subdirs.
        - YB added `ybgate` subdirectory.
        - Kept PG's multi-line format; appended YB's `ybgate` at the end.
    - LDFLAGS override vs YB build system block:
        - PG commit 9db49fc5bfdc0126be03f4b8986013e59d93b91d added `override LDFLAGS := $(LDFLAGS) $(LDFLAGS_EX) $(LDFLAGS_EX_BE)`.
        - YB commit 56b36bdb38c7fea8a13a5e489e08046b289623f5 (and others) added YB build block (`YB_BUILD_ROOT`, `LIBS`, `SHLIB_LINK`, etc.).
        - Kept YB's build block; placed PG's `override LDFLAGS` line after `SHLIB_EXPORTS`.
    - Link commands (4 conflict):
        - PG commit 9db49fc5bfdc0126be03f4b8986013e59d93b91d removed explicit `$(LDFLAGS_EX)` and `$(export_dynamic)` from link commands.
        - YB commit 1564c6d5f552b68553921e66375e0fa1cecaf229 replaced `$(CC)` with `$(YB_CCLD)`.
        - Used `$(YB_CCLD)` with PG's simplified flags.

- src/backend/access/transam/parallel.c:
    - FixedParallelState struct:
        - PG commit 024c521117579a6d356050ad3d78fdc95e44eefa renamed `BackendId parallel_leader_backend_id` to `ProcNumber parallel_leader_proc_number`.
        - YB added YB session fields.
        - Kept PG's `ProcNumber`; appended YB's session fields.
    - InitializeParallelDSM fps assignment:
        - PG commit 024c521117579a6d356050ad3d78fdc95e44eefa assigns `MyProcNumber`.
        - YB commit 2f91e3ef37754c96d5074cd33fa2e4c401c52513 dumps YB session state.
        - Kept PG's `MyProcNumber` assignment; appended YB's session state dump.
    - ReinitializeParallelDSM:
        - PG commit f1a6e622bd94735c36d72c663813b55c442739b4 added MemoryContext save/restore.
        - YB added YB TODO comment.
        - Kept both YB's TODO comment and PG's MemoryContext restore.
    - ParallelWorkerMain:
        - PG commit 15b4c46c328b25be9463db6d2960eeb16a784aad added `BGWORKER_BYPASS_ROLELOGINCHECK` flag to the `BackgroundWorkerInitializeConnectionByOid` call.
        - YB commit caa636fcd02f59d0dfab103b52fd59703745ff64 added YB session init branch (`YbBackgroundWorkerInitializeConnectionByOid`).
        - Kept YB's if/else branching; added PG's flag to both branches.

- src/backend/catalog/catalog.c:
    - GetNewOidWithIndex do-while loop:
        - PG commit 7fbcee1b2d5f1012c67942126881bd492e95077e adds completion logging.
        - YB commit 8d0ef3f7f8c49a8d9bec302cdcc0c40f5d9e785b changed while loop condition to use a new DoesOidExistInRelation helper.
        - Kept YB's helper as loop condition and PG's completion logging after loop. Also, rename DoesOidExistInRelation to YbDoesOidExistInRelation and mark it static.
    - GetNewRelFileNumber variable declarations:
        - PG commits b0a55e43299c4ea2a9a8c757f9c26352407d0ccc and others changed `RelFileNodeBackend to RelFileLocatorBackend`, and `BackendId backendid` to `ProcNumber procNumber`
        - YB commit dae4d523d97acdf7436f12824a967d333db09a7a added YbGetAllRelfilenodes() htab and 8d0ef3f7f8c49a8d9bec302cdcc0c40f5d9e785b removed the unused PG declarations (rpath, collides, backend) in the altered function body.
        - Kept PG's rlocator, along with YB's HTAB initialization.
    - GetNewRelFileNumber Assert and relpersistence switch:
        - PG commit 024c521117579a6d356050ad3d78fdc95e44eefa replaced backend-id usages in the switch with proc number.
        - YB commit 8d0ef3f7f8c49a8d9bec302cdcc0c40f5d9e785b extracted the switch into `GetBackendOidFromRelPersistence()` helper. YB also relaxed Assert with YB exceptions (`yb_binary_restore`, `yb_extension_upgrade`).
        - Kept YB's `GetBackendOidFromRelPersistence()` helper; updated it to use PG's `ProcNumber` API. Kept YB's relaxed Assert. Renamed `GetBackendOidFromRelPersistence` to `YbGetBackendOidFromRelPe…
@fizaaluthra fizaaluthra force-pushed the yb-pg19-merge-final branch from c26d98e to 95f79e3 Compare June 9, 2026 17:00

@OlegLoginov OlegLoginov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed:

[M] src/bin/pg_dump/pg_backup.h            - [M] - LGTM
[M] src/bin/pg_dump/pg_dump.h              - [M] - LGTM
[M] src/bin/pg_dump/dumputils.h            - [M] - LGTM
[M] src/bin/pg_dump/pg_dump_sort.c         - [M] - LGTM
[M] src/bin/pg_dump/common.c               - [M] - LGTM
[M] src/bin/pg_dump/dumputils.c            - [M] - LGTM
[M] src/bin/pg_dump/pg_backup_archiver.c   - [M] - 3 comments TOFIX,  has YB_TODO_PG19MERGE  
[M] src/bin/pg_dump/pg_dumpall.c             [M] - LGTM,  has YB_TODO_PG19MERGE
[M] src/bin/pg_dump/t/002_pg_dump.pl         [M] - LGTM
[M] src/bin/pg_upgrade/dump.c                [M] - LGTM

Not reviewed yet: src/bin/pg_dump/pg_dump.c

@@ -3480,6 +3537,42 @@ _doSetFixedOutputState(ArchiveHandle *AH)
else
ahprintf(AH, "SET row_security = off;\n");

{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line is not needed. (" {")

YbBackwardCompatibleSetGuc(AH, "yb_disable_auto_analyze", "on", true);
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line is not needed. (" }")

pg_fatal("AH->sqlparse not 0 before printing definition");
AH->outputKind = OUTPUT_OTHERDATA;
ahprintf(AH, "%s\n\n", te->defn);
memset(&AH->sqlparse, 0, sizeof(AH->sqlparse));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lost the comment before the line:
memset(&AH->sqlparse, 0, sizeof(AH->sqlparse));

				/*
				 * We've ended on a statement boundary or whitespace (after all,
				 * in upstream Postgres, this sequence of SQL statements is sent
				 * to the backend as one block), so reset the state of sqlparse,
				 * which is normally meant to be stitching together strings with
				 * arbitrary boundaries.
				 */

Please return the comment back.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thank you!

@OlegLoginov OlegLoginov left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: src/bin/pg_dump/pg_dump.c

Comment thread src/bin/pg_dump/pg_dump.c
* callers should pass `--sequence-data` instead.
*/
#if 0
if ((!IsYugabyteEnabled && dopt.binary_upgrade) || dopt.include_yb_metadata)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return the comment back (under #if 0 for the moment):

	/*
	 * Binary upgrade mode implies dumping sequence data even in schema-only
	 * mode.  This is not exposed as a separate option, but kept separate
	 * internally for clarity.
	 * YB: Before, during, and after online upgrade, we use the same sequence
	 * data table, so we don't want to write anything to sequence data during
	 * the restore.
	 */

Comment thread src/bin/pg_dump/pg_dump.c
Comment on lines +18115 to +18126
/*
* Not Null constraint --- print it if it is locally
* defined, or if binary upgrade. (In the latter case, we
* reset conislocal below.)
* YB: For backups, follow binary-upgrade mode
* for inherited child tables to preserve col order.
*/
print_notnull = (tbinfo->notnull_constrs[j] != NULL &&
(tbinfo->notnull_islocal[j] ||
dopt->binary_upgrade ||
tbinfo->ispartition ||
dopt->include_yb_metadata));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to use original offsets in the block. (To prevent future merge conflicts.)

So, to the PG code we need to add:

 * YB: For backups, follow binary-upgrade mode
 * for inherited child tables to preserve col order.

' +

								  tbinfo->ispartition ||
								  dopt->include_yb_metadata));

Comment thread src/bin/pg_dump/pg_dump.c
Comment on lines -17689 to -17692
if (nonemptyReloptions(tbinfo->reloptions) ||
nonemptyReloptions(tbinfo->toast_reloptions))
{
bool addcomma = false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the block is lost or deleted:

		if (nonemptyReloptions(tbinfo->reloptions) ||
			nonemptyReloptions(tbinfo->toast_reloptions))
		{
			bool		addcomma = false;
          	appendPQExpBufferStr(q, "\nWITH (");
			if (nonemptyReloptions(tbinfo->reloptions))
			{
				addcomma = true;
				appendReloptionsArrayAH(q, tbinfo->reloptions, "", fout);
			}
			if (nonemptyReloptions(tbinfo->toast_reloptions))
			{
				if (addcomma)
					appendPQExpBufferStr(q, ", ");
				appendReloptionsArrayAH(q, tbinfo->toast_reloptions, "toast.",
										fout);
			}
			appendPQExpBufferChar(q, ')');
		}

Comment thread src/bin/pg_dump/pg_dump.c
@@ -18188,9 +18924,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
appendPQExpBuffer(q, "\nALTER TABLE ONLY %s FORCE ROW LEVEL SECURITY;\n",
qualrelname);

appendPQExpBuffer(delq, "DROP %s %s;\n", reltypename, qualrelname);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lost the line:

	appendPQExpBuffer(delq, "DROP %s %s;\n", reltypename, qualrelname);

Comment thread src/bin/pg_dump/pg_dump.c
coninfo->contype == 'p' ? "PRIMARY KEY" : "UNIQUE");

appendPQExpBuffer(q, "%s ",
coninfo->contype == 'p' ? "PRIMARY KEY" : "UNIQUE");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this change only adds a single space.
It can be done via
appendPQExpBufferStr(q, " ");
Up to you..

Comment thread src/bin/pg_dump/pg_dump.c
Comment on lines -19086 to -19089
* PRIMARY KEY constraints should not be using NULLS NOT DISTINCT
* indexes. Being able to create this was fixed, but we need to
* make the index distinct in order to be able to restore the
* dump.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block was removed & replaced by YB implementation.

			/*
			 * PRIMARY KEY constraints should not be using NULLS NOT DISTINCT
			 * indexes. Being able to create this was fixed, but we need to
			 * make the index distinct in order to be able to restore the
			 * dump.
			 */
			if (indxinfo->indnullsnotdistinct && coninfo->contype != 'p')
				appendPQExpBufferStr(q, " NULLS NOT DISTINCT");
			appendPQExpBufferStr(q, " (");
			for (k = 0; k < indxinfo->indnkeyattrs; k++)
			{
				appendPQExpBuffer(q, "USING INDEX %s",
								  fmtId(indxinfo->dobj.name));
			}
			if (coninfo->conperiod)
				appendPQExpBufferStr(q, " WITHOUT OVERLAPS");

			if (indxinfo->indnkeyattrs < indxinfo->indnattrs)
				appendPQExpBufferStr(q, ") INCLUDE (");

			for (k = indxinfo->indnkeyattrs; k < indxinfo->indnattrs; k++)  ......

Is it completely covered by the new YB code?
It's hard to compare the old (PG) and the new (YB) logic here.
In YB code I don't see the block:

			for (k = 0; k < indxinfo->indnkeyattrs; k++)
			{
				appendPQExpBuffer(q, "USING INDEX %s",
								  fmtId(indxinfo->dobj.name));

@mtakahar mtakahar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at geqo_main.c (wasn't asked though) and createplan.c so far.

@@ -90,7 +90,7 @@ geqo(PlannerInfo *root, int number_of_rels, List *initial_rels)

#if defined(ERX)
Edge *edge_table; /* list of edges */
int edge_failures = 0;
int edge_failures pg_attribute_unused() = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert (take the upstream version.)

This was added by ead09cbeb4e0b84bb5c91c2f44efa5821ac15013, but it was addressed by the upstream commit below. So this has been unnecessary since our upgrade to PG15.

commit dc43fc9b3aa3e0fa9c84faddad6d301813580f88
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   2022-01-23 11:09:00 -0500

    Suppress variable-set-but-not-used warning from clang 13.
    
    In the normal configuration where GEQO_DEBUG isn't defined,
    recent clang versions have started to complain that geqo_main.c
    accumulates the edge_failures count but never does anything
    with it.  As a minimal back-patchable fix, insert a void cast
    to silence this warning.  (I'd speculated about ripping out the
    GEQO_DEBUG logic altogether, but I don't think we'd wish to
    back-patch that.)
    
    Per recently-established project policy, this is a candidate
    for back-patching into out-of-support branches: it suppresses
    an annoying compiler warning but changes no behavior.  Hence,
    back-patch all the way to 9.2.
    
    Discussion: https://postgr.es/m/CA+hUKGLTSZQwES8VNPmWO9AO0wSeLt36OCPDAZTccT1h7Q7kTQ@mail.gmail.com
#if defined(ERX)
#if defined(GEQO_DEBUG)
	if (edge_failures != 0)
		elog(LOG, "[GEQO] failures: %d, average: %d",
			 edge_failures, (int) number_generations / edge_failures);
	else
		elog(LOG, "[GEQO] no edge failures detected");
#else
	/* suppress variable-set-but-not-used warnings from some compilers */
	(void) edge_failures;
#endif
#endif

Comment on lines -133 to -134
static Path *get_singleton_append_subpath(Path *path,
List **child_append_relid_sets);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better adding a comment like: /* YB: exposed for use in createplan.c */?

@@ -2314,7 +2434,7 @@ accumulate_append_subpath(Path *path, List **subpaths, List **special_subpaths,
*
* Note: 'path' must not be a parallel-aware path.
*/
static Path *
Path *

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better adding a comment like: /* YB: exposed for use in createplan.c */ here, too?

Comment on lines +7864 to +7867
if (!enable_seqscan)
{
startup_cost += disable_cost;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These places looking at enable_xxx boolean flag & adding disable_cost must be updated with path->disabled_nodes setting in all yb_cost_xxx functions.

yugabyte/yugabyte-db#32361

@@ -124,7 +141,6 @@ static PathClauseUsage *classify_index_clause_usage(Path *path,
static void find_indexpath_quals(Path *bitmapqual, List **quals, List **preds);
static int find_list_position(Node *node, List **nodelist);
static bool check_index_only(RelOptInfo *rel, IndexOptInfo *index);
static double get_loop_count(PlannerInfo *root, Index cur_relid, Relids outer_relids);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add something like this?

/*
 * YB: exposed for use in costsize.c and selfncs.c:
 * static double get_loop_count(PlannerInfo *root, Index cur_relid, Relids outer_relids);
 */

@@ -2321,7 +3081,7 @@ check_index_only(RelOptInfo *rel, IndexOptInfo *index)
* estimates before it begins to compute paths, or at least before it
* calls create_index_paths().
*/
static double
double

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be add something like this?
/* YB: exposed for use in costsize.c and selfncs.c */

Comment on lines +1304 to +1309
/*
* YB: Do not consider SAOP exprs with yb_hash_code() in the LHS as index clauses,
* e.g. "WHERE yb_hash_code(i) in (1, 2, 3)".
*/
if (yb_hash_code_on_left((ScalarArrayOpExpr *) (rinfo->clause)))
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are unrelated to skip_lower_saop. Move those out of the #if 0 ... block.
cc @gauravk-in @bmckennaah

I think we can also remove the #if 0 ... since we are not setting it for YB indexes anyways.

Comment on lines +1084 to +1105
/*
* YB_TODO_PG19MERGE: upstream PG commit 5bf748b86bc6786a3fc57fc7ce296c37da6564b0
* removed skip_lower_saop and the block below. Does this affect YB?
*/
#if 0
/*
* If we skipped any lower-order ScalarArrayOpExprs on an index with an AM
* that supports them, then try again including those clauses. This will
* produce paths with more selectivity but no ordering.
*/
if (skip_lower_saop)
{
indexpaths = list_concat(indexpaths,
build_index_paths(root, rel,
index, clauses,
yb_bitmap_idx_pushdowns,
index->predOK,
ST_ANYSCAN,
&skip_nonnative_saop,
NULL));
}
#endif

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just remove this since skip_lower_saop would never be set for YB indexes.

}

if (((index->amhasgetbitmap || index->yb_amhasgetbitmap) &&
!IsA(ipath, UniquePath) /* YB_TODO_PG19MERGE */) &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a poor documentation on excluding index path with distinct pushed down.
It turns out the check was incomplete. @gauravk-in fixed it as well as clarifying in a YB comment. https://phorge.dev.yugabyte.com/D54623

See https://yugabyte.slack.com/archives/CAR5BCH29/p1781630352994689?thread_ts=1781276535.128879&cid=CAR5BCH29.

Comment on lines +854 to +869
/*
* If we skipped any lower-order ScalarArrayOpExprs on an index with an AM
* that supports them, then try again including those clauses. This will
* produce paths with more selectivity but no ordering.
*/
if (skip_lower_saop)
{
/* YB_TODO_PG19MERGE: PG19 dropped the trailing skip_lower_saop out-param. */
indexpaths = list_concat(indexpaths,
build_index_paths(root, rel,
index, clauses,
NIL /* yb_bitmap_idx_pushdowns */ ,
index->predOK,
ST_ANYSCAN,
&skip_nonnative_saop));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we can just remove these lines since skip_lower_saop would never be set for YB indexes.

@jasonyb

jasonyb commented Jul 3, 2026

Copy link
Copy Markdown

Review for execIndexing.c: I skipped "YbExecUpdateIndexTuples indisvalid check" and leave that for @karthik-ramanathan-3006 to review. Everything else LGTM.

Review for execMain.c:

  • InitPlan: ++ queryDesc->yb_query_stats = InstrAlloc(queryDesc->instrument_options); was not explained
  • ExecPartitionCheckEmitError: based on your ExecBuildSlotValueDescription signature change to align closer to PG's relid, you should do the same in this function: revert the usage of rel and use root_relid instead. Also, this area was not covered in resolution notes.
  • ExecConstraints: I found a bug on master and will get back to you
  • ExecWithCheckOptions: again, no explanation for the resolution. Incorrectly resolved: empty line was incorrectly added by YB, so it should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants