walther@technowledgy.de writes:
> Tom Lane:
>> BTW, if you do feel that a pure grammar check is worthwhile, you
>> should look at the ecpg preprocessor, which does more or less that
>> with the SQL portions of its input.
> Would working with ecpg allow to get back a parse tree of the query to
> do stuff with that?
No, ecpg isn't interested in building a syntax tree.
> This is really what is missing for the ecosystem. A libpqparser for
> tools to use: Formatters, linters, query rewriters, simple syntax
> checkers... they are all missing access to postgres' own parser.
To get to that, you'd need some kind of agreement on what the syntax
tree is. I doubt our existing implementation would be directly useful
to very many tools, and even if it is, do they want to track constant
version-to-version changes?
regards, tom lane