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 |

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

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 a

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 t...@sss.pgh.pa.us 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

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-04-29 Thread Tom Lane
Greg Stark st...@mit.edu 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

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 t...@sss.pgh.pa.us 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

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-04-29 Thread Tom Lane
Greg Stark st...@mit.edu 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

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 robertmh...@gmail.com writes: On Fri, Jan 24, 2014 at 8:53 PM, Greg Stark st...@mit.edu wrote: Indeed even aside from the performance questions, once you're indented 5-10

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-25 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Fri, Jan 24, 2014 at 8:53 PM, Greg Stark st...@mit.edu 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

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 robertmh...@gmail.com writes: On Fri, Jan 24, 2014 at 8:53 PM, Greg Stark st...@mit.edu 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

[HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Greg Stark
We're finding it more and more common for people to define partitioned table views with hundreds or thousands of union branches. pg_get_viewdefs indents each branch of the union by 8 spaces more than the previous branch. The net effect is that the size of the output is O(n^2) bytes just for the

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Tom Lane
Greg Stark st...@mit.edu 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

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 t...@sss.pgh.pa.us 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

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

Re: [HACKERS] pg_get_viewdefs() indentation considered harmful

2014-01-24 Thread Tom Lane
Greg Stark st...@mit.edu 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

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 t...@sss.pgh.pa.us wrote: Greg Stark st...@mit.edu 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

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 robertmh...@gmail.com wrote: On Fri, Jan 24, 2014 at 6:54 PM, Tom Lane t...@sss.pgh.pa.us wrote: Greg Stark st...@mit.edu writes: We're finding it more and more common for people to define partitioned table views with hundreds or thousands of union

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 st...@mit.edu wrote: On Fri, Jan 24, 2014 at 8:49 PM, Robert Haas robertmh...@gmail.com wrote: On Fri, Jan 24, 2014 at 6:54 PM, Tom Lane t...@sss.pgh.pa.us wrote: Greg Stark st...@mit.edu writes: We're finding it more and more common for people to