Re: [PATCH] Add --syntax to postgres for SQL syntax checking - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Add --syntax to postgres for SQL syntax checking
Date
Msg-id 1815338.1715799685@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Add --syntax to postgres for SQL syntax checking  (walther@technowledgy.de)
Responses Re: [PATCH] Add --syntax to postgres for SQL syntax checking
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: add function argument names to regex* functions.
Next
From: Robert Haas
Date:
Subject: Re: [PATCH] Add --syntax to postgres for SQL syntax checking