Hacker News new | comments | show | ask | jobs | submit login
Customizing My Postgres Shell (citusdata.com)
139 points by craigkerstiens 183 days ago | hide | past | web | favorite | 7 comments

The article doesn't mention enabling unicode output.

    \pset linestyle unicode
and other related formatting options. Some examples here:

It's off by default for compatibility, but makes much more readable tabular output. I wrote this back in 2009 for 9.0, but not many people are aware of its existence (at least, I see plenty of ASCII output, and only occasional use of unicode in public writing).

This is cool. Always worth spending some time setting up psql.

In my psqlrc I also have a bunch of "macros" (unfortunately no parameters in psql) for common stuff like transaction handling and SET ROLE / RESET ROLE, lock monitoring etc.: https://github.com/hollobon/psqlrc/blob/master/psqlrc.conf Some of it only works on <=9.4.

Also, check out pgcli:


I used pgcli for awhile, but really missed being able to set \x auto. I do like the tab completion quite a bit.

Useful, though I choose:

    \pset null ␀
i.e. U+2400 SYMBOL FOR NULL as my null symbol.

\x auto

All these years I didn't know about this.

The prompt 1 setting in the article emboldens everything and leaves you terminal with the bolded setting on exit as it is missing a '%' It should be:

\set PROMPT1 '%[%033[1m%][%/]%033[0m%]% # '

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact