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_CONTEXT always returned VARCHAR. Boolean-valued properties and functions returned the strings TRUE or FALSE, and numeric properties returned their value as a string.

After the change:

SYS_CONTEXT returns a value typed to match the property or function that you access. For example, SYS_CONTEXT('SNOWFLAKE$SESSION', 'ID') returns NUMBER, and SYS_CONTEXT('SNOWFLAKE$SESSION', 'IS_ROLE_ACTIVATED', 'my_role') returns BOOLEAN.

Properties and functions that don’t have a typed return continue to return VARCHAR. Existing casts, such as ::BOOLEAN or ::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