From: | Jonathan Gardner <jgardner(at)jonathangardner(dot)net> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | PostgreSQL Hackers List <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Viewing Parse Tree of a query from front end |
Date: | 2003-11-27 18:09:41 |
Message-ID: | 200311271009.43600.jgardner@jonathangardner.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 27 November 2003 1:12 am, Peter Eisentraut wrote:
> Jonathan Gardner writes:
> > I know this sounds kind of silly, but I think I would like to be able
> > to send a query to PostgreSQL, and have it parse it into a tree, and
> > then pass the tree back to me somehow. Of course, I don't want the
> > query to actually execute.
>
> There is a configuration parameter that make each statement print out the
> parse tree. I think it's show_parse_tree or something like that.
I found it. Thanks for pointing out where it was.
=> SET client_min_messages=debug1;
=> SET debug_print_parse=on;
=> select * from test;
DEBUG: parse tree:
DETAIL: {QUERY :commandType 1 :querySource 0 :canSetTag true :utilityStmt
<>
:resultRelation 0 :into <> :hasAggs false :hasSubLinks false :rtable ({RTE
:alias <> :eref {ALIAS :aliasname test :colnames ("id" "test")} :rtekind 0
:relid 17145 :inh true :inFromCl true :checkForRead true :checkForWrite
false
:checkAsUser 0}) :jointree {FROMEXPR :fromlist ({RANGETBLREF :rtindex 1})
:quals <>} :rowMarks () :targetList ({TARGETENTRY :resdom {RESDOM :resno 1
:restype 23 :restypmod -1 :resname id :ressortgroupref 0 :resorigtbl 17145
:resorigcol 1 :resjunk false} :expr {VAR :varno 1 :varattno 1 :vartype 23
:vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1}} {TARGETENTRY :resdom
{RESDOM :resno 2 :restype 16 :restypmod -1 :resname test :ressortgroupref 0
:resorigtbl 17145 :resorigcol 2 :resjunk false} :expr {VAR :varno 1
:varattno
2 :vartype 16 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 2}})
:groupClause <> :havingQual <> :distinctClause <> :sortClause <>
:limitOffset
<> :limitCount <> :setOperations <> :resultRelations ()}
(and the results follow)
This is seriously cool.
- --
Jonathan Gardner
jgardner(at)jonathangardner(dot)net
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE/xj3mWgwF3QvpWNwRAlCUAKClIhCEkeZZK7r29RHvEnkB8mIX7gCfeMlq
SeM7RD13b9qfhp8wAckZvXU=
=gKET
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2003-11-27 18:12:15 | Re: 7.5 Plans |
Previous Message | Peter Eisentraut | 2003-11-27 17:30:54 | Re: 7.5 Plans |