is there a hook by which we can modify input query before postgresql builds raw parse tree

Started by Rajmohan Cover 11 years ago4 messages
#1Rajmohan C
csrajmohan@gmail.com

Hi,

I want to know is there a way to use a hook to modify the input query
before Postgresql parses and builds the parse tree for the query.

#2Atri Sharma
atri.jiit@gmail.com
In reply to: Rajmohan C (#1)
Re: is there a hook by which we can modify input query before postgresql builds raw parse tree

On Fri, May 2, 2014 at 10:07 AM, Rajmohan C <csrajmohan@gmail.com> wrote:

Hi,

I want to know is there a way to use a hook to modify the input query
before Postgresql parses and builds the parse tree for the query.

Uh...the rewriter?

--
Regards,

Atri
*l'apprenant*

#3Michael Paquier
michael.paquier@gmail.com
In reply to: Rajmohan C (#1)
Re: is there a hook by which we can modify input query before postgresql builds raw parse tree

On Fri, May 2, 2014 at 1:37 PM, Rajmohan C <csrajmohan@gmail.com> wrote:

Hi,

I want to know is there a way to use a hook to modify the input query
before Postgresql parses and builds the parse tree for the query.

Not that I know of. I am not sure that enforcing query rewrite on the
server side is a good idea at this may trap your applications and have
them face unexpected behaviors.

FWIW, a presentation about hooks has been done at PGCon 2012, you can
refer to it as well for your future work:
http://wiki.postgresql.org/images/e/e3/Hooks_in_postgresql.pdf
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Michael Paquier
michael.paquier@gmail.com
In reply to: Michael Paquier (#3)
Re: is there a hook by which we can modify input query before postgresql builds raw parse tree

On Fri, May 2, 2014 at 2:06 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:

Not that I know of. I am not sure that enforcing query rewrite on the
server side is a good idea at this may trap your applications and have
them face unexpected behaviors.

Note as well that there is a hook *before* the rewriter and *after*
parse/analyze of query called post_parse_analyze_hook in
parser/analyze.h.
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers