Re: reparsing query

From: Lukas Fittl <lukas(at)fittl(dot)com>
To: Qingqing Zhou <zhouqq(dot)postgres(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andrzej Barszcz <abusinf(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: reparsing query
Date: 2015-04-16 00:19:11
Message-ID: CAP53PkwXmiD36d9n8Mf=af5-=xfRmY0m6v5RjiTMjg97DPqAXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 15, 2015 at 2:43 PM, Qingqing Zhou <zhouqq(dot)postgres(at)gmail(dot)com>
wrote:
>
> Is this a proposal to have a better formatted (JSON etc)
> debug_print_parse results?

I've run into the need for this as well for monitoring purposes, my
solution was to compile the needed object files into a library (see [0]).

It'd be interesting to explore if there is some way to make this less
hack-ish, and enable tools to parse queries in a better way. Essentially
what is needed is some way to reliably translate SQL into an AST-like
output, from an outside tool, whilst reusing the current PostgreSQL parser.

I believe the recent work on deparsing DDL statements relates to some of
that (i.e. might be re-usable for this purpose, through an extension), if
I'm understanding correctly.

[0]: https://github.com/pganalyze/pg_query

Best,
Lukas

--
Lukas Fittl

Skype: lfittl
Phone: +1 415 321 0630

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-04-16 01:15:31 Re: Turning off HOT/Cleanup sometimes
Previous Message Tom Lane 2015-04-15 23:12:11 Re: PATCH: default_index_tablespace