=== Applying patches on top of PostgreSQL commit ID 6831cd9e3b082d7b830c3196742dd49e3540c49b === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sat Jan 17 07:52:22 UTC 2026 On branch cf/5832 nothing to commit, working tree clean === using 'git am' to apply patch ./v2-0001-Change-the-names-generated-for-index-partitions.patch === Applying: Change the names generated for index partitions. Using index info to reconstruct a base tree... M contrib/pg_overexplain/expected/pg_overexplain.out M src/backend/commands/indexcmds.c M src/backend/commands/tablecmds.c M src/backend/parser/parse_utilcmd.c M src/bin/pg_dump/t/002_pg_dump.pl M src/include/parser/parse_utilcmd.h M src/test/regress/expected/alter_table.out M src/test/regress/expected/constraints.out M src/test/regress/expected/event_trigger.out M src/test/regress/expected/indexing.out M src/test/regress/expected/inherit.out M src/test/regress/expected/partition_join.out M src/test/regress/expected/partition_prune.out M src/test/regress/expected/psql.out M src/test/regress/expected/without_overlaps.out M src/test/regress/sql/alter_table.sql M src/test/subscription/t/013_partition.pl M src/test/subscription/t/035_conflicts.pl Falling back to patching base and 3-way merge... Auto-merging src/test/subscription/t/035_conflicts.pl Auto-merging src/test/subscription/t/013_partition.pl Auto-merging src/test/regress/sql/alter_table.sql Auto-merging src/test/regress/expected/without_overlaps.out Auto-merging src/test/regress/expected/psql.out Auto-merging src/test/regress/expected/partition_prune.out CONFLICT (content): Merge conflict in src/test/regress/expected/partition_prune.out Auto-merging src/test/regress/expected/partition_join.out CONFLICT (content): Merge conflict in src/test/regress/expected/partition_join.out Auto-merging src/test/regress/expected/inherit.out Auto-merging src/test/regress/expected/indexing.out Auto-merging src/test/regress/expected/event_trigger.out Auto-merging src/test/regress/expected/constraints.out Auto-merging src/test/regress/expected/alter_table.out Auto-merging src/include/parser/parse_utilcmd.h CONFLICT (content): Merge conflict in src/include/parser/parse_utilcmd.h Auto-merging src/bin/pg_dump/t/002_pg_dump.pl Auto-merging src/backend/parser/parse_utilcmd.c Auto-merging src/backend/commands/tablecmds.c CONFLICT (content): Merge conflict in src/backend/commands/tablecmds.c Auto-merging src/backend/commands/indexcmds.c Auto-merging contrib/pg_overexplain/expected/pg_overexplain.out error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Change the names generated for index partitions. 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". Unstaged changes after reset: M contrib/btree_gist/expected/partitions.out M contrib/pg_overexplain/expected/pg_overexplain.out M contrib/seg/expected/partition.out M src/backend/commands/indexcmds.c M src/backend/commands/tablecmds.c M src/backend/parser/parse_utilcmd.c M src/bin/pg_dump/t/002_pg_dump.pl M src/include/parser/parse_utilcmd.h M src/test/isolation/expected/partition-drop-index-locking.out M src/test/regress/expected/alter_table.out M src/test/regress/expected/constraints.out M src/test/regress/expected/create_table.out M src/test/regress/expected/event_trigger.out M src/test/regress/expected/indexing.out M src/test/regress/expected/inherit.out M src/test/regress/expected/partition_join.out M src/test/regress/expected/partition_prune.out M src/test/regress/expected/psql.out M src/test/regress/expected/tablespace.out M src/test/regress/expected/without_overlaps.out M src/test/regress/sql/alter_table.sql M src/test/regress/sql/indexing.sql M src/test/regress/sql/tablespace.sql M src/test/subscription/t/013_partition.pl M src/test/subscription/t/035_conflicts.pl === using patch(1) to apply patch ./v2-0001-Change-the-names-generated-for-index-partitions.patch === patching file contrib/btree_gist/expected/partitions.out patching file contrib/pg_overexplain/expected/pg_overexplain.out Hunk #1 succeeded at 389 (offset 1 line). Hunk #2 succeeded at 399 (offset 1 line). Hunk #3 succeeded at 415 (offset 1 line). Hunk #4 succeeded at 423 (offset 1 line). patching file contrib/seg/expected/partition.out patching file src/backend/commands/indexcmds.c Hunk #1 succeeded at 1373 (offset 7 lines). Hunk #2 succeeded at 1383 (offset 7 lines). Hunk #3 succeeded at 1515 (offset 7 lines). Hunk #4 succeeded at 2613 (offset 26 lines). Hunk #5 succeeded at 2648 (offset 26 lines). patching file src/backend/commands/tablecmds.c Hunk #1 FAILED at 1295. Hunk #2 succeeded at 20770 with fuzz 2 (offset 94 lines). 1 out of 2 hunks FAILED -- saving rejects to file src/backend/commands/tablecmds.c.rej patching file src/backend/parser/parse_utilcmd.c Hunk #1 succeeded at 1563 (offset 2 lines). Hunk #2 succeeded at 1688 (offset 2 lines). Hunk #3 succeeded at 1709 (offset 2 lines). Hunk #4 succeeded at 1790 (offset 2 lines). Hunk #5 succeeded at 1868 (offset 2 lines). patching file src/bin/pg_dump/t/002_pg_dump.pl Hunk #1 succeeded at 4030 (offset -241 lines). Hunk #2 succeeded at 4045 (offset -241 lines). Hunk #3 succeeded at 4061 (offset -241 lines). patching file src/include/parser/parse_utilcmd.h Hunk #1 FAILED at 37. 1 out of 1 hunk FAILED -- saving rejects to file src/include/parser/parse_utilcmd.h.rej patching file src/test/isolation/expected/partition-drop-index-locking.out patching file src/test/regress/expected/alter_table.out Hunk #2 succeeded at 2187 (offset 5 lines). Hunk #3 succeeded at 2206 (offset 5 lines). Hunk #4 succeeded at 2218 (offset 5 lines). Hunk #5 succeeded at 2229 (offset 5 lines). Hunk #6 succeeded at 2241 (offset 5 lines). Hunk #7 succeeded at 2268 (offset 5 lines). Hunk #8 succeeded at 2279 (offset 5 lines). Hunk #9 succeeded at 2301 (offset 5 lines). Hunk #10 succeeded at 2312 (offset 5 lines). patching file src/test/regress/expected/constraints.out patching file src/test/regress/expected/create_table.out patching file src/test/regress/expected/event_trigger.out Hunk #1 succeeded at 719 (offset 77 lines). patching file src/test/regress/expected/indexing.out patching file src/test/regress/expected/inherit.out Hunk #1 succeeded at 3282 (offset 8 lines). Hunk #2 succeeded at 3330 (offset 8 lines). Hunk #3 succeeded at 3349 (offset 8 lines). Hunk #4 succeeded at 3384 (offset 8 lines). Hunk #5 succeeded at 3396 (offset 8 lines). Hunk #6 succeeded at 3422 (offset 8 lines). Hunk #7 succeeded at 3452 (offset 8 lines). Hunk #8 succeeded at 3558 (offset 8 lines). Hunk #9 succeeded at 3574 (offset 8 lines). Hunk #10 succeeded at 3621 (offset 8 lines). patching file src/test/regress/expected/partition_join.out Hunk #7 FAILED at 5232. Hunk #8 succeeded at 5276 (offset -35 lines). Hunk #9 succeeded at 5285 (offset -35 lines). Hunk #10 succeeded at 5331 (offset -34 lines). Hunk #11 succeeded at 5343 (offset -34 lines). 1 out of 11 hunks FAILED -- saving rejects to file src/test/regress/expected/partition_join.out.rej patching file src/test/regress/expected/partition_prune.out Hunk #1 FAILED at 1903. Hunk #2 succeeded at 3580 (offset 14 lines). Hunk #3 succeeded at 3603 (offset 14 lines). Hunk #4 FAILED at 3636. Hunk #5 succeeded at 4237 with fuzz 2 (offset 21 lines). Hunk #6 FAILED at 4225. Hunk #7 succeeded at 4791 with fuzz 1 (offset 23 lines). Hunk #8 succeeded at 4808 (offset 23 lines). 3 out of 8 hunks FAILED -- saving rejects to file src/test/regress/expected/partition_prune.out.rej patching file src/test/regress/expected/psql.out Hunk #1 succeeded at 5088 (offset 32 lines). Hunk #2 succeeded at 5114 (offset 32 lines). patching file src/test/regress/expected/tablespace.out patching file src/test/regress/expected/without_overlaps.out patching file src/test/regress/sql/alter_table.sql patching file src/test/regress/sql/indexing.sql patching file src/test/regress/sql/tablespace.sql patching file src/test/subscription/t/013_partition.pl Hunk #1 succeeded at 832 (offset 7 lines). patching file src/test/subscription/t/035_conflicts.pl Unstaged changes after reset: M contrib/btree_gist/expected/partitions.out M contrib/pg_overexplain/expected/pg_overexplain.out M contrib/seg/expected/partition.out M src/backend/commands/indexcmds.c M src/backend/commands/tablecmds.c M src/backend/parser/parse_utilcmd.c M src/bin/pg_dump/t/002_pg_dump.pl M src/test/isolation/expected/partition-drop-index-locking.out M src/test/regress/expected/alter_table.out M src/test/regress/expected/constraints.out M src/test/regress/expected/create_table.out M src/test/regress/expected/event_trigger.out M src/test/regress/expected/indexing.out M src/test/regress/expected/inherit.out M src/test/regress/expected/partition_join.out M src/test/regress/expected/partition_prune.out M src/test/regress/expected/psql.out M src/test/regress/expected/tablespace.out M src/test/regress/expected/without_overlaps.out M src/test/regress/sql/alter_table.sql M src/test/regress/sql/indexing.sql M src/test/regress/sql/tablespace.sql M src/test/subscription/t/013_partition.pl M src/test/subscription/t/035_conflicts.pl Removing src/backend/commands/tablecmds.c.rej Removing src/include/parser/parse_utilcmd.h.rej Removing src/test/regress/expected/partition_join.out.rej Removing src/test/regress/expected/partition_prune.out.rej === using 'git apply' to apply patch ./v2-0001-Change-the-names-generated-for-index-partitions.patch === Applied patch to 'contrib/btree_gist/expected/partitions.out' cleanly. Applied patch to 'contrib/pg_overexplain/expected/pg_overexplain.out' cleanly. Applied patch to 'contrib/seg/expected/partition.out' cleanly. Applied patch to 'src/backend/commands/indexcmds.c' cleanly. Applied patch to 'src/backend/commands/tablecmds.c' with conflicts. Applied patch to 'src/backend/parser/parse_utilcmd.c' cleanly. Applied patch to 'src/bin/pg_dump/t/002_pg_dump.pl' cleanly. Applied patch to 'src/include/parser/parse_utilcmd.h' with conflicts. Applied patch to 'src/test/isolation/expected/partition-drop-index-locking.out' cleanly. Applied patch to 'src/test/regress/expected/alter_table.out' cleanly. Applied patch to 'src/test/regress/expected/constraints.out' cleanly. Applied patch to 'src/test/regress/expected/create_table.out' cleanly. Applied patch to 'src/test/regress/expected/event_trigger.out' cleanly. Applied patch to 'src/test/regress/expected/indexing.out' cleanly. Applied patch to 'src/test/regress/expected/inherit.out' cleanly. Applied patch to 'src/test/regress/expected/partition_join.out' with conflicts. Applied patch to 'src/test/regress/expected/partition_prune.out' with conflicts. Applied patch to 'src/test/regress/expected/psql.out' cleanly. Applied patch to 'src/test/regress/expected/tablespace.out' cleanly. Applied patch to 'src/test/regress/expected/without_overlaps.out' cleanly. Applied patch to 'src/test/regress/sql/alter_table.sql' cleanly. Applied patch to 'src/test/regress/sql/indexing.sql' cleanly. Applied patch to 'src/test/regress/sql/tablespace.sql' cleanly. Applied patch to 'src/test/subscription/t/013_partition.pl' cleanly. Applied patch to 'src/test/subscription/t/035_conflicts.pl' cleanly. U src/backend/commands/tablecmds.c U src/include/parser/parse_utilcmd.h U src/test/regress/expected/partition_join.out U src/test/regress/expected/partition_prune.out diff --cc src/backend/commands/tablecmds.c index f976c0e5c7e,85fc927e8c6..00000000000 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@@ -1300,10 -1295,13 +1300,20 @@@ DefineRelation(CreateStmt *stmt, char r RelationGetDescr(parent), false); idxstmt = ++<<<<<<< ours + generateClonedIndexStmt(NULL, idxRel, + attmap, &constraintOid); + DefineIndex(NULL, + RelationGetRelid(rel), ++======= + generateClonedIndexStmt(NULL, + RelationGetNamespace(rel), + idxRel, + attmap, + true, + &constraintOid); + DefineIndex(RelationGetRelid(rel), ++>>>>>>> theirs idxstmt, InvalidOid, RelationGetRelid(idxRel), @@@ -20770,10 -20680,12 +20780,13 @@@ AttachPartitionEnsureIndexes(List **wqu Oid conOid; stmt = generateClonedIndexStmt(NULL, - idxRel, attmap, + RelationGetNamespace(attachrel), + idxRel, + attmap, + true, &conOid); - DefineIndex(RelationGetRelid(attachrel), stmt, InvalidOid, + DefineIndex(NULL, + RelationGetRelid(attachrel), stmt, InvalidOid, RelationGetRelid(idxRel), conOid, -1, diff --cc src/include/parser/parse_utilcmd.h index 53f282f77ec,782a0787dbc..00000000000 --- a/src/include/parser/parse_utilcmd.h +++ b/src/include/parser/parse_utilcmd.h @@@ -37,8 -37,10 +37,14 @@@ extern PartitionBoundSpec *transformPar extern List *expandTableLikeClause(RangeVar *heapRel, TableLikeClause *table_like_clause); extern IndexStmt *generateClonedIndexStmt(RangeVar *heapRel, + Oid heapNamespace, Relation source_idx, ++<<<<<<< ours + const AttrMap *attmap, ++======= + const struct AttrMap *attmap, + bool clone_name, ++>>>>>>> theirs Oid *constraintOid); #endif /* PARSE_UTILCMD_H */ diff --cc src/test/regress/expected/partition_join.out index f6d3ade368a,161bd4a7c21..00000000000 --- a/src/test/regress/expected/partition_join.out +++ b/src/test/regress/expected/partition_join.out @@@ -5191,25 -5228,23 +5191,36 @@@ CREATE TABLE fract_t1 PARTITION OF frac INSERT INTO fract_t (id) (SELECT generate_series(0, 1999)); ANALYZE fract_t; -- verify plan; nested index only scans +-- (avoid merge joins, because the costs of partitionwise and non-partitionwise +-- merge joins tend to be almost equal, and we want this test to be stable) SET max_parallel_workers_per_gather = 0; -SET enable_partitionwise_join = on; +SET enable_mergejoin = off; EXPLAIN (COSTS OFF) SELECT x.id, y.id FROM fract_t x LEFT JOIN fract_t y USING (id) ORDER BY x.id ASC LIMIT 10; - QUERY PLAN - ----------------------------------------------------------------------- + QUERY PLAN + ------------------------------------------------------------------------ Limit -> Merge Append Sort Key: x.id ++<<<<<<< ours + -> Nested Loop Left Join + -> Index Only Scan using fract_t0_pkey on fract_t0 x_1 + -> Index Only Scan using fract_t0_pkey on fract_t0 y_1 + Index Cond: (id = x_1.id) + -> Nested Loop Left Join + -> Index Only Scan using fract_t1_pkey on fract_t1 x_2 + -> Index Only Scan using fract_t1_pkey on fract_t1 y_2 + Index Cond: (id = x_2.id) ++======= + -> Merge Left Join + Merge Cond: (x_1.id = y_1.id) + -> Index Only Scan using fract_t_pkey_1 on fract_t0 x_1 + -> Index Only Scan using fract_t_pkey_1 on fract_t0 y_1 + -> Merge Left Join + Merge Cond: (x_2.id = y_2.id) + -> Index Only Scan using fract_t_pkey_2 on fract_t1 x_2 + -> Index Only Scan using fract_t_pkey_2 on fract_t1 y_2 ++>>>>>>> theirs (11 rows) EXPLAIN (COSTS OFF) diff --cc src/test/regress/expected/partition_prune.out index deacdd75807,9e885c3375b..00000000000 --- a/src/test/regress/expected/partition_prune.out +++ b/src/test/regress/expected/partition_prune.out @@@ -1915,21 -1903,21 +1915,36 @@@ select * fro from int4_tbl touter) ss, asptab where asptab.id > ss.b::int; ++<<<<<<< ours + QUERY PLAN +---------------------------------------------------------------------- + Nested Loop + -> Seq Scan on int4_tbl touter + -> Append + -> Index Only Scan using asptab0_pkey on asptab0 asptab_1 + Index Cond: (id > (EXISTS(SubPlan exists_3))::integer) + SubPlan exists_4 + -> Seq Scan on int4_tbl tinner_2 + -> Index Only Scan using asptab1_pkey on asptab1 asptab_2 + Index Cond: (id > (EXISTS(SubPlan exists_3))::integer) + SubPlan exists_3 ++======= + QUERY PLAN + --------------------------------------------------------------------- + Nested Loop + -> Seq Scan on int4_tbl touter + -> Append + -> Index Only Scan using asptab_pkey_1 on asptab0 asptab_1 + Index Cond: (id > (EXISTS(SubPlan 3))::integer) + SubPlan 4 + -> Seq Scan on int4_tbl tinner_2 + -> Index Only Scan using asptab_pkey_2 on asptab1 asptab_2 + Index Cond: (id > (EXISTS(SubPlan 3))::integer) + SubPlan 3 ++>>>>>>> theirs -> Seq Scan on int4_tbl tinner_1 Filter: (f1 = touter.f1) - SubPlan 2 + SubPlan exists_2 -> Seq Scan on int4_tbl tinner (14 rows) @@@ -3650,28 -3636,27 +3665,39 @@@ explain (analyze, verbose, costs off, s deallocate mt_q2; -- ensure initplan params properly prune partitions explain (analyze, costs off, summary off, timing off, buffers off) select * from ma_test where a >= (select min(b) from ma_test_p2) order by b; - QUERY PLAN - -------------------------------------------------------------------------------------------------- + QUERY PLAN + ------------------------------------------------------------------------------------------------- Merge Append (actual rows=20.00 loops=1) Sort Key: ma_test.b - InitPlan 2 + InitPlan expr_1 -> Result (actual rows=1.00 loops=1) - InitPlan 1 + Replaces: MinMaxAggregate + InitPlan minmax_1 -> Limit (actual rows=1.00 loops=1) - -> Index Scan using ma_test_p2_b_idx on ma_test_p2 (actual rows=1.00 loops=1) + -> Index Scan using ma_test_b_idx_2 on ma_test_p2 (actual rows=1.00 loops=1) Index Cond: (b IS NOT NULL) Index Searches: 1 ++<<<<<<< ours + -> Index Scan using ma_test_p1_b_idx on ma_test_p1 ma_test_1 (never executed) + Filter: (a >= (InitPlan expr_1).col1) + Index Searches: 0 + -> Index Scan using ma_test_p2_b_idx on ma_test_p2 ma_test_2 (actual rows=10.00 loops=1) + Filter: (a >= (InitPlan expr_1).col1) + Index Searches: 1 + -> Index Scan using ma_test_p3_b_idx on ma_test_p3 ma_test_3 (actual rows=10.00 loops=1) + Filter: (a >= (InitPlan expr_1).col1) ++======= + -> Index Scan using ma_test_b_idx_1 on ma_test_p1 ma_test_1 (never executed) + Filter: (a >= (InitPlan 2).col1) + Index Searches: 0 + -> Index Scan using ma_test_b_idx_2 on ma_test_p2 ma_test_2 (actual rows=10.00 loops=1) + Filter: (a >= (InitPlan 2).col1) + Index Searches: 1 + -> Index Scan using ma_test_b_idx_3 on ma_test_p3 ma_test_3 (actual rows=10.00 loops=1) + Filter: (a >= (InitPlan 2).col1) ++>>>>>>> theirs Index Searches: 1 -(18 rows) +(19 rows) reset enable_seqscan; reset enable_sort; @@@ -4237,26 -4216,26 +4263,40 @@@ create index on rangep (a) -- Ensure run-time pruning works on the nested Merge Append explain (analyze on, costs off, timing off, summary off, buffers off) select * from rangep where b IN((select 1),(select 2)) order by a; - QUERY PLAN - --------------------------------------------------------------------------------------------------------------- + QUERY PLAN + -------------------------------------------------------------------------------------------------------- Append (actual rows=0.00 loops=1) - InitPlan 1 + InitPlan expr_1 -> Result (actual rows=1.00 loops=1) - InitPlan 2 + InitPlan expr_2 -> Result (actual rows=1.00 loops=1) -> Merge Append (actual rows=0.00 loops=1) Sort Key: rangep_2.a ++<<<<<<< ours + -> Index Scan using rangep_0_to_100_1_a_idx on rangep_0_to_100_1 rangep_2 (actual rows=0.00 loops=1) + Filter: (b = ANY (ARRAY[(InitPlan expr_1).col1, (InitPlan expr_2).col1])) + Index Searches: 1 + -> Index Scan using rangep_0_to_100_2_a_idx on rangep_0_to_100_2 rangep_3 (actual rows=0.00 loops=1) + Filter: (b = ANY (ARRAY[(InitPlan expr_1).col1, (InitPlan expr_2).col1])) + Index Searches: 1 + -> Index Scan using rangep_0_to_100_3_a_idx on rangep_0_to_100_3 rangep_4 (never executed) + Filter: (b = ANY (ARRAY[(InitPlan expr_1).col1, (InitPlan expr_2).col1])) + Index Searches: 0 + -> Index Scan using rangep_100_to_200_a_idx on rangep_100_to_200 rangep_5 (actual rows=0.00 loops=1) + Filter: (b = ANY (ARRAY[(InitPlan expr_1).col1, (InitPlan expr_2).col1])) ++======= + -> Index Scan using rangep_a_idx_1_1 on rangep_0_to_100_1 rangep_2 (actual rows=0.00 loops=1) + Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1])) + Index Searches: 1 + -> Index Scan using rangep_a_idx_1_2 on rangep_0_to_100_2 rangep_3 (actual rows=0.00 loops=1) + Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1])) + Index Searches: 1 + -> Index Scan using rangep_a_idx_1_3 on rangep_0_to_100_3 rangep_4 (never executed) + Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1])) + Index Searches: 0 + -> Index Scan using rangep_a_idx_2 on rangep_100_to_200 rangep_5 (actual rows=0.00 loops=1) + Filter: (b = ANY (ARRAY[(InitPlan 1).col1, (InitPlan 2).col1])) ++>>>>>>> theirs Index Searches: 1 (19 rows) @@@ -4797,13 -4774,13 +4837,13 @@@ select min(a) over (partition by a orde -> Merge Append Sort Key: part_abc_3.a Subplans Removed: 1 - -> Index Scan using part_abc_3_1_a_idx on part_abc_3_1 part_abc_3 + -> Index Scan using part_abc_a_idx_3_1 on part_abc_3_1 part_abc_3 Index Cond: (a >= (stable_one() + 1)) Filter: (d <= stable_one()) - -> Index Scan using part_abc_3_2_a_idx on part_abc_3_2 part_abc_4 + -> Index Scan using part_abc_a_idx_3_2 on part_abc_3_2 part_abc_4 Index Cond: (a >= (stable_one() + 1)) Filter: (d <= stable_one()) - -> Subquery Scan on "*SELECT* 2" + -> Subquery Scan on unnamed_subquery_1 -> WindowAgg Window: w1 AS (PARTITION BY part_abc_5.a ORDER BY part_abc_5.a) -> Append