You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sql: add VIEWSCHEDULE system privilege for SHOW SCHEDULES
Previously, `SHOW SCHEDULES` was implicitly gated by `SELECT` on
`system.scheduled_jobs` and `system.jobs`, which only `admin` has by
default. This made it impossible to grant schedule visibility to
non-admin users without granting broad access to system tables.
This change introduces a new `VIEWSCHEDULE` system privilege (following
the pattern of `VIEWJOB`, `VIEWACTIVITY`, etc.) that explicitly gates
`SHOW SCHEDULES`. Admin users satisfy this check implicitly through
`ALL` privileges. The privilege also grants implicit `SELECT` on
`system.scheduled_jobs` and `system.jobs` so the delegated query
executes successfully.
The delegator check is kept (rather than relying solely on the
authorization.go fallback) because without it the user would see a
confusing "does not have SELECT privilege on relation scheduled_jobs"
error instead of a clear message about the VIEWSCHEDULE privilege.
On the DB Console side, the schedules API now checks for SQL execution
errors before accessing results, preventing runtime crashes when the
user lacks the required privilege.
Fixes: #169420
Epic: none
Release note (sql change): Added a new `VIEWSCHEDULE` system privilege
that controls access to `SHOW SCHEDULES`. Non-admin users can be granted
schedule visibility via `GRANT SYSTEM VIEWSCHEDULE TO <user>` without
needing direct `SELECT` on system tables.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments