Re: WIP: pg_pretty_query

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: pg_pretty_query
Date: 2012-08-08 03:06:25
Message-ID: CAFj8pRBE59sSywhN+dUWVy6YOMP4jgMz5267nV2Yxtn9ohvzJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/8/7 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Andrew Dunstan <andrew(at)dunslane(dot)net> 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 seems to me to be guaranteed to get out of sync very
>> quickly.
>
> Sure. I think if we wanted an actually engineered solution, rather than
> a half-baked one, ecpg provides a good source of inspiration. One could
> imagine a standalone program that reads a query on stdin and emits a
> pretty-printed version to stdout, using a parser that is automatically
> generated from the backend's grammar with much the same technology used
> in recent ecpg releases. I think that would address most of the
> complaints I raised: it would be relatively painless to make use of from
> contexts that don't have a live database connection, it wouldn't impose
> any constraints related to having suitable database content available,
> it wouldn't apply any of the multitude of implementation-dependent
> transformations that the backend's parser does, and it could be built
> (I think) to do something more with comments than just throw them away.

+1

it is better, and it is allow more space for possible styling

Pavel

>
> regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2012-08-08 03:09:54 Re: WIP: pg_pretty_query
Previous Message Jeff Janes 2012-08-08 02:44:47 Re: Inserting heap tuples in bulk in COPY