=== Applying patches on top of PostgreSQL commit ID d62dca3b297413a11a594c9675f2fb22e931d01b === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Wed Feb 18 18:40:24 UTC 2026 On branch cf/6488 nothing to commit, working tree clean === using 'git am' to apply patch ./v1-0001-Improve-substring-implementation.patch === Applying: Improve substring() implementation. Using index info to reconstruct a base tree... M src/backend/utils/adt/varlena.c M src/test/regress/expected/encoding.out M src/test/regress/sql/encoding.sql Falling back to patching base and 3-way merge... Auto-merging src/test/regress/sql/encoding.sql Auto-merging src/test/regress/expected/encoding.out Auto-merging src/backend/utils/adt/varlena.c CONFLICT (content): Merge conflict in src/backend/utils/adt/varlena.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Improve substring() implementation. 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 src/backend/utils/adt/varlena.c M src/test/regress/expected/encoding.out M src/test/regress/sql/encoding.sql === using patch(1) to apply patch ./v1-0001-Improve-substring-implementation.patch === patching file src/backend/utils/adt/varlena.c Hunk #2 FAILED at 644. 1 out of 5 hunks FAILED -- saving rejects to file src/backend/utils/adt/varlena.c.rej patching file src/test/regress/expected/encoding.out patching file src/test/regress/sql/encoding.sql Unstaged changes after reset: M src/backend/utils/adt/varlena.c M src/test/regress/expected/encoding.out M src/test/regress/sql/encoding.sql Removing src/backend/utils/adt/varlena.c.rej === using 'git apply' to apply patch ./v1-0001-Improve-substring-implementation.patch === Applied patch to 'src/backend/utils/adt/varlena.c' with conflicts. Applied patch to 'src/test/regress/expected/encoding.out' cleanly. Applied patch to 'src/test/regress/sql/encoding.sql' cleanly. U src/backend/utils/adt/varlena.c diff --cc src/backend/utils/adt/varlena.c index 7caf700fd61,b8467a7ce8c..00000000000 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@@ -656,23 -652,19 +652,36 @@@ text_substring(Datum str, int32 start, char *s; text *ret; ++<<<<<<< ours + /* + * We need to start at position zero because there is no way to know + * in advance which byte offset corresponds to the supplied start + * position. + */ + slice_start = 0; + + if (length_not_specified) /* special case - get length to end of + * string */ + E = slice_size = L1 = -1; ++======= + if (length_not_specified) /* special case - get whole string */ + { + slice_size = -1; + E = INT32_MAX; + } ++>>>>>>> theirs else if (length < 0) { /* SQL99 says to throw an error for E < S, i.e., negative length */ ereport(ERROR, (errcode(ERRCODE_SUBSTRING_ERROR), errmsg("negative substring length not allowed"))); ++<<<<<<< ours + E = slice_size = L1 = -1; /* silence stupider compilers */ ++======= + slice_size = -1; /* silence stupider compilers */ + E = INT32_MAX; ++>>>>>>> theirs } else if (pg_add_s32_overflow(S, length, &E)) {