Re: [HACKERS] Proposed patch - psql wraps at window width

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Cc: Bryce Nesbitt <bryce2(at)obviously(dot)com>, heikki(at)enterprisedb(dot)com
Subject: Re: [HACKERS] Proposed patch - psql wraps at window width
Date: 2008-04-29 02:11:16
Message-ID: 200804290211.m3T2BGI04844@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


I have updated the documentation for this patch. I consider it ready to
apply. I think it is as close to a middle ground as we are going to
get. Further adjustment will have to happen when we have more reports
from the field.

---------------------------------------------------------------------------

Bruce Momjian wrote:
> I have moved this discussion to hackers in hopes of getting more
> feedback, and moved the patch to a static URL:
>
> ftp://momjian.us/pub/postgresql/mypatches/wrap
>
> This patch adds a new '\pset format wrapped' mode that wraps long values
> to fit the table on the user's screen, or in '\pset columns' columns in
> an output to file or pipe. The documentation additions are at the top
> of the patch.
>
> Sample:
>
> \pset format wrapped
> Output format is wrapped.
>
> \pset columns 70
> Target column width for "wrap" format is 70.
>
> SELECT 1, 2, repeat('a', 80), repeat('b', 80), E'a\nb\nc', 1
> FROM generate_series(1,2)\g
>
> ?column? | ?column? | repeat | repeat | ?column? | ?column?
> ----------+----------+------------+-------------+----------+----------
> 1 | 2 | aaaaaaaaaa | bbbbbbbbbbb | a | 1
> ; aaaaaaaaaa ; bbbbbbbbbbb : b
> ; aaaaaaaaaa ; bbbbbbbbbbb : c
> ; aaaaaaaaaa ; bbbbbbbbbbb
> ; aaaaaaaaaa ; bbbbbbbbbbb
> ; aaaaaaaaaa ; bbbbbbbbbbb
> ; aaaaaaaaaa ; bbbbbbbbbbb
> ; aaaaaaaaaa ; bbb
> 1 | 2 | aaaaaaaaaa | bbbbbbbbbbb | a | 1
> ; aaaaaaaaaa ; bbbbbbbbbbb : b
> ; aaaaaaaaaa ; bbbbbbbbbbb : c
> ; aaaaaaaaaa ; bbbbbbbbbbb
> ; aaaaaaaaaa ; bbbbbbbbbbb
> ; aaaaaaaaaa ; bbbbbbbbbbb
> ; aaaaaaaaaa ; bbbbbbbbbbb
> ; aaaaaaaaaa ; bbb
> (2 rows)
>
> You will notice:
>
> o I have pulled up newline values to appear in the same rows
> as the wrapped text
> o Colons are used on the left for newline values
> o Semicolons are used on the left for wrapped values
> o There are no vertical bars for values that don't extend
> to the wrapped or newline rows. This is how our
> newline display has always worked so it was copied
> by the wrapped code
> o The left column has no indicator of wrapping or newlines
> because there is no left border
>
> We could use dashes to indicated wrapped values, but we don't. It would
> be nice if someone could do some multi-byte testing of this,
> particularly for characters that have a display width greater than one.
>
> I think this patch is ready for application.
>
> Should 'wrapped' be the default for certain operations, like \df?
> 'wrapped' mode is really good for a table that would fit the screen
> width except for a few wide values.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/pgpatches/wrap text/x-diff 34.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-04-29 02:22:31 Re: [COMMITTERS] pgsql: Add generate_subscripts, a series-generation function which
Previous Message Bruce Momjian 2008-04-29 00:08:10 Re: Proposed patch - psql wraps at window width

Browse pgsql-patches by date

  From Date Subject
Next Message Bryce Nesbitt 2008-04-29 04:43:59 Re: [HACKERS] Proposed patch - psql wraps at window width
Previous Message Tom Lane 2008-04-28 21:07:28 Re: [HACKERS] Removing typename from A_Const (was: Empty arrays with ARRAY[])