🛡️Column-Level Security
Also known as Column-Level Access Control, Column Permissions, Column Privileges
People may read a table but not all its columns. The private columns stay closed.
Think of it like
It is like a letter with some lines covered by tape. You can read the rest, but not those lines.
Example
A shop lets its support role read the name and total columns, but not email. A query that asks for email fails with an error.
Why it matters
Most tables mix plain fields and private ones. This shares the plain fields without making a cut-down copy.
Definition
Example code
sql
GRANT SELECT (name, total) ON customers TO support;Common mistake
Key takeaways
- 1Per column. Rights are set field by field.
- 2Set by role. Roles decide which fields show.
- 3Refused, not blank. A closed column gives an error.