tursodatabase / libsql-shell-go

7 stars 7 forks source link

Creating triggers is not possible because a semicolon in SQL block terminates the entire command #131

Closed CodingDoug closed 11 months ago

CodingDoug commented 1 year ago

Consider the command to add a trigger:

create trigger tr
after insert on tbl
for each row
begin
    update some stuff;
end;

The semicolon after "update some stuff" is required by SQLite, but is interpreted by the shell as the end of the entire command, causing an error saying that there was no "end" to the trigger.

The only easy way around this that I can think of is to run the command using one of the client SDKs.

CodingDoug commented 12 months ago

Reopening because the PR only fixes triggers that are defined on a single line, not multiple lines as the example at the top shows.