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 1822301.1715802335@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Add --syntax to postgres for SQL syntax checking  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> Now, in my ideal world something like this could be made as an extension so
> that it can work on older versions and not have to be maintained by core.
> And likely grow more features over time.  Is there anything fundamental
> about this that prevents it being implemented in an extension and, if so,
> what can we add to core in v18 to alleviate that limitation?

It'd be pretty trivial to create a function that takes a string
and runs it through raw_parser --- I've got such things laying
about for microbenchmarking purposes, in fact.  But the API that'd
present for tools such as editors is enormously different from
the proposed patch: there would need to be a running server and
they'd need to be able to log into it, plus there are more minor
concerns like having to wrap the string in valid quoting.

Now on the plus side, once you'd bought into that environment,
it'd be equally trivial to offer alternatives like "run raw
parsing and parse analysis, but don't run the query".  I continue
to maintain that that's the set of checks you'd really want in a
lot of use-cases.

            regards, tom lane



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [PATCH] Add --syntax to postgres for SQL syntax checking
Next
From: Marcos Pegoraro
Date:
Subject: More links on release-17.html