Does anyone know how what user is used to enable e...
# sql
c
Does anyone know how what user is used to enable extensions from the dashboard?
I would like to automate the enabling of the extensions (instead of having to always click in the dashboard), however, I am hitting 2 issues:
- If I try to enable most extensions (e.g. dblink, http) etc with teh postgres user, I get permission denied (Query 1: ERROR: permission denied to create extension "plpgsql_check" HINT: Must be superuser to create this extension. )
- If I enable them via the dashboard (which runs with super user), the objects from the extensions are then NOT available to the postgres user (so, effectively, I cannot use the extensions)
l
You can enable them by executing SQL query 🙂
c
I did
but this leads to permission issues
also, the example on this page does NOT seem correct, because it will install the extension in the public schema
whereas enabling the extensions from the dashboard puts them in the extensions schema (as should be)
so the statement should be
Copy code
CREATE EXTENSION dblink WITH SCHEMA extensions;
even so, I still get permissions issues (either unable to create the extension if running the script with postgres user, OR unable to use the extension with postgres user if extenion was created via Dashboard query editor)
l
that weird I didn't have this problem before 🤔
c
what was the last time you tried?
btw - the example talks about pgtap, which CAN be enabled by postgres user. The issue is with other extensions - for example, dblink, http
so if you only tried pgtap, that would explain why it worked (because it still works 🙂
l
yeah, I was enabling extension only for the public with postgres user which was no problem, because all of my code lives there. But I agree that the postgres user should be able to interact with extensions schema
For migration use case (I'm using Prisma migrations)
c
it can - I can enable pg_tap in the extensions schema. my guess is that the problem is that postgres cannot install extensions which have C code (e.g. pgtap is the only extenions from the ones I tried that has only SQL code and it is the only one which succeeds, even when I add it to the extensions schema)
l
hmm, that sounds like a bug 🤔 I would suggest to open discussion on github
c
yep, opening one now