supabase / postgres

Unmodified Postgres with some useful plugins

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install `pgstattuple` extension from SQL console.

alexgshaw opened this issue · comments

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When I try to install the pgstattuple extension from the SQL console, I get the following error:

ERROR:  42501: permission denied to create extension "pgstattuple"
HINT:  Must be superuser to create this extension.

To Reproduce

To enable the extension from the Supabase SQL console, I run the following command, as recommended in the docs.

create extension
  pgstattuple
with
  schema extensions;

This extension is listed in the docs, but is not available to add through the UI.

Expected behavior

I expect this extension to be added to my database when I run the command.

System information

I tried upgrading my project to the latest version of Postgresql: 15.1.1.18.

It did not change anything.

Additional context

I originally asked this question in the Supabase Discord. Steve from the team asked me to open an issue here. Could pgstattuple be enabled from the UI? It would solve this issue for me.

The solution should be to add pgstattuple to supautils.privileged_extensions.

How do I do that?

When I posted this issue my database was running postgres version 15.1.1.19.

I've upgraded the past 6 iterations and am now at 15.1.1.25 and I still do not see the pgstattuple and cannot enable it from the sql editor.

@alexgshaw Just checked and pgstattuple is now available:

select * from pg_extension where extname = 'pgstattuple';
oid extname extowner extnamespace extrelocatable extversion extconfig extcondition
29560 pgstattuple 16420 2200 true 1.5

Hmm I just ran that command and it returned nothing. I'm running postgres 15.1.1.25 (latest version). Is there something I need to do to enable the pgstattuple?

Sorry, query should be;

select * from pg_available_extensions where name ilike '%stattuple%';

Just created a new project and:

create extension pgstattuple schema extensions;

Succeeds

Got it, thanks for the quick respond. I'm still running into the same issue though.

How can I add it to an existing project? For reference, this is what I'm seeing:

Running postgres 15.1.1.25 (latest)

When I run

select
  *
from
  pg_available_extensions
where
  name ilike '%stattuple%';

this is my output

name default_version installed_version comment
pgstattuple 1.5 show tuple-level statistics

However, when I run

create extension
  pgstattuple
with
  schema extensions;

I get same error as before:

ERROR:  42501: permission denied to create extension "pgstattuple"
HINT:  Must be superuser to create this extension.

What am I missing?