From: Michael Paquier Date: Thu, 29 Jan 2026 07:20:45 +0000 (+0900) Subject: psql: Disable %P (pipeline status) for non-active connection X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b77282f250103f2ecd54b9f45421c742006317b;p=thirdparty%2Fpostgresql.git psql: Disable %P (pipeline status) for non-active connection In the psql prompt, %P prompt shows the current pipeline status. Unlike most of the other options, its status was showing up in the output generated even if psql was not connected to a database. This was confusing, because without a connection a pipeline status makes no sense. Like the other options, %P is updated so as its data is now hidden without an active connection. Author: Chao Li Discussion: https://postgr.es/m/86EF76B5-6E62-404D-B9EC-66F4714D7D5F@gmail.com Backpatch-through: 18 --- diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c index 44eae59641e..891cd6374f0 100644 --- a/src/bin/psql/prompt.c +++ b/src/bin/psql/prompt.c @@ -199,6 +199,7 @@ get_prompt(promptStatus_t status, ConditionalStack cstack) break; /* pipeline status */ case 'P': + if (pset.db) { PGpipelineStatus status = PQpipelineStatus(pset.db); @@ -208,9 +209,8 @@ get_prompt(promptStatus_t status, ConditionalStack cstack) strlcpy(buf, "abort", sizeof(buf)); else strlcpy(buf, "off", sizeof(buf)); - break; } - + break; case '0': case '1': case '2':