Re: Unicode UTF-8 table formatting for psql text output

From: Roger Leigh <rleigh(at)codelibre(dot)net>
To: "Brad T(dot) Sliger" <brad(at)sliger(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Selena Deckelmann <selenamarie(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Roger Leigh <rleigh(at)debian(dot)org>
Subject: Re: Unicode UTF-8 table formatting for psql text output
Date: 2009-10-04 17:44:45
Message-ID: 20091004174445.GF353@codelibre.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 02, 2009 at 05:34:16PM -0700, Brad T. Sliger wrote:
> On Friday 02 October 2009 04:21:35 Roger Leigh wrote:
> > I have attached a patch which implements the feature as a pset
> > variable. This also slightly simplifies some of the patch since
> > the table style is passed to functions directly in printTableContent
> > rather than separately. The psql option '-P tablestyle=ascii' is
> > passed to psql in pg_regress_main.c which means the testsuite doesn't
> > fail any more. The option is documented in the psql docs, and is
> > also tab-completed. Users can just put '\pset tablestyle ascii' in
> > their .psqlrc if they want the old format in a UTF-8 locale.
>
> I looked at psql-utf8-table-5.patch.

Many thanks for taking the time to do this. I've attached a followup
patch which addresses your point below:

> Lint(1) says there is an extra trailing ',' in src/bin/psql/print.h. in 'typedef enum printTextRule'. The addition to
> src/bin/psql/command.c could use a comment, like adjacent code.

Fixed.

> 'ASCII' and 'UTF8' may need <acronym></acronym> tags in doc/src/sgml/ref/psql-ref.sgml, like adjacent
> code. I'm not sure someone who hasn't seen this patch in action would immediately know what it does from the
> documentation. `gmake html` works without the patch, but fails with the patch:

Also fixed. I also added some additional explanation of the option which
hopefully makes its purpose more obvious. The <acronym> tag isn't used for
the itemised option list names, but is used in the descriptive text; I can
also add it there if appropriate.

It's likely that "tablestyle" could well be named better. "format" is
already used, but if there's a more intuitive name that fits better,
I'm happy to change it.
> openjade:ref/psql-ref.sgml:1692:15:E: document type does not allow element "TERM" here; assuming
> missing "VARLISTENTRY" start-tag

Also fixed.

> After the patch, `\pset format wrapped` produces '\pset: unknown option: format'. I saw this in interactive psql
> and from .psqlrc. I think this can be fixed by changing the addition to src/bin/psql/command.c from an 'if' clause to
> an 'else if' clause.

Oops, yes. Sorry about that hiccup. I've also fixed this.

Regards,
Roger

--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.

Attachment Content-Type Size
psql-utf8-table-6.patch text/x-diff 19.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2009-10-04 17:54:13 Rules: A Modest Proposal
Previous Message Jeff Davis 2009-10-04 17:43:18 Re: COPY enhancements