Re: psql: make %P prompt option consistent when not connected

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Chao Li <li.evan.chao@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-29T00:32:14Z
Lists: pgsql-hackers
On Wed, Jan 28, 2026 at 04:38:08PM +0800, Chao Li wrote:
> While reviewing and testing patch [1], I noticed that psql’s %P
> prompt option does not check pset.db, which makes it inconsistent
> with other prompt options. As a result, when there is no database
> connection, other prompt elements are suppressed, but the pipeline
> status is still shown.

Point taken.  It's true that it is confusing to show an "off" status
in this case if we don't have an active connection.  Will adjust and
backpatch.
--
Michael

Commits

  1. psql: Disable %P (pipeline status) for non-active connection