=== Applying patches on top of PostgreSQL commit ID bd9d6ffa1aea612cc8da31f7b30d5573747b86f8 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Thu Sep 10 08:13:26 UTC 2026 On branch cf/6999 nothing to commit, working tree clean === using 'git am' to apply patch ./psql-prompt-command.patch === Applying: Add PROMPT_COMMAND and dynamic prompt support to psql Using index info to reconstruct a base tree... M src/bin/psql/command.c M src/bin/psql/common.c M src/bin/psql/help.c M src/bin/psql/mainloop.c M src/bin/psql/prompt.c M src/bin/psql/prompt.h M src/bin/psql/startup.c Falling back to patching base and 3-way merge... Auto-merging src/bin/psql/startup.c Auto-merging src/bin/psql/prompt.h CONFLICT (content): Merge conflict in src/bin/psql/prompt.h Auto-merging src/bin/psql/prompt.c CONFLICT (content): Merge conflict in src/bin/psql/prompt.c Auto-merging src/bin/psql/mainloop.c Auto-merging src/bin/psql/help.c Auto-merging src/bin/psql/common.c Auto-merging src/bin/psql/command.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Add PROMPT_COMMAND and dynamic prompt support to psql 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 ./psql-prompt-command.patch === patching file scripts/PR-description-postgres.md patching file src/bin/psql/command.c Hunk #2 succeeded at 4337 (offset 12 lines). patching file src/bin/psql/common.c Hunk #1 succeeded at 465 (offset 2 lines). Hunk #2 succeeded at 488 (offset 2 lines). Hunk #3 succeeded at 503 (offset 2 lines). Hunk #4 succeeded at 522 (offset 2 lines). Hunk #5 succeeded at 531 (offset 2 lines). Hunk #6 succeeded at 540 (offset 2 lines). Hunk #7 succeeded at 2143 (offset 84 lines). patching file src/bin/psql/help.c Hunk #1 succeeded at 432 (offset -1 lines). Hunk #2 succeeded at 447 (offset -1 lines). patching file src/bin/psql/input.c patching file src/bin/psql/input.h patching file src/bin/psql/mainloop.c patching file src/bin/psql/powerline-integration.md patching file src/bin/psql/prompt.c Hunk #3 FAILED at 251. Hunk #4 FAILED at 279. Hunk #5 succeeded at 487 (offset -1 lines). Hunk #6 FAILED at 569. Hunk #7 succeeded at 617 (offset -1 lines). 3 out of 7 hunks FAILED -- saving rejects to file src/bin/psql/prompt.c.rej patching file src/bin/psql/prompt.h Hunk #1 FAILED at 13. 1 out of 1 hunk FAILED -- saving rejects to file src/bin/psql/prompt.h.rej patching file src/bin/psql/startup.c Unstaged changes after reset: M src/bin/psql/command.c M src/bin/psql/common.c M src/bin/psql/help.c M src/bin/psql/input.c M src/bin/psql/input.h M src/bin/psql/mainloop.c M src/bin/psql/prompt.c M src/bin/psql/startup.c Removing scripts/ Removing src/bin/psql/powerline-integration.md Removing src/bin/psql/prompt.c.rej Removing src/bin/psql/prompt.h.rej === using 'git apply' to apply patch ./psql-prompt-command.patch === Falling back to direct application... Applied patch to 'src/bin/psql/command.c' cleanly. Applied patch to 'src/bin/psql/common.c' cleanly. Applied patch to 'src/bin/psql/help.c' cleanly. Applied patch to 'src/bin/psql/input.c' cleanly. Applied patch to 'src/bin/psql/input.h' cleanly. Applied patch to 'src/bin/psql/mainloop.c' cleanly. Falling back to direct application... Applied patch to 'src/bin/psql/prompt.c' with conflicts. Applied patch to 'src/bin/psql/prompt.h' with conflicts. Applied patch to 'src/bin/psql/startup.c' cleanly. U src/bin/psql/prompt.c U src/bin/psql/prompt.h diff --cc src/bin/psql/prompt.c index 681574bee79,2d7762050eb..00000000000 --- a/src/bin/psql/prompt.c +++ b/src/bin/psql/prompt.c @@@ -68,16 -249,24 +249,27 @@@ reset_prompt_status_after_connect(void */ char * -get_prompt(promptStatus_t status, ConditionalStack cstack) +get_prompt(promptStatus_t prompt_status, ConditionalStack cstack) { - #define MAX_PROMPT_SIZE 256 - static char destination[MAX_PROMPT_SIZE + 1]; - char buf[MAX_PROMPT_SIZE + 1]; + static PQExpBuffer destination = NULL; + char buf[MAX_PROMPT_SUBST_SIZE + 1]; bool esc = false; - const char *p; const char *prompt_string = "? "; static size_t last_prompt1_width = 0; ++<<<<<<< ours + switch (prompt_status) ++======= + if (destination == NULL) + destination = createPQExpBuffer(); + else + resetPQExpBuffer(destination); + + if (PQExpBufferBroken(destination)) + pg_fatal("out of memory"); + + switch (status) ++>>>>>>> theirs { case PROMPT_READY: prompt_string = pset.prompt1; @@@ -97,10 -286,8 +289,15 @@@ break; } ++<<<<<<< ours + destination[0] = '\0'; + + for (const char *p = prompt_string; + *p && strlen(destination) < sizeof(destination) - 1; ++======= + for (p = prompt_string; + *p && destination->len < MAX_PROMPT_SIZE; ++>>>>>>> theirs p++) { memset(buf, 0, sizeof(buf)); @@@ -389,8 -583,8 +593,13 @@@ /* Compute the visible width of PROMPT1, for PROMPT2's %w */ if (prompt_string == pset.prompt1) { ++<<<<<<< ours + char *d = destination; + char *end = d + strlen(d); ++======= + char *p = destination->data; + char *end = p + destination->len; ++>>>>>>> theirs bool visible = true; last_prompt1_width = 0; diff --cc src/bin/psql/prompt.h index b3fa4dba5e1,0c25a720384..00000000000 --- a/src/bin/psql/prompt.h +++ b/src/bin/psql/prompt.h @@@ -12,6 -12,8 +12,12 @@@ /* enum promptStatus_t is now defined by psqlscan.h */ #include "fe_utils/psqlscan.h" ++<<<<<<< ours +char *get_prompt(promptStatus_t prompt_status, ConditionalStack cstack); ++======= + char *get_prompt(promptStatus_t status, ConditionalStack cstack); + void run_prompt_command(void); + void reset_prompt_status_after_connect(void); ++>>>>>>> theirs #endif /* PROMPT_H */