We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6ec3286 + 1d22e81 commit 2b0de9bCopy full SHA for 2b0de9b
1 file changed
pkg/adapter/mssql/mssql.go
@@ -435,7 +435,11 @@ func (m *MSSQLAdapter) adaptQueryForVersion(query string) string {
435
// or is not a SELECT statement (INSERT/UPDATE/DELETE are left as-is).
436
func convertLimitToTop(query string) string {
437
if hasTopRe.MatchString(query) {
438
- return query // already has TOP — leave untouched
+ // already has TOP — strip any spurious LIMIT appended by QueryModifier
439
+ if m := limitClauseRe.FindStringSubmatch(query); m != nil {
440
+ return strings.TrimSpace(m[1])
441
+ }
442
+ return query
443
}
444
m := limitClauseRe.FindStringSubmatch(query)
445
if m == nil {
0 commit comments