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

From: Roger Leigh <rleigh(at)codelibre(dot)net>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unicode UTF-8 table formatting for psql text output
Date: 2009-10-31 16:19:40
Message-ID: 20091031161940.GA5993@codelibre.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 31, 2009 at 05:11:10AM -0700, Greg Stark wrote:
> On Mon, Oct 26, 2009 at 11:43 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> > On Mon, 2009-10-26 at 10:12 -0700, Greg Stark wrote:
> >> While i agree this looks nicer I wonder what it does to things like
> >> excel/gnumeric/ooffice auto-recognizing table layouts and importing
> >> files. I'm not sure our old format was so great for this so maybe this
> >> is actually an improvement I'm asking for. But as long as we're
> >> changing the format... It would at at least be good to test the
> >> behaviour
> >
> > What exactly are you referring to here?
>
> run something like this:
>
> $ psql
> stark=> \o /tmp/s
> stark=> select generate_series(1,10),generate_series(1,5);
> $ gnumeric /tmp/s&
> $ ooffice /tmp/s&
> $ kspread /tmp/s&
>
> With the 8.4 formatting gnumeric automatically guesses that | is the
> separator and formats the speadsheet quite reasonably. Open Office
> gets confused and opens the word processor, but if you do "insert
> sheet from file" and manually deselect the space and semicolon
> delimiters and put | as an "other" delimiter then it looks like it
> should work. I don't have kspread handy.
>
> Does gnumeric still autorecognize the new formats? Do the newline
> indicators in 8.4 mess up gnumeric? Are the new ones better or worse?
>
> This hasn't been a top priority in the past and the ReST discussion
> seemed to end up concluding that we shouldn't bother if we can't make
> it perfect. I'm not sure I agree with that, but in any case I think as
> long as we're changing the format we may as well check to see what the
> status is.

Surely if people want a machine-readable output format, they should
either

1) use libpq or one of its bindings, or
2) use a dedicated machine-readable output format such as CSV, which
is /designed/ for spreadsheet import.

The standard psql output formats (aligned, unaligned) are for
human-readable output and the others (latex, html, troff-ms) are
marked up for the respective tools. None of these are really
useful for other programs to parse.

Wouldn't it be much simpler all around to add a "csv" output format
in addition to the above for this purpose? Spreadsheets can read
it in with no trouble at all.

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-10-31 16:25:22 Re: Unicode UTF-8 table formatting for psql text output
Previous Message Peter Eisentraut 2009-10-31 13:59:27 Re: Patch set under development to add usage reporting.