tursodatabase/libsql

DB creation from dump with triggers is failing

Closed this issue · 0 comments

Given dump.sql:

BEGIN TRANSACTION;
CREATE TABLE test (x);
CREATE TRIGGER simple_trigger 
AFTER INSERT ON test 
BEGIN
    INSERT INTO test VALUES (999);
END;
INSERT INTO test VALUES (1);
COMMIT;

I need create a new db from this dump:

curl -s -X POST "0.0.0.0:9090/v1/namespaces/default/create" \
  -H "Content-Type: application/json" \
  -d "{ \"dump_url\": \"file:/dump.sql" }"

This will fail with:

ERROR create: libsql_server::namespace::configurator::primary: an error occured while deleting creating namespace, cleaning...
ERROR libsql_server::error: HTTP API: 500 Internal Server Error, Internal("line: 6, error: incomplete input")
ERROR tower_http::trace::on_failure: response failed classification=Status code: 500 Internal Server Error latency=15 ms
{"error":"Internal error: line: 6, error: incomplete input"}