Azure Postgres - Move extension to another schema - Superuser access required

Ladislav Gallay 156 Reputation points
2022-08-23T07:16:43.837+00:00

For multi-tenant app (via multiple schema) I'd need to create new schema for all extensions and move it into it.

I'm able to create new schema:

CREATE SCHEMA IF NOT EXISTS shared_extensions  

But I need superuser access to move extensions into it, e.g.:

ALTER EXTENSION btree_gin SET SCHEMA shared_extensions  

How can I do that or request the schema move (via ticket?) or get the access to move the extension schemas around.
Currently all extensions are installed only into public schema

Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. Ladislav Gallay 156 Reputation points
    2022-08-24T05:43:42.893+00:00

    I'm using default 'postgres' user on managed Azure PostgreSQL v13 which has admin rights.

    Yesterday it was saying something like "superuser access required to ALTER extension". I was able to DROP+CREATE extension, but not ALTER it. It required only super-user

    DROP EXTENSION btree_gin;  
    CREATE EXTENSION IF NOT EXISTS btree_gin WITH SCHEMA shared_extensions;  
    

    which looked like it works, but I was not able to drop some extensions as they were in use.

    I tried it today and for some reason it looks like it's working:

    public> ALTER EXTENSION btree_gin SET SCHEMA extensions  
    [2022-08-24 07:38:51] completed in 73 ms  
    

    Do you think there could be some change which prevented this change yesterday but now it works?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.