Re: [PATCH] Add --syntax to postgres for SQL syntax checking
От | Josef Šimánek |
---|---|
Тема | Re: [PATCH] Add --syntax to postgres for SQL syntax checking |
Дата | |
Msg-id | CAFp7QwrU2Nw98Toi2PYn_77o9c1BMDoQ8zOad9qGXUnTeSMRrA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH] Add --syntax to postgres for SQL syntax checking ("David G. Johnston" <david.g.johnston@gmail.com>) |
Ответы |
Re: [PATCH] Add --syntax to postgres for SQL syntax checking
|
Список | pgsql-hackers |
st 15. 5. 2024 v 21:33 odesílatel David G. Johnston <david.g.johnston@gmail.com> napsal: > > On Wed, May 15, 2024 at 12:18 PM <walther@technowledgy.de> wrote: >> >> Tom Lane: >> >> 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? >> >> Correct, on top of what the syntax tree currently has, one would >> probably need: >> - comments >> - locations (line number / character) for everything, including those of >> comments >> > > I'm with the original patch idea at this point. A utility that simply runs text through the parser, not parse analysis,and answers the question: "Were you able to parse this?" has both value and seems like something that can be patchedinto core in a couple of hundred lines, not thousands, as has already been demonstrated. > > Sure, other questions are valid and other goals exist in the ecosystem, but that doesn't diminish this one which is sufficientlyjustified for my +1 on the idea. > > Now, in my ideal world something like this could be made as an extension so that it can work on older versions and nothave to be maintained by core. And likely grow more features over time. Is there anything fundamental about this thatprevents it being implemented in an extension and, if so, what can we add to core in v18 to alleviate that limitation? Like extension providing additional binary? Or what kind of extension do you mean? One of the original ideas was to be able to do so (parse query) without running postgres itself. Could extension be useful without running postgres backend? > David J. >
В списке pgsql-hackers по дате отправления: