Skip to content

Bundled psql binary built against libedit does not support prompt coloring #9837

@den-is

Description

@den-is

Describe the bug

I'm trying to add colors in psql sessions, to clearly distinguish INPUT, OUTPUT, continuation.
psql provided by pgAdmin is built against libedit - can't handle custom prompt color codes supported by libreadline

To Reproduce

Steps to reproduce the behavior:

  1. On MacOS install pgadmin4 using homebrew brew install --cask pgadmin4
    Expected behavior
  2. Configure colored prompts in your ~/.psqlrc (or whatever custom location)
    \set PROMPT1 '%R%[%033[1;32m%]%n%[%033[0m%]@%[%033[1;33m%]%/%[%033[0m%]%# '
    \set PROMPT2 '%[%033[0;36m%]...>%[%033[0m%] '
    
  3. Run the psql binary provided by pgAdmin or add the directory to $PATH
    ❯ /Applications/pgAdmin\ 4.app/Contents/SharedSupport/psql --version
    psql (PostgreSQL) 18.2
  4. Start psql session - prompts will remain black and white
  5. Then install brew install postgresql@18 and use psql from there - colors work just fine

Related issue from internet: https://postgrespro.ru/list/thread-id/1231489

Screenshots
PgAdmin provided psql - black and white - while custom prompts exist in psqlrc. Same result in Terminal or pgAdmin "PSQL Tool" tab.
Image

psql installed from postgresql@18 homebrew formula - desired result:
Image

Desktop (please complete the following information):

  • OS: MacOS - any recent - did not test other OSs
  • pgAdmin version: 9.14 - or any recent from past too
  • Mode: Desktop
  • Browser (if running in server mode): [e.g. chrome, safari]
  • Package type: DMG

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions