
Pspg – Postgres Pager - willlll
https://github.com/okbob/pspg
======
jdonaldson
"If you like it, send a postcard from your home country to my address, please"

My impression of the author went up 100%

~~~
mtmail
[https://en.m.wikipedia.org/wiki/Postcardware](https://en.m.wikipedia.org/wiki/Postcardware)

------
Dowwie
I recommend using _pspg_ in conjunction with _pgcli_.

To install pgcli, simply "pip install pgcli" at the command line.

When you pip install pgcli, the config file is located in
~/.config/pgcli/config

\- The pager config line, which by default is commented out. You can define
the pager to use pspg here, or leave it commented out and simply add something
like this to your shell rc file: export PAGER="pspg -s 2"

\- Check out syntax_style (I like monokai)

from within a pgcli terminal, F4 lets you switch into VIM mode

Also, play around with the table format in the pgcli config. I have yet to
find a solid line grid but haven't stopped looking for it yet.

then, you get to combine the power of pgcli with pspg, for ultimate powahhhhh

------
ktpsns
It's so good that people still write high quality command line utilities in
the time everybody runs copies of browser engines for their editor and
messenger on the desktop (refereing to Electron, Atom, Slack). Especially when
managing servers over ssh (or ssh tunneled throught ssh tunneled thought ssh),
good utilities are invaluable.

~~~
MuffinFlavored
This actually raises a good question. Are operating systems going to like,
incorporate a "WebKit daemon" so that multiple instances of the browser
backend aren't loaded individually in every app?

------
vittore
Not bad but i like pgcli (pgcli.com) display of tabular data better. besides
it is not just that, it is such a nice command line tool for pg. That
autocomplete is a killer!

~~~
scrollaway
Edit: Nevermind! I was looking at a broken psql shim.

~~~
willlll
This is not correct. ctrl+c cancels the query and does not quit psql:

    
    
      =# select pg_sleep(10);
      ^CCancel request sent
      ERROR:  canceling statement due to user request
      Time: 1269.674 ms (00:01.270)

------
oneweekwonder
> Everybody who uses psql uses less pager.

Huh, I need to look into psql using less[0][1]. But having a look at the links
it seems running `psql` in `tmux` with `^b[` for back buffer access with vim
keys and regex search is how "I solved" this problem.

But in all honesty I normally find myself in pgadmin4.

[0]: [http://merlinmoncure.blogspot.co.za/2007/10/better-psql-
with...](http://merlinmoncure.blogspot.co.za/2007/10/better-psql-with-
less.html) [1]: [https://stackoverflow.com/questions/26257724/set-less-as-
pag...](https://stackoverflow.com/questions/26257724/set-less-as-pager-in-
psql)

------
rmetzler
Looks like a very interesting project. Could it be used with sqlite or Mysql?

Also interesting to note, that people refer to the blue colors as "Midnight
Commander Theme". I knew them as the colors of Norton Commander. :-)

------
digisth
If one prefers to use vim as a pager for psql, try this:

[https://unencumberedbyfacts.com/2016/01/04/psql-vim-happy-
fa...](https://unencumberedbyfacts.com/2016/01/04/psql-vim-happy-face/)

I've been using it for a few months, and it works great for me.

------
barrkel
Not bad, I like the column freeze feature.

If you have to use less, -S (on command line or inside less, it works in both
places) turns off line wrapping. It makes wide result sets workable and you
can scroll left and right (but no freezing, naturally).

~~~
sourcesmith
You could also use \x auto in .psqlrc to have it switch to vertical display of
records when they are too wide to display horizontally.

------
iracic
I use it for some time. No need to challenge your eyes with long lines or json
values anymore. This kind of result presentation should be in each command
line client. Very very useful.

------
agentultra
Nice work! Cool project.

I like the combination of pgcli + pspg... now if there were only a way to
graph stats a-la pgadmin!

------
Torgo
I have been using this for an hour, and it's already indispensable in my eyes.

------
abstrct
Looks great! I'm excited to try this out

------
cup-of-tea
This looks good, but why is it specific to postgres? Can't something like this
be used with any tabular data?

~~~
okbobcz
I checked it, and I hope so MySQL can be supported too. pspg is just pager -
it is not data formatter, so raw data like CSV cannot be processed there. But
if some tool translate data to MySQL or PostgreSQL tabular format, then this
pager can be used.

