Monday, September 7, 2009

output console psql postgresql / editor

this post i read really makes psql better: http://merlinmoncure.blogspot.com/2007/10/better-psql-with-less.html


you could also try PAGER="more", i used to like it better

A better psql with less
psql is a great tool, but not very good at browsing data. Or is it? The following settings will make psql much more usable.

in your user profile:
export PAGER=less
export LESS="-iMSx4 -FX"

in your .psqlrc (make it if it's not already there)

\timing
\pset pager always

log in into psql ...

voilĂ 

2 comments:

  1. update:

    i find it a lot more useful not using the S option... S = chop long lines, i like then folded...

    whener you press right arrow key, the lines are show non-folded

    ReplyDelete
  2. another useful option with less is the -#, which controls the amount of characters to the left or right that less shifts when the arrow is pressed...

    this can be also set dinamically, by pressing ESC 10 RIGHTARROW (moves 10 characters to the right)

    ReplyDelete