Setting up trigger using SUPERUSER on Azure Database for PostgreSQL - Flexible Server

Kia Mack 0 Reputation points
2024-04-25T11:16:56.9333333+00:00

I manage a PostgreSQL database for my organisation which is set up on an Azure Database for PostgreSQL - Flexible Server.

My issue is that other users need to be able to CREATE objects in the database, however when they do that they are automatically made the owner of the object, and I am not able to drop these, and unless I set up default privileges on each schema for my user, I also can't use them.

I have been looking at ways to use a trigger to reassign the object owner when it is created - https://blog.hagander.net/setting-owner-at-create-table-237/ - however I now realise that I need SUPERUSER to reassign object ownership without being the owner.

Is there any way to set up a trigger as SUPERUSER on an Azure Database for PostgreSQL - Flexible Server?

Azure Database for PostgreSQL
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 27,642 Reputation points Microsoft Employee
    2024-04-25T19:06:45.6733333+00:00

    @Kia Mack Welcome to Microsoft Q&A thanks for posting your question.

    On Azure Database for PostgreSQL - Flexible Server, the capability to perform actions as a superuser isn't supported due to security reasons. This limitation poses a challenge when attempting to execute such actions on a managed PostgreSQL instance.

    Please let me know if you need any additional information.

    Regards

    Geetha