I need to parse SQL query and form the relational algebra tree. Currently I used the postgres internal parser to parse the query. (More specificly I've the result of step 1 in the link bellow).
http://www.postgresql.org/docs/current/static/parser-stage.html
What I'm looking for is the source code or an implementation of the second part, Transformation Process. I searched a little but could not find it.
Also any other recommendations to form the relational algebra tree from the sql query?
Thanks
I used the debug_print_plan (boolean) in logging options to print the execution plan.
http://www.postgresql.org/docs/9.1/static/runtime-config-logging.html