Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b77282

Browse files
committed
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 <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: 18
1 parent 740a149 commit 4b77282

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin/psql/prompt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ get_prompt(promptStatus_t status, ConditionalStack cstack)
199199
break;
200200
/* pipeline status */
201201
case 'P':
202+
if (pset.db)
202203
{
203204
PGpipelineStatus status = PQpipelineStatus(pset.db);
204205

@@ -208,9 +209,8 @@ get_prompt(promptStatus_t status, ConditionalStack cstack)
208209
strlcpy(buf, "abort", sizeof(buf));
209210
else
210211
strlcpy(buf, "off", sizeof(buf));
211-
break;
212212
}
213-
213+
break;
214214
case '0':
215215
case '1':
216216
case '2':

0 commit comments

Comments
 (0)