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 <[EMAIL PROTECTED]> http://momjian.us EnterpriseDB http://enterprisedb.com + If your life is a hard drive, Christ can be your backup. + -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers