> but I worry about the fact that the extension API only has access to the post-analysis parse trees.
I doubt that's a problem. Parse analysis won't remove information from the query - otherwise it'll not be available for the actual planning and execution ;)
> Parse analysis won't remove information from the query
That's right.
PostgreSQL's parse analysis keeps a statement structure with token-by-token in the parse tree, and PostgreSQL's query jumbling calculates a hash value from the parse tree.
So, it's possible to find something strange in the statement(s) if someone attempts to cheat.
I doubt that's a problem. Parse analysis won't remove information from the query - otherwise it'll not be available for the actual planning and execution ;)