Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Chore/fix limit bug (#27540)

Terry Suttone225efec6643
diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.utils.ts b/apps/studio/components/interfaces/SQLEditor/SQLEditor.utils.ts
index c9c8b4a2a89..cb778fcdb57 100644
--- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.utils.ts
+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.utils.ts
@@ -134,10 +134,10 @@ export const checkIfAppendLimitRequired = (sql: string, limit: number = 0) => {
!hasComments &&
!hasMultipleQueries &&
cleanedSql.toLowerCase().startsWith('select') &&
- !cleanedSql.toLowerCase().match(/fetch\s+first/) &&
- !cleanedSql.endsWith('limit') &&
- !cleanedSql.endsWith('limit;') &&
- !cleanedSql.match('limit [0-9]*[;]?$')
+ !cleanedSql.toLowerCase().match(/fetch\s+first/i) &&
+ !cleanedSql.match(/limit$/i) &&
+ !cleanedSql.match(/limit;$/i) &&
+ !cleanedSql.match(/limit [0-9]*[;]?$/i)
return { cleanedSql, appendAutoLimit }
}