3 ms·
It would get complicated in code if you're constructing your statement from bits and pieces, as the preprocessor would have no way of forming a complete syntax
by mhd 7y ago
It would get complicated in code if you're constructing your statement from bits and pieces, as the preprocessor would have no way of forming a complete syntax tree out of it, of course.
I'm picturing something closer to "emmet"[1], where you write some shorthand and this gets expanded to proper SQL in line. So our imaginary sql-script would never see the light of git, most of the time you'd use it through an IDE plugin or vim's "!" filter (although you could have it available as a function at runtime and actually save the simplified code).
Actual database access at this stage would be good, I wouldn't mind e.g. globbing column names or excluding some ("sel *-[{created,updated}_at]")...
But you're right, for something like psql this would make good sense, too. And after you've played arond with it, you can paste the proper SQL wherever you needed it, too.
[1]: https://docs.emmet.io/ https://docs.emmet.io/