Bird
0
0

You want to create a group role editors and assign two login roles carol and dave to it. Which sequence is correct?

hard📝 Application Q8 of 15
PostgreSQL - Roles and Security
You want to create a group role editors and assign two login roles carol and dave to it. Which sequence is correct?
ACREATE ROLE editors NOLOGIN; CREATE ROLE carol LOGIN; CREATE ROLE dave LOGIN; GRANT carol, dave TO editors;
BCREATE ROLE editors LOGIN; CREATE ROLE carol NOLOGIN; CREATE ROLE dave NOLOGIN; GRANT editors TO carol, dave;
CCREATE ROLE editors NOLOGIN; CREATE ROLE carol LOGIN; CREATE ROLE dave LOGIN; GRANT editors TO carol, dave;
DCREATE ROLE editors NOLOGIN; CREATE ROLE carol LOGIN; CREATE ROLE dave LOGIN; GRANT carol TO editors; GRANT dave TO editors;
Step-by-Step Solution
Solution:
  1. Step 1: Create group role without LOGIN

    Group roles should have NOLOGIN attribute.
  2. Step 2: Create login roles for users

    Carol and Dave must have LOGIN attribute to connect.
  3. Step 3: Grant group role to users

    Granting editors to carol and dave assigns group privileges to them.
  4. Final Answer:

    CREATE ROLE editors NOLOGIN; CREATE ROLE carol LOGIN; CREATE ROLE dave LOGIN; GRANT editors TO carol, dave; -> Option C
  5. Quick Check:

    Group role NOLOGIN, users LOGIN, grant group to users [OK]
Quick Trick: Grant group role to login roles, not vice versa [OK]
Common Mistakes:
  • Granting users to group role instead of group to users
  • Assigning LOGIN to group roles
  • Creating users without LOGIN

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes