User grants: Privileges granted to a user apply regardless of secondary roles (Disabled by default)¶
Attention
This behavior change is in the 2026_08 bundle.
For the current status of the bundle, refer to Bundle history.
When the 2026_08 bundle is enabled, privileges granted directly to a user with GRANT <privileges> … TO USER apply in that user’s sessions regardless of the secondary roles setting, and regardless of a session policy that disallows all secondary roles. The grants are activated in every session for that user.
- Before the change:
Privileges granted directly to a user were effective only when the session had all secondary roles activated. A user with
DEFAULT_SECONDARY_ROLES = ()starts each session with no secondary roles. A session that ranUSE SECONDARY ROLES NONE, or that activated a specific list of secondary roles, authorized SQL with the primary role and those secondary roles only. Privileges granted to the user didn’t apply.A session policy that disallowed all secondary roles had the same effect, with
ALLOWED_SECONDARY_ROLES = ()orBLOCKED_SECONDARY_ROLES = ('ALL'). The policy kept those privileges from applying even when the session requested all secondary roles.For example, user
analysthas the primary roleanalyst_role. That role has no privilege onmydb.myschema.orders, andSELECTon that table is granted toanalyst:In a session for
analystwith secondary roles disabled, the query failed:- After the change:
Those privileges are activated in every session for that user.
DEFAULT_SECONDARY_ROLES = (),USE SECONDARY ROLES NONE, a specific secondary role list, and a session policy that disallows all secondary roles don’t apply to them. The same statements succeed:Sessions that already activated all secondary roles are unchanged, because those sessions already used privileges granted to the user.
This behavior change is most likely to affect accounts that grant privileges directly to users and that also restrict secondary roles. A session that relied on that restriction to keep user grants out of a workload now authorizes those grants.
How to update your code¶
Review users who have privileges granted with GRANT ... TO USER, including users with
DEFAULT_SECONDARY_ROLES = (), and the sessions, tasks, and client connections that set
secondary roles to NONE or to a specific list so that only the primary role and those listed
roles authorize SQL. Also review session policies that disallow all secondary roles, with
ALLOWED_SECONDARY_ROLES = () or BLOCKED_SECONDARY_ROLES = ('ALL'). That restriction doesn’t
apply to privileges granted directly to the user.
To keep the previous behavior while the 2026_08 bundle is available for testing, disable the bundle. See Managing behavior change releases. For example:
Disabling the bundle only defers this change. After the bundle is generally enabled, turning secondary roles off doesn’t exclude privileges granted to the user. A session policy that disallows all secondary roles doesn’t exclude them either. To keep the privilege when secondary roles are disabled, revoke it from the user and grant it to an account role, then grant that role to the user. Activate that role as the primary role. The primary role authorizes the privilege:
Ref: 2438