Is there some setting or package that I could use to give syntax highlighting to psql (the PostgreSQL shell)?
Asked
Active
Viewed 5,147 times
10
Jeremy Kerr
- 26,769
- 4
- 48
- 62
tutuca
- 2,612
- 5
- 30
- 39
-
1Shouldn't this be a stackoverflow question? In any case I'm also looking for coloured display of `psql` results or help files, e.g. for `\h select` – nikola Nov 01 '13 at 14:55
2 Answers
13
I just found pgcli (https://github.com/dbcli/pgcli) — a postgres client that does auto-completion and syntax highlighting. It looks awesome!
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
honza-kasik
- 452
- 5
- 12
-
1While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Pilot6 Oct 21 '15 at 13:59
-
@Pilot6 Thanks for pointing it out, added image and more specific info. – honza-kasik Oct 23 '15 at 06:09
0
I realize this is an old question and @honza-kasik 's a great reply. However, to further add to it, it should be pointed out that Debian-based Linux users should install via APT:
sudo apt install pgcli
Doing this saves a lot of headaches you'd have installing via pip
alfx
- 348
- 4
- 11
