vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + If your life is a hard drive, Christ can be your backup. + -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches |
| |||
| Bruce Momjian wrote: > 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. I heard a pretty compelling argument to make "wrapped" part of "aligned", and thus I think the patch is ready to go only after adjusting the user-facing syntax: \pset border 2 \pset format aligned Output format is aligned, no wrapping. \pset format aligned autowrap Output format is aligned, with automatic wrapping to the window width for terminals. \pset format aligned 80 Output format is aligned, with a target width of 80 characters. \a Output format is unaligned, no wrapping. \a Output format is aligned, with a target width of 80 characters. If the wrapping code can't fit the column headings in the wrap width, it gives up and produces aligned output. To do otherwise is totally unreadable. Please give the patch a try, before complaining about this particular aspect of it. -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches |
| |||
| Bryce Nesbitt wrote: > Bruce Momjian wrote: > > 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. > > I heard a pretty compelling argument to make "wrapped" part of "aligned", > and thus I think the patch is ready to go only after adjusting the > user-facing syntax: > > > \pset border 2 > \pset format aligned > Output format is aligned, no wrapping. > > \pset format aligned autowrap > Output format is aligned, with automatic wrapping to the window width for terminals. > > \pset format aligned 80 > Output format is aligned, with a target width of 80 characters. > > \a > Output format is unaligned, no wrapping. > \a > Output format is aligned, with a target width of 80 characters. > > > > If the wrapping code can't fit the column headings in the wrap width, > it gives up and produces aligned output. To do otherwise is totally > unreadable. Please give the patch a try, before complaining about this > particular aspect of it. Uh, well, we can do that, though looking at the psql code \pset only wants two arguments. We would have to modify how \pset works. Also, I am afraid making wrapping part of aligned is overly complicating the API. For example, I specificially kept \pset columns rather than allowing a third argument to pset because it was starting to look too complicated to describe in the manual. I am not 100% sure myself so hopefully others will comment. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + If your life is a hard drive, Christ can be your backup. + -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches |
| |||
| Bruce Momjian wrote: > Bryce Nesbitt wrote: > > Bruce Momjian wrote: > > > 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. > > > > I heard a pretty compelling argument to make "wrapped" part of "aligned", > > and thus I think the patch is ready to go only after adjusting the > > user-facing syntax: I think this is what makes the most sense of what I've seen so far. Wrapped is a special case of aligned anyway (there's no "wrapped unaligned" or "wrapped HTML" for example, nor would we want there to be.) > > Output format is aligned, no wrapping. > > > > \pset format aligned autowrap > > Output format is aligned, with automatic wrapping to the window width for terminals. > > > > \pset format aligned 80 > > Output format is aligned, with a target width of 80 characters. > Uh, well, we can do that, though looking at the psql code \pset only > wants two arguments. I think that could be fixed easily by having the syntax be something like \pset format aligned:80 \pset format aligned:autowrap etc. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches |
| |||
| "Alvaro Herrera" <alvherre@commandprompt.com> writes: > Bruce Momjian wrote: >> Bryce Nesbitt wrote: >> > Bruce Momjian wrote: >> > > 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. >> > >> > I heard a pretty compelling argument to make "wrapped" part of "aligned", >> > and thus I think the patch is ready to go only after adjusting the >> > user-facing syntax: > > I think this is what makes the most sense of what I've seen so far. > Wrapped is a special case of aligned anyway (there's no "wrapped > unaligned" or "wrapped HTML" for example, nor would we want there to > be.) Well there's no unaligned HTML or aligned unaligned either... > I think that could be fixed easily by having the syntax be something > like > > \pset format aligned:80 > \pset format aligned:autowrap I suppose. It seems kind of inconvenient though, what advantage does it have? -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's RemoteDBA services! -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches |
| |||
| Gregory Stark wrote: > "Alvaro Herrera" <alvherre@commandprompt.com> writes: > > I think that could be fixed easily by having the syntax be something > > like > > > > \pset format aligned:80 > > \pset format aligned:autowrap > > I suppose. It seems kind of inconvenient though, what advantage does it have? Over what? I think having a separate "\pset format wrapped" does not make much sense. The fact that it's wrapped is not a new format in itself, just a property of the aligned format. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches |
| ||||
| "Alvaro Herrera" <alvherre@commandprompt.com> writes: > The fact that it's wrapped is not a new format in itself, just a property of > the aligned format. Well I agree I just don't see any benefit to presenting it that way. I mean, sure "wrapped" means "aligned and wrapped", but it's just shorthand notation anyways. In fact, it seems the only reason to separate the two like you're describing would be if it *were* possible to have a wrapped html. Then your notation could handle things "\pset format wrapped" couldn't: \pset format html:autowrap But I think we agree that isn't happening so why spell it "aligned:autowrap" instead of just "wrap"? -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's On-Demand Production Tuning -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches |