pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
psql word wrapping to terminal width - testers?
2+ messages / 1 participants
[nested] [flat]

* psql word wrapping to terminal width - testers?
@ 2008-03-03 06:20 Bryce Nesbitt <bryce2@obviously.com>
  2008-03-03 19:30 ` Re: psql word wrapping to terminal width - testers? Bryce Nesbitt <bryce2@obviously.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Bryce Nesbitt @ 2008-03-03 06:20 UTC (permalink / raw)
  To: pgsql-sql@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>

I'm finishing up work on a version of the psql command line client that 
can can shrink columns until they fit in your terminal window.  For 
example on 67 column ssh session...

# \pset format aligned-wrapped
# \pset border 2
# select * from distributors order by did;
+------+--------------------+---------------------+---------------+
| did  |        name        |        descr        | long_col_name |
+------+--------------------+---------------------+---------------+
|    1 | Food fish and wine | default             |               |
|    2 | Cat Food Heaven 2  | abcdefghijklmnopqrs !               |
|      |                    | tuvwxyz             |               |
|    3 | Cat Food Heaven 3  | default             |               |
|    4 | Cat Food Heaven 4  | default             |               |
|    5 | Food Heaven        | default             |               |
|   10 | Lah                | default             |               |
|   12 | name               | line one            |               |
| 2892 ! short name         | short               |               |
| 8732 |                    |                     |               |
+------+--------------------+---------------------+---------------+
(8 rows)

...where columns 'descr' and 'did' each have a wrapped row.  I'll send a 
postgres 8.4devel linux intel binary to anyone willing to try it out.

I've got one painful edge case left to handle, but if it works well on 
various platforms, and others find it useful, I'd like to learn how and 
where to introduce it as a patch.  Any tips are appreciated.

This is intended to solve that annoying case where a few rows in a 
column are too long, blowing past the widest window you can fit onscreen.

          -Bryce Nesbitt




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: psql word wrapping to terminal width - testers?
  2008-03-03 06:20 psql word wrapping to terminal width - testers? Bryce Nesbitt <bryce2@obviously.com>
@ 2008-03-03 19:30 ` Bryce Nesbitt <bryce2@obviously.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Bryce Nesbitt @ 2008-03-03 19:30 UTC (permalink / raw)
  To: pgsql-sql; +Cc: Karsten Hilbert <Karsten.Hilbert@gmx.net>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
Karsten Hilbert wrote:<br>
<blockquote cite="mid:20080303122202.GA4028@merkur.hilbert.loc"
 type="cite">
  <blockquote type="cite">
    <pre wrap=""># \pset format aligned-wrapped
# \pset border 2
# select * from distributors order by did;
+------+--------------------+---------------------+---------------+
| did  |        name        |        descr        | long_col_name |
+------+--------------------+---------------------+---------------+
|    1 | Food fish and wine | default             |               |
|    2 | Cat Food Heaven 2  | abcdefghijklmnopqrs !               |
    </pre>
  </blockquote>
  <pre wrap=""><!---->                                                    ^
Any chance you could put an indicator here to point out the
field has been wrapped ?
  </pre>
</blockquote>
It is there but subtle.  Note the ! instead of |.<br>
<br>
<blockquote cite="mid:20080303122202.GA4028@merkur.hilbert.loc"
 type="cite">
  <pre wrap="">Did you consider

- a maximum length up to which fields will indeed be wrapped ?
  (\pset format aligned-wrapped 50)
  this will prevent a really large text field being wrapped to
  hundreds of lines thereby scrolling off everything else
  </pre>
</blockquote>
Yes, but truncating the request with substr() seems to address this
need.  A large field restricted in height would just blow out the width
otherwise.<br>
<br>
<blockquote cite="mid:20080303122202.GA4028@merkur.hilbert.loc"
 type="cite">
  <pre wrap="">
- ignoring wrapping bytea ?
  </pre>
</blockquote>
Why treat bytea specially?  In many cases it's unlikely to make any
sense to print on a console anyway.  How would you want bytea
represented?<br>
 <br>
<blockquote cite="mid:20080303122202.GA4028@merkur.hilbert.loc"
 type="cite">
  <pre wrap="">- allowing truncation of fields at a certain length before wrapping ?
  (well, this can be handled by truncating at the SQL level, too)

Even without any of the above suggestions this will be a
*very* appreciated improvement of the already excellent
psql.
Karsten
  </pre>
</blockquote>
</body>
</html>



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2008-03-03 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-03-03 06:20 psql word wrapping to terminal width - testers? Bryce Nesbitt <bryce2@obviously.com>
2008-03-03 19:30 ` Bryce Nesbitt <bryce2@obviously.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox