Skip to content

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

fix: npe (#11551)

h3n4ld44f75d85dd0
diff --git a/backend/plugin/parser/pg/query.go b/backend/plugin/parser/pg/query.go
index e279139b8f..219d990a3d 100644
--- a/backend/plugin/parser/pg/query.go
+++ b/backend/plugin/parser/pg/query.go
@@ -208,8 +208,9 @@ func convertToSyntaxError(statement string, err error) *base.SyntaxError {
func getLineAndColumn(statement string, pos int) (int, int) {
var line, column int
- for i := 0; i < pos; i++ {
- if statement[i] == '\n' {
+ runes := []rune(statement)
+ for i := 0; i < pos && i < len(runes); i++ {
+ if runes[i] == '\n' {
line++
column = 0
} else {