=== Applying patches on top of PostgreSQL commit ID de74d1e9a5453b8efe2eda2afebcf8218a503184 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Fri Apr 10 15:09:32 UTC 2026 On branch cf/6591 nothing to commit, working tree clean === using 'git am' to apply patch ./v4-0001-pg_stack_alloc-Provide-API-for-stack-allocation.patch === Applying: pg_stack_alloc: Provide API for stack allocation. Using index info to reconstruct a base tree... M src/test/regress/parallel_schedule M src/test/regress/regress.c Falling back to patching base and 3-way merge... Auto-merging src/test/regress/regress.c CONFLICT (content): Merge conflict in src/test/regress/regress.c Auto-merging src/test/regress/parallel_schedule CONFLICT (content): Merge conflict in src/test/regress/parallel_schedule error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 pg_stack_alloc: Provide API for stack allocation. When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v4-0001-pg_stack_alloc-Provide-API-for-stack-allocation.patch === patching file src/include/utils/pg_stack_alloc.h patching file src/test/regress/expected/internals.out patching file src/test/regress/parallel_schedule Hunk #1 FAILED at 48. 1 out of 1 hunk FAILED -- saving rejects to file src/test/regress/parallel_schedule.rej patching file src/test/regress/regress.c Hunk #2 succeeded at 47 (offset 1 line). Hunk #3 succeeded at 1424 with fuzz 2 (offset 38 lines). patching file src/test/regress/sql/internals.sql Unstaged changes after reset: M src/test/regress/regress.c Removing src/include/utils/pg_stack_alloc.h Removing src/test/regress/expected/internals.out Removing src/test/regress/parallel_schedule.rej Removing src/test/regress/sql/internals.sql === using 'git apply' to apply patch ./v4-0001-pg_stack_alloc-Provide-API-for-stack-allocation.patch === Falling back to direct application... Falling back to direct application... Applied patch to 'src/test/regress/parallel_schedule' with conflicts. Applied patch to 'src/test/regress/regress.c' with conflicts. Falling back to direct application... U src/test/regress/parallel_schedule U src/test/regress/regress.c diff --cc src/test/regress/parallel_schedule index cc365393bb7,4986b2c5c53..00000000000 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@@ -48,7 -48,7 +48,11 @@@ test: create_index create_index_spgist # ---------- # Another group of parallel tests # ---------- ++<<<<<<< ours +test: create_aggregate create_function_sql create_cast constraints triggers select inherit typed_table vacuum drop_if_exists updatable_views roleattributes create_am hash_func errors infinite_recurse create_property_graph for_portion_of ++======= + test: create_aggregate create_function_sql create_cast constraints triggers select inherit typed_table vacuum drop_if_exists updatable_views roleattributes create_am hash_func errors infinite_recurse create_property_graph internals ++>>>>>>> theirs # ---------- # sanity_check does a vacuum, affecting the sort order of SELECT * diff --cc src/test/regress/regress.c index 5c19f70b6e8,8f9a7ac4221..00000000000 --- a/src/test/regress/regress.c +++ b/src/test/regress/regress.c @@@ -1388,37 -1387,51 +1390,87 @@@ test_translation(PG_FUNCTION_ARGS PG_RETURN_VOID(); } ++<<<<<<< ours +/* Verify that pg_ticks_to_ns behaves correct, including overflow */ +PG_FUNCTION_INFO_V1(test_instr_time); +Datum +test_instr_time(PG_FUNCTION_ARGS) +{ + instr_time t; + int64 test_ns[] = {0, 1000, INT64CONST(1000000000000000)}; + int64 max_err; + + /* + * The ns-to-ticks-to-ns roundtrip may lose precision due to integer + * truncation in the fixed-point conversion. The maximum error depends on + * ticks_per_ns_scaled relative to the shift factor. + */ + max_err = (ticks_per_ns_scaled >> TICKS_TO_NS_SHIFT) + 1; + + for (int i = 0; i < lengthof(test_ns); i++) + { + int64 result; + + INSTR_TIME_SET_ZERO(t); + INSTR_TIME_ADD_NANOSEC(t, test_ns[i]); + result = INSTR_TIME_GET_NANOSEC(t); + + if (result < test_ns[i] - max_err || result > test_ns[i]) + elog(ERROR, + "INSTR_TIME_GET_NANOSEC(t) yielded " INT64_FORMAT + ", expected " INT64_FORMAT " (max_err " INT64_FORMAT + ") in file \"%s\" line %u", + result, test_ns[i], max_err, __FILE__, __LINE__); + } + + PG_RETURN_BOOL(true); ++======= + PG_FUNCTION_INFO_V1(test_pg_stack_alloc); + Datum + test_pg_stack_alloc(PG_FUNCTION_ARGS) + { + char *p; + char *p2 PG_USED_FOR_ASSERTS_ONLY; + + /* Need extra space to run under ASAN. */ + DECLARE_PG_STACK_SIZE(1024 * 8); + + /* Too big for the stack. */ + p = pg_stack_alloc(10000); + Assert(!pg_stack_ptr_p(p)); + pg_stack_free(p); + + /* Acceptable size. */ + p = pg_stack_alloc(10); + Assert(pg_stack_ptr_p(p)); + + /* Addresses should move downwards. */ + p2 = pg_stack_alloc(10); + Assert(pg_stack_ptr_p(p)); + Assert(p2 < p); + + /* A zero-sized allocation is identifiable as a stack address. */ + p = pg_stack_alloc(0); + Assert(pg_stack_ptr_p(p)); + + /* Test a range of alignments. */ + #define TEST_ALIGN MAXIMUM_ALIGNOF + for (int i = 1; i <= TEST_ALIGN * 8; i *= 2) + { + /* Allocate and check alignment is as requested, when we use palloc(). */ + p = pg_stack_alloc_aligned(1024 * 8, i); + + Assert(!pg_stack_ptr_p(p)); + Assert(pg_stack_ptr_is_aligned_p(p, i)); + pg_stack_free(p); + + /* Allocate and check alignment is as requested. */ + p = pg_stack_alloc_aligned(i, i); + + Assert(pg_stack_ptr_p(p)); + Assert(pg_stack_ptr_is_aligned_p(p, i)); + } + + PG_RETURN_VOID(); ++>>>>>>> theirs }