Place Supabase pg_stat_statements in extensions schema#747
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2432fc372
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - { name: intagg ,schema: extensions } | ||
| - { name: intarray ,schema: extensions } | ||
| - { name: pg_repack ,schema: extensions } | ||
| - { name: pg_stat_statements ,schema: extensions } |
There was a problem hiding this comment.
Keep pg_stat_statements reachable for pg_exporter
When Supabase uses the bundled PostgreSQL monitoring, this creates pg_stat_statements only in extensions, but the generated init SQL still sets the monitor user search path to monitor,public (roles/pgsql/templates/pg-init-template.sql:111) and pg_exporter connects as that user (roles/pg_monitor/templates/pg_exporter.env:7) while running unqualified FROM pg_stat_statements(false) queries (roles/pg_monitor/templates/pg_exporter.yml:1331). Those collector queries will fail with “function does not exist” for Supabase deployments unless the monitor search path is also updated or the exporter queries are schema-qualified, so query-performance metrics are lost.
Useful? React with 👍 / 👎.
Summary
Reason
Supabase Studio's Query Performance page expects pg_stat_statements to be available from the extensions schema. The previous template created pg_stat_statements in the monitor schema, which can prevent that Supabase feature from locating the extension as expected.
Tests