Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/5872~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/5872
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Oct 30, 2025

  1. Add %i prompt escape to indicate server read-only status

    This patch introduces a new prompt escape %i for psql, which shows
    whether the connected server is operating in read-only or read/write
    mode. It expands to "read-only" if any of the following are true:
    
      - The server is in hot standby mode (in_hot_standby = on)
      - The session's default transaction mode is read-only
        (default_transaction_read_only = on)
      - The current transaction is explicitly set to read-only via
        SET TRANSACTION READ ONLY (transaction_read_only = on)
    
    Otherwise, it displays "read/write".
    
    To minimize overhead, the implementation checks session-level parameters
    (in_hot_standby and default_transaction_read_only) first via
    PQparameterStatus(). If both indicate read/write mode, it queries the
    server for the transaction-level transaction_read_only setting.
    This means no extra queries are issued on hot standby systems or sessions
    with default_transaction_read_only = on.
    
    This is useful for distinguishing read-only sessions (e.g. connected
    to a standby, using a default read-only transaction mode, or in an
    explicit read-only transaction) from "read/write" ones at a glance,
    especially when working with multiple connections in replicated or
    restricted environments.
    jimjonesbr authored and Commitfest Bot committed Oct 30, 2025
    Configuration menu
    Copy the full SHA
    2d194a7 View commit details
    Browse the repository at this point in the history
  2. [CF 5872] v6 - Add prompt option to display read-only and read/write …

    …states in psql
    
    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5872
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/[email protected]
    Author(s): Jim Jones
    Commitfest Bot committed Oct 30, 2025
    Configuration menu
    Copy the full SHA
    246a9ae View commit details
    Browse the repository at this point in the history
Loading