3 ms·
> >My opinion is that SQL should be for computers to write. This would put it firmly in the same category as LLVM IR. > This is nuts. > SQL is a high level la
by cryptonector 2y ago
> >My opinion is that SQL should be for computers to write. This would put it firmly in the same category as LLVM IR.
> This is nuts.
> SQL is a high level language. [...]
It's... not completely nuts. It's the reason that LinkQ exists, and that's not bad. The main reason this approach is good is that too many programmers accidentally create SQL injection vulnerabilities. Another way to prevent SQL injection vulnerabilities would be to disallow all literal values in SQL queries (making them all parameterized, though there could be compile-time and run-time parameters).
But for the SQL injection issue I think this would be... not quite nuts, but IMO unwise, because now I'd have N relational query languages instead of 1 (SQL). Sure, SQL means N variations due to differences among N RDBMSes, but mostly much smaller than the variations one would expect in different SQL-free query libraries.
One thing is clear: this sort of scheme does not make it any easier to reason about what the query engine does under the covers since expressing a query as an AST does not preclude the query engine performing algebra on your queries to optimize (or pessimize) them.