Re: Questions about proper newline handling in psql output

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Questions about proper newline handling in psql output
Date: 2005-09-27 13:58:31
Message-ID: 20050927135825.GA17593@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 27, 2005 at 03:02:29PM +0200, Peter Eisentraut wrote:
> I don't think this is necessary. If you put control characters into your
> text, then you clearly don't care about aligned output, so you don't get any.
> About \r, I think that needs to be figured into the alignment calculation, to
> work well on Windows and Mac.

Good point. On UNIX however, outputting a \r will jump back to the
beginning of the line, overwriting whatever was there. But you raise a
good question, should the output of psql be console specific. i.e. if
you insert a value with unix newlines then on a Mac the output won't
have linebreaks.

However, part of this discussion was because we were considering
changing the output of \df to display more info using multiple lines.
And if so we want it to display consistantly on all platforms, right?

My argument for the other control characters is: given the work to make
this work for \r, \t, and \n needs all this anyway, why not just fix it
for *all* control characters in one go and be completely solved of the
problem, for now and forever. If someone embeds the control characters
to change the title of your xterm, change the font, clear the screen,
etc should psql just blat that out? I realise it does it now and that
it's not a strong argument, but since we're here already...

> > 3. How to show that a value is continued? As you can see below I use
> > ':' before columns that have data. This obviously doesn't work for
> > first column if there's no outer border. If your border style is 0
> > you're totally out of luck.
>
> I think you need to keep the normal delimiter and need some extra mark within
> the table cells. (Think about how it would have to look in an HTML table.)

Umm, I wasn't thinking of changing the HTML output at all, it doesn't
need it since whatever displays the HTML will take care of alignment.
Same for troff and CSV. Straight aligned text output is the only one we
care about AFAICS (and the only one that requires work to make it
happen).

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-09-27 14:08:11 Re: Questions about proper newline handling in psql output
Previous Message Peter Eisentraut 2005-09-27 13:46:30 Re: Making pgxs builds work with a relocated installation