from Hacker News

Pspg – Postgres Pager

by willlll on 11/16/17, 12:15 AM with 21 comments

  • by jdonaldson on 11/16/17, 6:45 AM

    "If you like it, send a postcard from your home country to my address, please"

    My impression of the author went up 100%

  • by Dowwie on 11/16/17, 11:11 AM

    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

  • by ktpsns on 11/16/17, 11:04 AM

    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.
  • by vittore on 11/16/17, 7:20 AM

    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!
  • by oneweekwonder on 11/16/17, 3:15 PM

    > 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... [1]: https://stackoverflow.com/questions/26257724/set-less-as-pag...

  • by rmetzler on 11/16/17, 7:01 AM

    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. :-)

  • by digisth on 11/17/17, 1:13 AM

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

    https://unencumberedbyfacts.com/2016/01/04/psql-vim-happy-fa...

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

  • by barrkel on 11/16/17, 7:16 AM

    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).

  • by iracic on 11/16/17, 7:38 AM

    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.
  • by agentultra on 11/16/17, 3:24 PM

    Nice work! Cool project.

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

  • by Torgo on 11/16/17, 6:22 PM

    I have been using this for an hour, and it's already indispensable in my eyes.
  • by abstrct on 11/16/17, 6:40 AM

    Looks great! I'm excited to try this out
  • by cup-of-tea on 11/16/17, 9:36 AM

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