Re: WIP: pg_pretty_query

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: WIP: pg_pretty_query
Дата
Msg-id 502142B2.6090503@dunslane.net
обсуждение исходный текст
Ответ на WIP: pg_pretty_query  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
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
>
>
> postgres=# select pg_pretty_query('select x.*, z.* from foo, foo x, x
> z  where x.a = 10 and x.a = 30 and EXISTS(SELECT * FROM foo WHERE a =
> z.a)', true, false);
>                       pg_pretty_query
> ----------------------------------------------------------
>    SELECT x.a, z.a                                        +
>      FROM foo, foo x, x z                                 +
>     WHERE x.a = 10 AND x.a = 30 AND (EXISTS ( SELECT foo.a+
>              FROM foo                                     +
>             WHERE foo.a = z.a))
> (1 row)

Good stuff. That's one less item on my TODO list :-)

I think we should have a version that lets you specify the wrap column, 
like pg_get_viewdef does. Possibly for this case we should even default 
it to 0 (wrap after each item) instead of 79 which it is for views.


cheers

andrew



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: WIP: pg_pretty_query
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Beta 3