SYSTEM$TAG_VALUE_CONTAINS_ON_CURRENT_TABLE
functionsupportedCore SQL functionsReturns TRUE if the specified tag on the table that a policy protects contains the specified string value. Returns FALSE if that value is not assigned, or if the tag is not assigned. Use this function in data protection policies when a tag might have more than one value. SYSTEM$GET_TAG_ON_CURRENT_TABLE returns an error when multiple values exist. For more information, see Multi-value tags.
Syntax
SYSTEM$TAG_VALUE_CONTAINS_ON_CURRENT_TABLE( '<tag_name>' , '<value>' )
Parameters
| Name | Required | Description |
|---|---|---|
'tag_name' | required | Name of the tag, as a string literal. Snowflake resolves the name when you create or alter the policy, in the schema in use for that statement. Use a fully qualified name for a tag in another schema. |
'value' | required | Tag value to test for, as a string literal. |
Returns
Returns a BOOLEAN: TRUE if the value is assigned to the tag on the current table, including a value inherited from a parent object. FALSE otherwise.
Usage notes
- Call this function from a data protection policy condition. Snowflake returns an error if you call it in a SELECT query, a view, a materialized view, or a user-defined function (UDF).
- Both arguments must be string literals.
- The tag must exist when you create or alter the policy. Otherwise, Snowflake returns the following error message: Tag '<tag_name>' does not exist or not authorized.
- The comparison is case-sensitive. On a multi-value tag, the function returns TRUE when <value> is one of the assigned values. It also returns TRUE when <value> equals the single value of a tag that is not multi-value.
- The function checks the tag on the table, including a tag the table inherits from a parent object.
- This function applies to table-like objects, such as views.