-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exec method doesn't support multiple statements (separated by semi-colon) #22
Comments
For me, multiple statements work for embedded replicas & syncing up to Turso, but do not work for a regular file:.db |
I have the same issue when running migrations through goose with go-libsql as the driver. Only the first statement from each migration file is actually ran, without any errors indicating something went wrong |
I ran into this with Goose. But I fixed it by removing the |
Yea we just ran into this and this is kind of a big deal because there is no batch methods either |
if your statement is simple enough, you can simply do something akin to for _, stmt := range strings.Split(schema, ";") {
db.MustExec(stmt)
} Note that this won't work in some edge cases, like when youre creating tables with a col with default text that contains |
I have also noted that mustexec doesn't actually seem to complain if it finds a ; denoting a new statement (and thus not actually executing the full thing). If this is a real issue, can someone create an issue for it? |
Exec method appears to not support multi line statement queries, it executes up until first
;
then completes.Minimal code required to reproduce.
My expectation would be the same behavior as other sqlite3 drivers mattn sqlite3 and modernc where multi statement queries are executed fully when using
Exec
.My current work around is at the template level to inject a separator symbol that I can split on and run
Exec
in a loop. This however isn't great for larger SQL scripts.The text was updated successfully, but these errors were encountered: