Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1

    Question Unanswered: Creating a DBA Superuser Group Role

    I created a role called 'dba':

    Code:
    CREATE ROLE dba NOLOGIN SUPERUSER CREATEDB CREATEROLE REPLICATION;
    Then I add my role 'carlos' to the 'dba' role:

    Code:
    GRANT dba TO carlos;
    So doesn't that mean that 'carlos' is now a superuser? When I logged in as carlos and tried to do something in pgAdmin, I got an error saying I wasn't a superuser. Am I missing something? Not sure if my user role 'carlos' or group role 'dba' is missing some kind of INHERIT which would make all roles granted to 'dba' a superuser.

  2. #2
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1
    Can someone please help me understand what I'm missing?

    Code:
    postgres=> SELECT current_user;
     current_user
    --------------
     carlos
    (1 row)
    
    postgres=> CREATE DATABASE carlosdb;
    ERROR:  permission denied to create database
    postgres=> \du
                                        List of roles
     Role name |                          Attributes                          | Member of
    -----------+--------------------------------------------------------------+-----------
     carlos    |                                                              | {dba}
     chris     |                                                              | {web}
     dba       | Superuser, Create role, Create DB, Cannot login, Replication | {}
     postgres  | Superuser, Create role, Create DB, Replication               | {}
     web       | Cannot login                                                 | {}

  3. #3
    Join Date
    Oct 2010
    Location
    Orlando, FL
    Posts
    311
    Provided Answers: 1
    OK I didn't understand there was a SET ROLE option I was missing:

    Code:
    SET ROLE dba;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •