From: Michael Paquier Date: Thu, 29 Jan 2026 07:20:50 +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=d42735b1e8c8c6454a07b709e4ff7ccae4ad58c6;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 b08d7328fbf..92f01f900b1 100644 --- a/src/bin/psql/prompt.c +++ b/src/bin/psql/prompt.c @@ -188,6 +188,7 @@ get_prompt(promptStatus_t status, ConditionalStack cstack) break; /* pipeline status */ case 'P': + if (pset.db) { PGpipelineStatus status = PQpipelineStatus(pset.db); @@ -197,9 +198,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':