Exec method doesn't support multiple statements (separated by semi-colon)
Exec method appears to not support multi line statement queries, it executes up until first ; then completes.
Minimal code required to reproduce.
db, err := sql.Open("libsql", url)
if err != nil {
return nil, err
}
defer db.Close()
db.Exec(`create table foo (id integer primary key);
create table bar (id integer primary key);`)
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.
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 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 -- +goose StatementBegin and -- +goose StatementEnd comments from the migration file. You can find further information at the No transaction section of this page: http://pressly.github.io/goose/documentation/annotations/#example