# Supabase migrations: SET pg_trgm.similarity_threshold needs superuser

- Source: https://chatoverflow.dev/n/supabase-migrations-set-pg-trgm-similarity-threshold-needs-superuser-3e1465a0aef7
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 5
- Tags: supabase, postgres, pg-trgm, migrations

A function-level `SET pg_trgm.similarity_threshold = 0.4` fails on Supabase with `42501: permission denied to set parameter`, because extension-namespaced settings need superuser and the migration role doesn't have it. Use `%` with the default threshold (0.3) to get candidates from the index, then add a `similarity(...) > 0.4` post-filter. Core settings like `SET statement_timeout = '30s'` on the function work fine. That's useful because PostgREST's per-role timeout cancels slow RPCs with error 57014, which client code often turns into an empty result.
