Bird
0
0

You want to allow user carol to create tables in schema inventory, but she gets an error: permission denied for schema inventory. Which command fixes this?

medium📝 Debug Q14 of 15
PostgreSQL - Roles and Security
You want to allow user carol to create tables in schema inventory, but she gets an error: permission denied for schema inventory. Which command fixes this?
AGRANT CREATE ON SCHEMA inventory TO carol;
BGRANT USAGE ON SCHEMA inventory TO carol;
CGRANT ALL PRIVILEGES ON SCHEMA inventory TO carol;
DREVOKE USAGE ON SCHEMA inventory FROM carol;
Step-by-Step Solution
Solution:
  1. Step 1: Understand error cause

    To create tables, user needs both USAGE and CREATE privileges on the schema. Without USAGE, permission denied error occurs.
  2. Step 2: Grant missing privilege

    Granting USAGE on schema inventory to carol allows her to access the schema and create tables if CREATE is already granted.
  3. Final Answer:

    GRANT USAGE ON SCHEMA inventory TO carol; -> Option B
  4. Quick Check:

    USAGE needed before CREATE works [OK]
Quick Trick: Grant USAGE before CREATE to avoid permission errors [OK]
Common Mistakes:
  • Granting CREATE without USAGE privilege
  • Revoking instead of granting privileges
  • Assuming ALL PRIVILEGES always needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes