ts-postgres
ts-postgres copied to clipboard
[Feature Req] Supporting or splitting multiple queries
Hi & thanks for a nice library!
I understood from the README that:
The query command accepts a single query only. If you need to send multiple queries, just call the method multiple times.
...However, I'm currently working on a use-case where the query source is coming from a previously authored .sql
script file and splitting the statements is not a trivial task!
Consider for example the pagila sample schema upload SQL: Identifying statements is much more complex than simply splitting on ;
, because of factors like commented-out semicolons and user-defined functions which include semicolons in their bodies.
It would be great if, even if this project doesn't want to take on multi-statement query support, we were able to provide guidance on how to tackle the splitting in the README. For now I've not yet found a reliable way to do it.
I think it's doable, but I wonder to what extent it has to be tailored to each dialect of SQL. To constructs have multiple statements appearing inside of a BEGIN/END block for example.