Ubuntu – Is there syntax highlighting for psql

postgresqlsyntax highlighting

Is there some setting or package that I could use to give syntax highlighting to psql (the PostgreSQL shell)?

Best Answer

I just found pgcli (https://github.com/dbcli/pgcli) — a postgres client that does auto-completion and syntax highlighting. It looks awesome!

pgcli in action

Quick Start

If you already know how to install python packages, then you can simply do:

$ pip install pgcli

or

$ brew install pgcli  # Only on OS X

If you don't know how to install python packages, please check the detailed instructions.

Usage

$ pgcli [database_name]

or

$ pgcli postgresql://[user[:password]@][netloc][:port][/dbname] 

Examples:

$ pgcli local_database

$ pgcli postgres://amjith:pa$$w0rd@example.com:5432/app_db

Source: https://github.com/dbcli/pgcli