backendgym backendgym · reps Sign in with GitHubSign in

01Grant the public view

sql-scaling-and-security / reps/01/README.md

Create a role named app_reader that can't log in. Grant it usage on the public schema and SELECT on ride_public, and nothing on rides. Then SET ROLE app_reader and return the rows it can read. Drop the role at the end so the next attempt starts clean.

Expected: 3 rows with 4 columns: ride ID, origin, destination and fare. No rider name or email anywhere. If DROP ROLE fails with "some objects depend on it", you still have to RESET ROLE and revoke what you granted.

After the rep
  1. 1 Before you revoke anything, try DROP ROLE app_reader. Which objects does its DETAIL list, and what do you undo for each?