dbcli / mssql-cli

A command-line client for SQL Server with auto-completion and syntax highlighting
BSD 3-Clause "New" or "Revised" License
1.35k stars 192 forks source link

app fails to execute merge statement and reports "A MERGE statement must be terminated by a semi-colon (;)." #422

Closed aberezin-acertus closed 4 years ago

aberezin-acertus commented 4 years ago

Version: 0.18.0 Under bash, using the attached sql file, exec mssql-cli -U $user -d $database -S $host -i test-basic-merge.sql

Get error "A MERGE statement must be terminated by a semi-colon (;)."

This file properly executes using another client, DataGrip.

test-basic-merge.sql.txt

ellbosch commented 4 years ago

Thanks for posting this—looks like a valid bug to me. I tested this query with Azure Data Studio and it seems to work fine there. I'll take a look at this.

aberezin-acertus commented 4 years ago

Thanks. It will be a problem for lots of sql command interpreters. I just logged the same bug with sqlline. Almost every sql command app uses semicolon for its own parser and then strips it :(

ellbosch commented 4 years ago

@aberezin-acertus I've just proposed a PR to fix this bug. This PR also will add the script you shared to our tests, so hopefully we won't hit this again.

Thanks again for posting this bug! We'll keep you posted when the PR is merged so that you may use an insider version of mssql-cli to unblock you. Expect a stable release to come out sometime March.