Re: explain output infelicity in psql

Lists: pgsql-hackers
From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: explain output infelicity in psql
Date: 2009-12-09 19:37:49
Message-ID: 4B1FFC8D.6070208@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I have just noticed while checking the EXPLAIN YAML patch that the
non-text explain formats are output as a single line with embedded line
feeds, while the text format is delivered as a set of text records, one
per line. The practical effect of this is that psql decorates the
non-text format output with continuation characters:

andrew=# explain select count(*) from pg_class where relname ~ 'pg_';
QUERY PLAN
----------------------------------------------------------------
Aggregate (cost=9.67..9.68 rows=1 width=0)
-> Seq Scan on pg_class (cost=0.00..9.16 rows=204 width=0)
Filter: (relname ~ 'pg_'::text)
(3 rows)

Time: 5.813 ms
andrew=# explain (format yaml) select count(*) from pg_class where
relname ~ 'pg_';
QUERY PLAN
-----------------------------------------
- Plan: +
Node Type: Aggregate +
Strategy: Plain +
Startup Cost: 9.67 +
Total Cost: 9.68 +
Plan Rows: 1 +
Plan Width: 0 +
Plans: +
- Node Type: Seq Scan +
Parent Relationship: Outer +
Relation Name: pg_class +
Alias: pg_class +
Startup Cost: 0.00 +
Total Cost: 9.16 +
Plan Rows: 204 +
Plan Width: 0 +
Filter: (relname ~ 'pg_'::text)
(1 row)

Those + chars at the end of the line are ugly, to say the least, and
they make the supposedly machine-readable formats not so machine
readable if anyone wanted to c&p the output into a parser. (I'm mildly
surprised this hasn't been noticed before).

Maybe we need to teach psql not to do this formatting for EXPLAIN output?

cheers

andrew


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-09 21:06:08
Message-ID: 603c8f070912091306r6dd1f3efh6dd72ac9bda205f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Dec 9, 2009 at 2:37 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
> I have just noticed while checking the EXPLAIN YAML patch that the non-text
> explain formats are output as a single line with embedded line feeds, while
> the text format is delivered as a set of text records, one per line. The
> practical effect of this is that psql decorates the non-text format output
> with continuation characters:
>
>   andrew=# explain select count(*) from pg_class where relname ~ 'pg_';
>                              QUERY PLAN
> ----------------------------------------------------------------
>    Aggregate  (cost=9.67..9.68 rows=1 width=0)
>      ->  Seq Scan on pg_class  (cost=0.00..9.16 rows=204 width=0)
>            Filter: (relname ~ 'pg_'::text)
>   (3 rows)
>
>   Time: 5.813 ms
>   andrew=# explain (format yaml) select count(*) from pg_class where
>   relname ~ 'pg_';
>                  QUERY PLAN
> -----------------------------------------
>     - Plan:                               +
>        Node Type: Aggregate               +
>        Strategy: Plain                    +
>        Startup Cost: 9.67                 +
>        Total Cost: 9.68                   +
>        Plan Rows: 1                       +
>        Plan Width: 0                      +
>        Plans:                             +
>          - Node Type: Seq Scan            +
>            Parent Relationship: Outer     +
>            Relation Name: pg_class        +
>            Alias: pg_class                +
>            Startup Cost: 0.00             +
>            Total Cost: 9.16               +
>            Plan Rows: 204                 +
>            Plan Width: 0                  +
>            Filter: (relname ~ 'pg_'::text)
>   (1 row)
>
> Those + chars at the end of the line are ugly, to say the least, and they
> make the supposedly machine-readable formats not so machine readable if
> anyone wanted to c&p the output into a parser. (I'm mildly surprised this
> hasn't been noticed before).
>
> Maybe we need to teach psql not to do this formatting for EXPLAIN output?

Oh, dear. I think that line continuation syntax was recently added -
subsequent to the machine-readable EXPLAIN patch. The reason why it's
coded to emit everything as a single row is because that will be most
convenient for programs that are sucking down this data
programatically. Otherwise, they'll have to concatenate all the lines
that are returned.

And in fact for XML format, it's even worse: the data is returned as
type xml, but that obviously won't fly if we return each line as a
separate tuple.

On first blush, I'm inclined to suggest that the addition of + signs
to mark continuation lines is a misfeature.

...Robert


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-09 23:41:55
Message-ID: 4B2035C3.4020703@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas wrote:
> On Wed, Dec 9, 2009 at 2:37 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
>> I have just noticed while checking the EXPLAIN YAML patch that the non-text
>> explain formats are output as a single line with embedded line feeds, while
>> the text format is delivered as a set of text records, one per line. The
>> practical effect of this is that psql decorates the non-text format output
>> with continuation characters:
>>
>>
[snip]
>> Those + chars at the end of the line are ugly, to say the least, and they
>> make the supposedly machine-readable formats not so machine readable if
>> anyone wanted to c&p the output into a parser. (I'm mildly surprised this
>> hasn't been noticed before).
>>
>> Maybe we need to teach psql not to do this formatting for EXPLAIN output?
>>
>
> Oh, dear. I think that line continuation syntax was recently added -
> subsequent to the machine-readable EXPLAIN patch. The reason why it's
> coded to emit everything as a single row is because that will be most
> convenient for programs that are sucking down this data
> programatically. Otherwise, they'll have to concatenate all the lines
> that are returned.
>
> And in fact for XML format, it's even worse: the data is returned as
> type xml, but that obviously won't fly if we return each line as a
> separate tuple.
>
> On first blush, I'm inclined to suggest that the addition of + signs
> to mark continuation lines is a misfeature.
>
>
>

I certainly agree we don't want to break up the non-text formats.

A simple if ugly hack would make psql use old-ascii print style (which
doesn't use these contionuation chars) if the first attribute in the
resultset was named 'QUERY PLAN'

If someone has a better suggestion I'm all ears.

cheers

andrew


From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 07:06:00
Message-ID: 162867790912092306v3631e8ddxf8399b0d2b978ac6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2009/12/9 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Wed, Dec 9, 2009 at 2:37 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>
>> I have just noticed while checking the EXPLAIN YAML patch that the non-text
>> explain formats are output as a single line with embedded line feeds, while
>> the text format is delivered as a set of text records, one per line. The
>> practical effect of this is that psql decorates the non-text format output
>> with continuation characters:
>>
>>   andrew=# explain select count(*) from pg_class where relname ~ 'pg_';
>>                              QUERY PLAN
>> ----------------------------------------------------------------
>>    Aggregate  (cost=9.67..9.68 rows=1 width=0)
>>      ->  Seq Scan on pg_class  (cost=0.00..9.16 rows=204 width=0)
>>            Filter: (relname ~ 'pg_'::text)
>>   (3 rows)
>>
>>   Time: 5.813 ms
>>   andrew=# explain (format yaml) select count(*) from pg_class where
>>   relname ~ 'pg_';
>>                  QUERY PLAN
>> -----------------------------------------
>>     - Plan:                               +
>>        Node Type: Aggregate               +
>>        Strategy: Plain                    +
>>        Startup Cost: 9.67                 +
>>        Total Cost: 9.68                   +
>>        Plan Rows: 1                       +
>>        Plan Width: 0                      +
>>        Plans:                             +
>>          - Node Type: Seq Scan            +
>>            Parent Relationship: Outer     +
>>            Relation Name: pg_class        +
>>            Alias: pg_class                +
>>            Startup Cost: 0.00             +
>>            Total Cost: 9.16               +
>>            Plan Rows: 204                 +
>>            Plan Width: 0                  +
>>            Filter: (relname ~ 'pg_'::text)
>>   (1 row)
>>
>> Those + chars at the end of the line are ugly, to say the least, and they
>> make the supposedly machine-readable formats not so machine readable if
>> anyone wanted to c&p the output into a parser. (I'm mildly surprised this
>> hasn't been noticed before).
>>
>> Maybe we need to teach psql not to do this formatting for EXPLAIN output?
>
> Oh, dear.  I think that line continuation syntax was recently added -
> subsequent to the machine-readable EXPLAIN patch.  The reason why it's
> coded to emit everything as a single row is because that will be most
> convenient for programs that are sucking down this data
> programatically.  Otherwise, they'll have to concatenate all the lines
> that are returned.
>
> And in fact for XML format, it's even worse: the data is returned as
> type xml, but that obviously won't fly if we return each line as a
> separate tuple.
>
> On first blush, I'm inclined to suggest that the addition of + signs
> to mark continuation lines is a misfeature.

+1

Pavel

>
> ...Robert
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 13:12:32
Message-ID: 20091210131232.GG15554@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas escribió:

> On first blush, I'm inclined to suggest that the addition of + signs
> to mark continuation lines is a misfeature.

-1

EXPLAIN is a special case. IMHO it should be dealt with accordingly.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Roger Leigh <rleigh(at)codelibre(dot)net>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 13:29:55
Message-ID: 20091210132954.GC3338@codelibre.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Dec 10, 2009 at 10:12:32AM -0300, Alvaro Herrera wrote:
> Robert Haas escribió:
>
> > On first blush, I'm inclined to suggest that the addition of + signs
> > to mark continuation lines is a misfeature.
>
> -1
>
> EXPLAIN is a special case. IMHO it should be dealt with accordingly.

If the formatting code can be taught that it's outputting for explain,
we can skip the wrap/newline markup easily. I don't think we
necessarily need to fall back to the old-ascii format, we just
conditionally disable that specific part.

Alternatively, would it make more sense just to add a boolean pset
parameter to enable/disable the use of wrap/newline marks? It may
be that people may wish to disable it for use cases in addition
to EXPLAIN.

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.


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Roger Leigh <rleigh(at)codelibre(dot)net>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 13:41:15
Message-ID: 4B20FA7B.1070303@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Roger Leigh wrote:
> On Thu, Dec 10, 2009 at 10:12:32AM -0300, Alvaro Herrera wrote:
>
>> Robert Haas escribió:
>>
>>
>>> On first blush, I'm inclined to suggest that the addition of + signs
>>> to mark continuation lines is a misfeature.
>>>
>> -1
>>
>> EXPLAIN is a special case. IMHO it should be dealt with accordingly.
>>
>
> If the formatting code can be taught that it's outputting for explain,
> we can skip the wrap/newline markup easily. I don't think we
> necessarily need to fall back to the old-ascii format, we just
> conditionally disable that specific part.
>
> Alternatively, would it make more sense just to add a boolean pset
> parameter to enable/disable the use of wrap/newline marks? It may
> be that people may wish to disable it for use cases in addition
> to EXPLAIN.
>
>
>
>

We have already added a lot of knobs to twist, and I don't want to add
any more.

cheers

andrew


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 14:22:10
Message-ID: 603c8f070912100622m55ad3db5j6515bd1f60cfecba@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Dec 9, 2009 at 6:41 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>> Oh, dear.  I think that line continuation syntax was recently added -
>> subsequent to the machine-readable EXPLAIN patch.  The reason why it's
>> coded to emit everything as a single row is because that will be most
>> convenient for programs that are sucking down this data
>> programatically.  Otherwise, they'll have to concatenate all the lines
>> that are returned.
>>
>> And in fact for XML format, it's even worse: the data is returned as
>> type xml, but that obviously won't fly if we return each line as a
>> separate tuple.
>>
>> On first blush, I'm inclined to suggest that the addition of + signs
>> to mark continuation lines is a misfeature.
>
> I certainly agree we don't want to break up the non-text formats.
>
> A simple if ugly hack would make psql use old-ascii print style (which
> doesn't use these contionuation chars) if the first attribute in the
> resultset was named 'QUERY PLAN'
>
> If someone has a better suggestion I'm all ears.

I don't believe that machine-readable EXPLAIN output is the only
multi-line output value that anyone would ever wish to cut and paste
into an editor without picking up a lot of stray garbage, so I don't
think this is a solution.

...Robert


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 14:40:05
Message-ID: 4B210845.8090300@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas wrote:
> I don't believe that machine-readable EXPLAIN output is the only
> multi-line output value that anyone would ever wish to cut and paste
> into an editor without picking up a lot of stray garbage, so I don't
> think this is a solution.
>
>
>

Well, yes, another example that has just occurred to me is
pg_proc.prosrc. So maybe this really is a misfeature.

cheers

andrew


From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 16:44:16
Message-ID: 4B212560.5090907@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Robert Haas escribió:
>> On first blush, I'm inclined to suggest that the addition of + signs
>> to mark continuation lines is a misfeature.
>
> EXPLAIN is a special case. IMHO it should be dealt with accordingly.
>

Is it?

Wouldn't it affect anyone who stuck XML in a txt column and wanted
to copy and paste it into a parser?

Perhaps single column output usually won't want the + signs (because
it's copy&pasteable) but multi-column output could?


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 17:07:09
Message-ID: 4B212ABD.7060602@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Ron Mayer wrote:
> Alvaro Herrera wrote:
>
>> Robert Haas escribió:
>>
>>> On first blush, I'm inclined to suggest that the addition of + signs
>>> to mark continuation lines is a misfeature.
>>>
>> EXPLAIN is a special case. IMHO it should be dealt with accordingly.
>>
>>
>
> Is it?
>
> Wouldn't it affect anyone who stuck XML in a txt column and wanted
> to copy and paste it into a parser?
>
> Perhaps single column output usually won't want the + signs (because
> it's copy&pasteable) but multi-column output could?
>

Yeah, I'm thinking we should probably suppress output of format.nl_right
(no matter what the format) where there is only one column. (This is
even uglier with unicode linestyle, btw). That's a sane rule and it's
not an ugly hack.

cheers

andrew


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 17:08:01
Message-ID: 603c8f070912100908j3ea1d714l1e5eb5d147563e94@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Dec 10, 2009 at 11:44 AM, Ron Mayer
<rm_pg(at)cheapcomplexdevices(dot)com> wrote:
> Alvaro Herrera wrote:
>> Robert Haas escribió:
>>> On first blush, I'm inclined to suggest that the addition of + signs
>>> to mark continuation lines is a misfeature.
>>
>> EXPLAIN is a special case.  IMHO it should be dealt with accordingly.
>>
>
> Is it?
>
> Wouldn't it affect anyone who stuck XML in a txt column and wanted
> to copy and paste it into a parser?
>
> Perhaps single column output usually won't want the + signs (because
> it's copy&pasteable) but multi-column output could?

I don't think inconsistency is a good thing here. Apparently the old
format is available via \pset linestyle old-ascii. We can either
decide that people should use that format if they want that behavior,
or we can decide that changing the default was a mistake and revert
it. I don't think a half-way-in-between solution is a good option.

...Robert


From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Robert Haas" <robertmhaas(at)gmail(dot)com>
Cc: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 17:10:27
Message-ID: 4B20D723020000250002D2FC@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

>> A simple if ugly hack would make psql use old-ascii print style
>> (which doesn't use these contionuation chars) if the first
>> attribute in the resultset was named 'QUERY PLAN'

> I don't believe that machine-readable EXPLAIN output is the only
> multi-line output value that anyone would ever wish to cut and
> paste into an editor without picking up a lot of stray garbage, so
> I don't think this is a solution.

Agreed.

This would be a significant annoyance for me on a regular basis. If
I can't turn it off, it would probably cause me to create my own
locally patched version of psql. Another alternative would be to
use some other tool to run queries where I wanted long values
without this, but psql has so many nice features that I'd be
switching back and forth, so the patch would probably be easier.

-Kevin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 17:23:58
Message-ID: 25216.1260465838@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Yeah, I'm thinking we should probably suppress output of format.nl_right
> (no matter what the format) where there is only one column. (This is
> even uglier with unicode linestyle, btw). That's a sane rule and it's
> not an ugly hack.

Yes it is. The real problem here is expecting the tabular format to be
copy and pasteable, which is not a design goal it's ever had, and not
one that we can start imposing on it at this late date. Why don't you
just do "\pset format unaligned" (or "\a" if you're lazy)?

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 17:43:14
Message-ID: 4B213332.10700@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> Yeah, I'm thinking we should probably suppress output of format.nl_right
>> (no matter what the format) where there is only one column. (This is
>> even uglier with unicode linestyle, btw). That's a sane rule and it's
>> not an ugly hack.
>>
>
> Yes it is.

I don't see much virtue of having these characters when there is only
one column.

> The real problem here is expecting the tabular format to be
> copy and pasteable, which is not a design goal it's ever had, and not
> one that we can start imposing on it at this late date. Why don't you
> just do "\pset format unaligned" (or "\a" if you're lazy)?
>
>
>

Well, I haven't had to up to now. I'm not sure what we have is exactly
an advance. I guess I can set the linestyle to old-ascii in my .psqlrc,
but having to do that all over the place is annoying.

And clearly I'm not the only person who doesn't like this behaviour.

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 17:55:46
Message-ID: 25681.1260467746@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> I don't see much virtue of having these characters when there is only
> one column.

So you can tell a newline in the data from a wrap due to line length.
The need to be able to do that is not dependent on how many columns
there are.

> And clearly I'm not the only person who doesn't like this behaviour.

It's just our usual negative reaction to any change whatsoever ;-).
I was unimpressed with Leigh's changes too at the start, but I can see
that there is value in it.

I think that changing the behavior depending on how many columns there
are is an incredibly ugly hack, and your assertions to the contrary
aren't going to change my mind. If we think that this is such a bad
idea it should be reverted, then let's revert it altogether.

Another possibility, which I don't understand why it was dismissed so
cavalierly, is to have EXPLAIN put out one row per logical line instead
of using embedded newlines.

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 17:57:25
Message-ID: 603c8f070912100957g7e373f8aj767720fd83d385b8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Dec 10, 2009 at 12:43 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> Tom Lane wrote:
>>
>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>
>>>
>>> Yeah, I'm thinking we should probably suppress output of format.nl_right
>>> (no matter what the format) where there is only one column. (This is even
>>> uglier with unicode linestyle, btw). That's a sane rule and it's not an ugly
>>> hack.
>>>
>>
>> Yes it is.
>
> I don't see much virtue of having these characters when there is only one
> column.

I don't see much virtue in having these characters, period. The reason
for having them is presumably to avoid confusion between two rows and
one row with an embedded newline. If anything, this confusion is more
likely with a single column than it is with multiple columns, since
you don't have the context of the surrounding output.

...Robert


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 18:12:52
Message-ID: 4B213A24.4030905@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> I don't see much virtue of having these characters when there is only
>> one column.
>>
>
> So you can tell a newline in the data from a wrap due to line length.
> The need to be able to do that is not dependent on how many columns
> there are.
>

If that's really what we want then I think we're doing a terrible job of
it. Have a look at the output of:

select
E'xxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
as a, 1 as b;

How do we know from that where the linefeeds are, exactly?

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 18:19:00
Message-ID: 28920.1260469140@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Tom Lane wrote:
>> So you can tell a newline in the data from a wrap due to line length.
>> The need to be able to do that is not dependent on how many columns
>> there are.

> If that's really what we want then I think we're doing a terrible job of
> it. Have a look at the output of:

> select
> E'xxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
> as a, 1 as b;

> How do we know from that where the linefeeds are, exactly?

It works quite nicely for me ... in HEAD that is:

regression=# select E'xxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
as a, 1 as b;
a | b
------------------------------------------------------+---
xxxxxxx +| 1
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
(1 row)

regression=#

The point here is exactly that previous versions didn't show the
distinction well.

regards, tom lane


From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 18:22:09
Message-ID: 4B213C51.10001@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Why don't you
> just do "\pset format unaligned" (or "\a" if you're lazy)?

That's fair. Now that I see it, I guess I should have been
doing that for copy&paste work anyway.


From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Ron Mayer" <rm_pg(at)cheapcomplexdevices(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Robert Haas" <robertmhaas(at)gmail(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 19:07:37
Message-ID: 4B20F299020000250002D324@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> wrote:
> Tom Lane wrote:
>> Why don't you
>> just do "\pset format unaligned" (or "\a" if you're lazy)?
>
> That's fair. Now that I see it, I guess I should have been
> doing that for copy&paste work anyway.

That'll cover my use cases.

-Kevin


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 19:08:13
Message-ID: 4B21471D.9090405@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> regression=# select E'xxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
> as a, 1 as b;
> a | b
> ------------------------------------------------------+---
> xxxxxxx +| 1
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +|
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
> (1 row)
>
> regression=#
>
> The point here is exactly that previous versions didn't show the
> distinction well.
>
>
>

If we really want to make linefeeds visible, I think we should place the
indicators immediately after the character preceding the line feed, not
next to the column separator.

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 19:45:31
Message-ID: 3975.1260474331@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> If we really want to make linefeeds visible, I think we should place the
> indicators immediately after the character preceding the line feed, not
> next to the column separator.

Then it's hard to tell it apart from an instance of that character in
the data.

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-10 20:13:23
Message-ID: 4B215663.1080902@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> If we really want to make linefeeds visible, I think we should place the
>> indicators immediately after the character preceding the line feed, not
>> next to the column separator.
>>
>
> Then it's hard to tell it apart from an instance of that character in
> the data.
>
>
>

Yeah, I just thought of that. Oh, well, old-ascii for me ;-)

cheers

andrew


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-11 01:11:19
Message-ID: 200912110111.nBB1BJN01558@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan wrote:
>
>
> Tom Lane wrote:
> > regression=# select E'xxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
> > as a, 1 as b;
> > a | b
> > ------------------------------------------------------+---
> > xxxxxxx +| 1
> > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +|
> > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
> > (1 row)
> >
> > regression=#
> >
> > The point here is exactly that previous versions didn't show the
> > distinction well.
> >
> >
> >
>
> If we really want to make linefeeds visible, I think we should place the
> indicators immediately after the character preceding the line feed, not
> next to the column separator.

One idea would be to change the column _separator_ for newlines --- that
way, they don't show up for single-column output.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-11 03:02:09
Message-ID: 603c8f070912101902p45a03d97o64ab6da973f63bda@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Dec 10, 2009 at 8:11 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Andrew Dunstan wrote:
>>
>>
>> Tom Lane wrote:
>> > regression=# select E'xxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
>> >     as a, 1 as b;
>> >                           a                           | b
>> > ------------------------------------------------------+---
>> >  xxxxxxx                                             +| 1
>> >  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx                  +|
>> >  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
>> > (1 row)
>> >
>> > regression=#
>> >
>> > The point here is exactly that previous versions didn't show the
>> > distinction well.
>> >
>> >
>> >
>>
>> If we really want to make linefeeds visible, I think we should place the
>> indicators immediately after the character preceding the line feed, not
>> next to the column separator.
>
> One idea would be to change the column _separator_ for newlines --- that
> way, they don't show up for single-column output.

Hilariously enough, that's exactly what we used to do. I am leaning
toward the view that we should revert all the ASCII output format
changes vs. 8.4 and let people use the new unicode mode if they want
all the spiffy bells and whistles.

...Robert


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-11 03:25:44
Message-ID: 8564.1260501944@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> Hilariously enough, that's exactly what we used to do. I am leaning
> toward the view that we should revert all the ASCII output format
> changes vs. 8.4 and let people use the new unicode mode if they want
> all the spiffy bells and whistles.

There are clearly use-cases for this feature; I think arguing to revert
it is an extreme overreaction. We could reconsider which behavior ought
to be default, perhaps.

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: explain output infelicity in psql
Date: 2009-12-12 09:17:58
Message-ID: 1260609478.26418.3.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On tor, 2009-12-10 at 22:02 -0500, Robert Haas wrote:
> On Thu, Dec 10, 2009 at 8:11 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > One idea would be to change the column _separator_ for newlines --- that
> > way, they don't show up for single-column output.
>
> Hilariously enough, that's exactly what we used to do.

Well, the only reason why that "worked" for this case is that it didn't
work at all when the column in question was the first one.