Given the following permissions:
GRANT SELECT (date, amount) ON sales TO report_viewer;
Which columns will be visible to report_viewer when running SELECT * FROM sales;?
SELECT * FROM sales;
Think about how PostgreSQL enforces column-level SELECT permissions.
PostgreSQL restricts SELECT to only the columns granted. The user sees only those columns; other columns show NULL values when using SELECT *.
If a user has SELECT permission on a table but is denied SELECT on one column, what happens when they query that column?
Consider how PostgreSQL enforces column-level security strictly.
If a user tries to select a column without permission, PostgreSQL raises a permission denied error.
Choose the correct SQL statement to grant SELECT permission on columns 'name' and 'email' of table 'customers' to user 'client_user'.
Remember the syntax order for column-level grants in PostgreSQL.
The correct syntax is GRANT SELECT (columns) ON table TO user; Option B matches this.
You have a table with many columns but users have SELECT permission on only a few columns. What is the best way to optimize query performance for these users?
Think about how views can simplify permissions and improve query speed.
Creating a view with only allowed columns reduces data scanned and simplifies permission management, improving performance.
User 'analyst' has been granted SELECT on columns 'id' and 'score' of table 'results'. The following query fails with permission denied error:
SELECT id, score, comments FROM results;
Why does this happen?
Check which columns the user is allowed to select and which are requested.
If a query requests a column without permission, PostgreSQL denies the entire query, even if other columns are allowed.