Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-05-03 Thread Andrew Dunstan
On 05/03/2014 09:17 AM, Marko Tiikkaja wrote: Hi all, Now that we're on the topic of view deparsing, what are your thoughts on making this less painful? local:marko=#* create view foov as select exists(select * from foo); CREATE VIEW local:marko=#* \d+ foov View "public.foo

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-05-03 Thread Marko Tiikkaja
Hi all, Now that we're on the topic of view deparsing, what are your thoughts on making this less painful? local:marko=#* create view foov as select exists(select * from foo); CREATE VIEW local:marko=#* \d+ foov View "public.foov" Column | Type | Modifiers | Storage | Des

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-04-30 Thread Greg Stark
On Wed, Apr 30, 2014 at 6:47 PM, Tom Lane wrote: > I pushed a patch that does it that way, and also patches for the other > items discussed in this thread. Great! thanks a lot. This makes a really solid noticeable difference even in relatively simple cases and I know of users for whom this will m

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-04-30 Thread Tom Lane
I wrote: > I'm still dubious about halving the step distance, because there are > assorted places that adjust the indentation of specific keywords by > distances that aren't a multiple of 2 (look for odd last arguments to > appendContextKeyword). I'm not sure how that will look after we make such

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-04-29 Thread Tom Lane
Greg Stark writes: > Actually the only thing that might want to be adjusted is the > indentation in the beginning of the setop (ruleutils.c:4720) which is > what causes that long line of parentheses at the beginning of the > example. I suppose in an ideal world it would start following the > reduc

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-04-29 Thread Greg Stark
On Tue, Apr 29, 2014 at 7:46 PM, Tom Lane wrote: > I doubt you can do that (the half-size-step bit), at least not without > a much larger patch than this: there are assorted places that just > unconditionally append PRETTYINDENT_STD spaces, and would have to be > taught to do something different.

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-04-29 Thread Tom Lane
Greg Stark writes: > I propose the attached patch. It wraps at 40 and also divides the > indent level by half the std indent level. I tried a few different > combinations and this is the one that produced the output I liked > best. I doubt you can do that (the half-size-step bit), at least not wi

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-04-16 Thread Bruce Momjian
On Sat, Jan 25, 2014 at 01:02:36PM -0500, Andrew Dunstan wrote: > > On 01/25/2014 11:06 AM, Tom Lane wrote: > >Robert Haas writes: > >>On Fri, Jan 24, 2014 at 8:53 PM, Greg Stark wrote: > >>>Indeed even aside from the performance questions, once you're indented > >>>5-10 times the indention stop

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-25 Thread Andrew Dunstan
On 01/25/2014 11:06 AM, Tom Lane wrote: Robert Haas writes: On Fri, Jan 24, 2014 at 8:53 PM, Greg Stark wrote: Indeed even aside from the performance questions, once you're indented 5-10 times the indention stops being useful at all. The query would probably be even more readable if we just

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-25 Thread Tom Lane
Robert Haas writes: > On Fri, Jan 24, 2014 at 8:53 PM, Greg Stark wrote: >> Indeed even aside from the performance questions, once you're indented >> 5-10 times the indention stops being useful at all. The query would >> probably be even more readable if we just made indentation modulo 40 >> so o

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Robert Haas
On Fri, Jan 24, 2014 at 8:53 PM, Greg Stark wrote: > On Fri, Jan 24, 2014 at 8:49 PM, Robert Haas wrote: >> On Fri, Jan 24, 2014 at 6:54 PM, Tom Lane wrote: >>> Greg Stark writes: We're finding it more and more common for people to define partitioned table views with hundreds or thous

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Greg Stark
On Fri, Jan 24, 2014 at 8:49 PM, Robert Haas wrote: > On Fri, Jan 24, 2014 at 6:54 PM, Tom Lane wrote: >> Greg Stark writes: >>> We're finding it more and more common for people to define partitioned >>> table views with hundreds or thousands of union branches. >> >> Really? Given how poorly th

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Robert Haas
On Fri, Jan 24, 2014 at 6:54 PM, Tom Lane wrote: > Greg Stark writes: >> We're finding it more and more common for people to define partitioned >> table views with hundreds or thousands of union branches. > > Really? Given how poorly the system performs with that many inheritance > children, I'v

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Tom Lane
Greg Stark writes: > But it strikes me that pg_dump, at least when not doing an SQL dump, > really has no reason to ask for indentation at all. It's already > asking for non-prettyprinted output, why not make non-prettyprinted > also mean non-indented? We do go to some effort to make pg_dump's ou

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Greg Stark
Argh. Attached is a plain text file with that query data. I'll be switching back to Gnus any day now. daeqck898dvduj=> select ev_class::regclass, length(ev_action) rewrite_len,length(pg_get_viewdef(ev_class,true)) prettyprint_len, length(pg_get_viewdef(ev_class,false)) non_prettyprint_len from pg

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Greg Stark
On Fri, Jan 24, 2014 at 6:54 PM, Tom Lane wrote: >> pg_get_viewdefs indents each branch of the union by 8 spaces more than >> the previous branch. > > I think that's because the unions are a nested binary tree so far as the > parsetree representation goes. We could probably teach ruleutils to > f

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Tom Lane
Greg Stark writes: > We're finding it more and more common for people to define partitioned > table views with hundreds or thousands of union branches. Really? Given how poorly the system performs with that many inheritance children, I've got a hard time believing either that this is common or t