Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(completion): break for the first statement (#14027)

rebelicef5bf68e3d087
diff --git a/backend/plugin/parser/mysql/completion.go b/backend/plugin/parser/mysql/completion.go
index 1505716e7d..c057e6aa2f 100644
--- a/backend/plugin/parser/mysql/completion.go
+++ b/backend/plugin/parser/mysql/completion.go
@@ -1228,7 +1228,7 @@ func skipHeadingSQLs(statement string, caretLine int, caretOffset int) (string,
start = i
if i == 0 {
// The caret is in the first SQL statement, so we don't need to skip any SQL statements.
- continue
+ break
}
newCaretLine = caretLine - list[i-1].LastLine + 1 // Convert to 1-based.
if caretLine == list[i-1].LastLine {
diff --git a/backend/plugin/parser/partiql/completion.go b/backend/plugin/parser/partiql/completion.go
index 69c0657473..99d2540cf2 100644
--- a/backend/plugin/parser/partiql/completion.go
+++ b/backend/plugin/parser/partiql/completion.go
@@ -543,7 +543,7 @@ func skipHeadingSQLs(statement string, caretLine int, caretOffset int) (string,
start = i
if i == 0 {
// The caret is in the first SQL statement, so we don't need to skip any SQL statements.
- continue
+ break
}
newCaretLine = caretLine - list[i-1].LastLine + 1 // Convert to 1-based.
if caretLine == list[i-1].LastLine {
diff --git a/backend/plugin/parser/pg/completion.go b/backend/plugin/parser/pg/completion.go
index 3b14d16ce8..fe84e803c2 100644
--- a/backend/plugin/parser/pg/completion.go
+++ b/backend/plugin/parser/pg/completion.go
@@ -1154,7 +1154,7 @@ func skipHeadingSQLs(statement string, caretLine int, caretOffset int) (string,
start = i
if i == 0 {
// If the caret is in the first SQL statement, we should not skip any SQL statements.
- continue
+ break
}
newCaretLine = caretLine - list[i-1].LastLine + 1 // Convert to 1-based.
if caretLine == list[i-1].LastLine {
diff --git a/backend/plugin/parser/plsql/completion.go b/backend/plugin/parser/plsql/completion.go
index 49bac64ccf..772ff97f6b 100644
--- a/backend/plugin/parser/plsql/completion.go
+++ b/backend/plugin/parser/plsql/completion.go
@@ -1085,7 +1085,7 @@ func skipHeadingSQLs(statement string, caretLine int, caretOffset int) (string,
start = i
if i == 0 {
// The caret is in the first SQL statement, so we don't need to skip any SQL statement.
- continue
+ break
}
newCaretLine = caretLine - list[i-1].LastLine + 1 // Convert to 1-based.
if caretLine == list[i-1].LastLine {
diff --git a/backend/plugin/parser/tsql/completion.go b/backend/plugin/parser/tsql/completion.go
index b263caa40d..619235b57e 100644
--- a/backend/plugin/parser/tsql/completion.go
+++ b/backend/plugin/parser/tsql/completion.go
@@ -1172,7 +1172,7 @@ func skipHeadingSQLs(statement string, caretLine int, caretOffset int) (string,
start = i
if i == 0 {
// The caret is in the first SQL statement, so we don't need to skip any SQL statements.
- continue
+ break
}
newCaretLine = caretLine - list[i-1].LastLine + 1 // Convert to 1-based.
if caretLine == list[i-1].LastLine {