SQL: SYS_ CONTEXT returns typed values (Pending)¶
Attention
This behavior change is in the 2026_06 bundle.
For the current status of the bundle, refer to Bundle history.
When this behavior change bundle is enabled, SYS_CONTEXT
returns a value whose data type matches the property or function that you access, instead of
always returning VARCHAR.
- Before the change:
SYS_CONTEXTalways returnedVARCHAR. Boolean-valued properties and functions returned the stringsTRUEorFALSE, and numeric properties returned their value as a string.- After the change:
SYS_CONTEXTreturns a value typed to match the property or function that you access. For example,SYS_CONTEXT('SNOWFLAKE$SESSION', 'ID')returnsNUMBER, andSYS_CONTEXT('SNOWFLAKE$SESSION', 'IS_ROLE_ACTIVATED', 'my_role')returnsBOOLEAN.Properties and functions that don’t have a typed return continue to return
VARCHAR. Existing casts, such as::BOOLEANor::NUMBER, continue to work unchanged.For the return type of every property and function by namespace, see SYS_CONTEXT return types.
This change makes the result type of SYS_CONTEXT consistent with the property or function that
you access, so that typed values no longer require an explicit cast.
Ref: 2368