pgcli: Usage, Options & Common CI Errors
pgcli is a Postgres CLI with autocompletion and syntax highlighting.
pgcli is a friendlier psql for local work, occasionally used in CI for its CSV output. The catch is that it is a Python package (not bundled with Postgres) and is built for interactive TTYs.
What it does
pgcli connects to PostgreSQL like psql but adds smart autocompletion, syntax highlighting, and nicer table rendering. It accepts the same connection URLs and can run a single command non-interactively with -c.
Common usage
pip install pgcli
pgcli postgresql://postgres:secret@localhost:5432/app
pgcli -h localhost -U postgres -d app
pgcli postgresql://postgres:secret@localhost/app -c 'SELECT 1'
pgcli --csv -h localhost -U postgres -d app -c 'SELECT * FROM t'Options
| Item | What it does |
|---|---|
| postgresql://... URL | Connection string (same as psql) |
| -h / -U / -d | Host / user / database |
| -c "SQL" | Run one command and exit |
| --csv | Emit CSV instead of a table |
| --less-chatty | Reduce informational output |
Common errors in CI
pgcli: command not found - it is a pip package, not part of postgresql-client; pip install pgcli first (or just use psql, which is preinstalled). pgcli is designed for an interactive terminal, so without a TTY some features warn or misbehave; for scripted, parseable output prefer psql -t -A or pgcli --csv -c. Connection/auth errors are identical to psql (PGPASSWORD, host/port, password authentication failed).