Re: Unicode UTF-8 table formatting for psql text output - Mailing list pgsql-hackers

From Roger Leigh
Subject Re: Unicode UTF-8 table formatting for psql text output
Date
Msg-id 20091004174445.GF353@codelibre.net
Whole thread Raw
In response to Re: Unicode UTF-8 table formatting for psql text output  ("Brad T. Sliger" <brad@sliger.org>)
Responses Re: Unicode UTF-8 table formatting for psql text output
List 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
additionto  
> 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

pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: COPY enhancements
Next
From: David Fetter
Date:
Subject: Rules: A Modest Proposal