[Techtalk] Column display width on postgresql

Wim De Smet kromagg at gmail.com
Wed Jan 20 13:09:44 UTC 2010


Hi,

On Tue, Jan 19, 2010 at 12:54 PM, Anne Wainwright
<anotheranne at fables.co.za> wrote:
> Hi,
>
> My latest toy  :)
>
> When displaying a select query, how can I make the display
> default to one line per record?
>
> The width of the fields is too wide for the screen and thus the records
> wrap, even the shorter ones, to accomodate the longest field found in
> the selection.
>
> I have browsed thru the manual and also my postgresql book to no avail.
> I see nothing to set display column width.

This is most likely a setting of pgsql (which I assume is what you're
using?). The manual[1] seems to list a couple of options for changing
the formatting (search for \pset). Apparently you can even make it
output to a pager (such as "less"), so I'm pretty sure what you want
will be doable, if even just by formatting it yourself in a little
script.

Some possibilities:
\pset format unaligned
\pset expanded

There's a bunch more. I don't currently have a postgresql database
available I can try it on though.

regards,
Wim

[1]:http://www.rootr.net/man/man/psql/1


More information about the Techtalk mailing list