The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix: escape single quotes in queries to prevent syntax errors (#27417)
Monica Khoury4c6f0dd8b6ab
diff --git a/apps/studio/data/database/retrieve-index-advisor-result-query.ts b/apps/studio/data/database/retrieve-index-advisor-result-query.tsindex e822cf2a860..5c8292a9bee 100644--- a/apps/studio/data/database/retrieve-index-advisor-result-query.ts+++ b/apps/studio/data/database/retrieve-index-advisor-result-query.ts@@ -26,10 +26,13 @@ export async function getIndexAdvisorResult({}: GetIndexAdvisorResultVariables) {if (!projectRef) throw new Error('Project ref is required')+ // swap single quotes for double to prevent syntax errors+ const escapedQuery = query.replace(/'/g, "''")+const { result } = await executeSql({projectRef,connectionString,- sql: `select * from index_advisor('${query}');`,+ sql: `select * from index_advisor('${escapedQuery}');`,})return result[0] as GetIndexAdvisorResultResponse}