tursodatabase / libsql-shell-go

7 stars 7 forks source link

Block comments with semicolon + NL don't work when pasted into interactive shell #133

Closed CodingDoug closed 11 months ago

CodingDoug commented 1 year ago

Paste the following into the shell, and it works OK:

/*
comment
*/
select 1;

And this works OK:

/* comment; */ select 1;

However, this does not work (note the semicolon and newline within the block comment):

/*
comment;
*/
select 1;

Error:

Error: failed to execute SQL: */
select 1;
near STAR, "None": syntax error at (1, 2)

However, the same SQL above does work if the text is placed in a file and redirected to stdin:

# test.sql contains the same SQL as above
$ turso db shell my-db < test.sql
1
1

The practical use case is using a block comments to remove bits of SQL from a script, then copy/pasting that script into the shell.

See also #135