# pgcli

> Postgres CLI with autocompletion and syntax highlighting

Source: https://talira.ai/catalog/pgcli-11694q8b
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool
- Categories: [databases / postgres / cli clients](https://talira.ai/categories/databases/postgres/cli-clients), [databases / cli clients](https://talira.ai/categories/databases/cli-clients)
- Platforms: macos, linux, cli[^2][^3]
- Licence: BSD-3-Clause[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [dbcli](https://talira.ai/orgs/dbcli.md)

pgcli is a command-line client for [PostgreSQL](https://talira.ai/catalog/postgresql-cm55wcnd.md) with context-aware autocompletion and syntax highlighting, a friendlier alternative to `psql` in the terminal. As you type it completes SQL keywords and the connected database's tables and columns, suggesting only what fits where the cursor is, and it supports psql's backslash commands, connection by database name, URI or named DSN aliases from its config file, a row limit for big results, an external editor for long queries, and named queries you can save and reuse. It's written in Python and installs with pip, Homebrew or apt. It's part of the dbcli family, alongside mycli for MySQL and litecli for SQLite.

## Links

- Website: https://www.pgcli.com/
- GitHub: https://github.com/dbcli/pgcli

## Problems it solves

- I can never remember my table and column names when typing queries in psql
- psql has no syntax highlighting and long queries are hard to read
- autocomplete column names after SELECT in a Postgres terminal client
- save connection aliases for my staging and production Postgres databases
- stop a careless SELECT from dumping a million rows into my terminal
- edit a long SQL query in my editor and run it against Postgres
- save frequently used queries and run them by name from the terminal

## Features

- context-aware autocompletion of SQL keywords, tables and columns
- syntax highlighting
- psql-style backslash commands
- connections by name, URI or DSN alias
- row limit for large results
- external editor for queries
- named queries
- config file at ~/.config/pgcli/config
- pretty-printed tables

## Capabilities

- Has a command line tool: plan not known

## Trust

Overall: 0.65 out of 1.
Signals: maintenance 0.77, adoption 0.83, momentum 0.60, community 0.93, backing 0.30, extensibility 0.20.

- last commit 20 days ago
- 25 commits in the last 90 days
- latest release v4.7.1 2 months ago
- 13.5k GitHub stars
- 216 contributors
- backed by dbcli

## Sources

[^1]: https://github.com/dbcli/pgcli/blob/main/LICENSE.txt (checked 22 Nov 2026)
[^2]: https://www.pgcli.com/ (checked 22 Nov 2026)
[^3]: https://github.com/dbcli/pgcli (checked 22 Nov 2026)
