Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Pavel Stehule
2012/8/7 Peter Geoghegan : > On 7 August 2012 20:01, Andrew Dunstan wrote: >> On 08/07/2012 02:14 PM, Tom Lane wrote: >>> * As per some of the complaints already registered in this thread, >>> ruleutils.c is not designed with the goal of being a pretty-printer. >>> Its primary charter is to suppor

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Pavel Stehule
2012/8/7 Tom Lane : > Andrew Dunstan writes: >> On 08/07/2012 02:14 PM, Tom Lane wrote: >>> In short, the only redeeming value of this patch is that it's short. > >> One of the challenges is to have a pretty printer that is kept in sync >> with the dialect that's supported. Anything that doesn't u

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Tom Lane
Peter Geoghegan writes: > On 7 August 2012 20:01, Andrew Dunstan wrote: >> One of the challenges is to have a pretty printer that is kept in sync with >> the dialect that's supported. Anything that doesn't use the backend's parser >> seems to me to be guaranteed to get out of sync very quickly.

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Peter Geoghegan
On 7 August 2012 20:01, Andrew Dunstan wrote: > On 08/07/2012 02:14 PM, Tom Lane wrote: >> * As per some of the complaints already registered in this thread, >> ruleutils.c is not designed with the goal of being a pretty-printer. >> Its primary charter is to support pg_dump by regurgitating rules/

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Tom Lane
Andrew Dunstan writes: > On 08/07/2012 02:14 PM, Tom Lane wrote: >> In short, the only redeeming value of this patch is that it's short. > One of the challenges is to have a pretty printer that is kept in sync > with the dialect that's supported. Anything that doesn't use the > backend's parser

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Andrew Dunstan
On 08/07/2012 02:14 PM, Tom Lane wrote: * As per some of the complaints already registered in this thread, ruleutils.c is not designed with the goal of being a pretty-printer. Its primary charter is to support pg_dump by regurgitating rules/views in an unambiguous form, which does not necessari

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Tom Lane
Bruce Momjian writes: > On Tue, Aug 7, 2012 at 04:14:34PM +0200, Pavel Stehule wrote: >> last year we are spoke about reusing pretty print view code for some queries. >> >> Here is patch: > I can see this as very useful for people reporting badly-formatted > queries to our email lists. Great!

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread David Fetter
On Tue, Aug 07, 2012 at 04:54:12PM +0200, Pavel Stehule wrote: > 2012/8/7 Thom Brown : > > On 7 August 2012 15:14, Pavel Stehule wrote: > >> Hello > >> > >> last year we are spoke about reusing pretty print view code for some > >> queries. > >> > >> Here is patch: > >> > >> this patch is really s

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Andrew Dunstan
On 08/07/2012 10:14 AM, Pavel Stehule wrote: Hello last year we are spoke about reusing pretty print view code for some queries. Here is patch: this patch is really short - it is nice. But - it works only with known database objects (probably we would it) and it doesn't format subqueries well

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Bruce Momjian
On Tue, Aug 7, 2012 at 04:14:34PM +0200, Pavel Stehule wrote: > Hello > > last year we are spoke about reusing pretty print view code for some queries. > > Here is patch: > > this patch is really short - it is nice. But - it works only with > known database objects (probably we would it) and it

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Pavel Stehule
2012/8/7 Thom Brown : > On 7 August 2012 15:14, Pavel Stehule wrote: >> Hello >> >> last year we are spoke about reusing pretty print view code for some queries. >> >> Here is patch: >> >> this patch is really short - it is nice. But - it works only with >> known database objects (probably we woul

Re: [HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Thom Brown
On 7 August 2012 15:14, Pavel Stehule wrote: > Hello > > last year we are spoke about reusing pretty print view code for some queries. > > Here is patch: > > this patch is really short - it is nice. But - it works only with > known database objects (probably we would it) and it doesn't format > su

[HACKERS] WIP: pg_pretty_query

2012-08-07 Thread Pavel Stehule
Hello last year we are spoke about reusing pretty print view code for some queries. Here is patch: this patch is really short - it is nice. But - it works only with known database objects (probably we would it) and it doesn't format subqueries well postgres=# select pg_pretty_query('select x.*