Home / Function/ filterProtectedSchemaIndexStatements() — supabase Function Reference

filterProtectedSchemaIndexStatements() — supabase Function Reference

Architecture documentation for the filterProtectedSchemaIndexStatements() function in index-advisor.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  26d133e8_5892_d626_a283_0d6f736754c8["filterProtectedSchemaIndexStatements()"]
  9643ffdc_72a7_4e8b_0cb9_9dd31e6c10ed["filterProtectedSchemaIndexAdvisorResult()"]
  9643ffdc_72a7_4e8b_0cb9_9dd31e6c10ed -->|calls| 26d133e8_5892_d626_a283_0d6f736754c8
  style 26d133e8_5892_d626_a283_0d6f736754c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/QueryPerformance/IndexAdvisor/index-advisor.utils.ts lines 114–139

export function filterProtectedSchemaIndexStatements(indexStatements: string[]): string[] {
  if (!indexStatements || indexStatements.length === 0) {
    return []
  }

  return indexStatements.filter((statement) => {
    // Match patterns like "CREATE INDEX ON schema.table" or "CREATE INDEX ON "schema"."table""
    // Handle both quoted and unquoted schema names
    const schemaMatch = statement.match(/ON\s+(?:"?(\w+)"?\.|(\w+)\.)/i)

    if (!schemaMatch) {
      // If we can't parse the schema, keep it (safer to show than hide)
      return true
    }

    // Extract schema name (handle both quoted and unquoted)
    const schemaName = schemaMatch[1] || schemaMatch[2]

    if (!schemaName) {
      return true
    }

    // Check if schema is in the protected schemas list
    return !INTERNAL_SCHEMAS.includes(schemaName.toLowerCase())
  })
}

Subdomains

Frequently Asked Questions

What does filterProtectedSchemaIndexStatements() do?
filterProtectedSchemaIndexStatements() is a function in the supabase codebase.
What calls filterProtectedSchemaIndexStatements()?
filterProtectedSchemaIndexStatements() is called by 1 function(s): filterProtectedSchemaIndexAdvisorResult.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free