Bird
0
0

You want to allow user dave to update only the phone column in the contacts table but not others. Which sequence of commands correctly achieves this?

hard📝 Application Q15 of 15
PostgreSQL - Roles and Security
You want to allow user dave to update only the phone column in the contacts table but not others. Which sequence of commands correctly achieves this?
AGRANT UPDATE(phone) ON contacts TO dave; REVOKE UPDATE ON contacts FROM dave;
BREVOKE UPDATE ON contacts FROM dave; GRANT UPDATE(phone) ON contacts TO dave;
CGRANT UPDATE ON contacts TO dave; REVOKE UPDATE(phone) ON contacts FROM dave;
DGRANT UPDATE(phone) ON contacts TO dave;
Step-by-Step Solution
Solution:
  1. Step 1: Remove any existing full UPDATE permission

    First revoke any broad UPDATE permission to avoid conflicts.
  2. Step 2: Grant UPDATE permission only on the phone column

    Then grant UPDATE on the specific column to limit access.
  3. Final Answer:

    REVOKE UPDATE ON contacts FROM dave; GRANT UPDATE(phone) ON contacts TO dave; -> Option B
  4. Quick Check:

    Revoke broad then grant column-level UPDATE [OK]
Quick Trick: Revoke broad permission before granting column-level update [OK]
Common Mistakes:
  • Granting column-level without revoking broad permission
  • Revoking column-level instead of broad permission
  • Assuming single GRANT is enough if broad permission exists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes