Categories:

Information Schema , Table Functions

POLICY_REFERENCES

Returns a list of all objects (i.e. tables, views) that have the specified Column-level Security masking policy set on a column.

Syntax

POLICY_REFERENCES(
      POLICY_NAME => '<string>' )

Arguments

POLICY_NAME => 'string'

Specifies the column-level security masking policy name.

  • If the fully-qualified masking policy name (e.g. <database_name>.<schema_name>.<policy_name>) is not used, Snowflake uses the session database and schema of the masking policy. For more information, see Object Name Resolution.

  • The entire policy name must be enclosed in single quotes.

  • If the policy name is case-sensitive or includes any special characters or spaces, double quotes are required to process the case/characters. The double quotes must be enclosed within the single quotes (i.e. '"<policy_name>"').

Usage Notes

  • When calling an Information Schema table function, the session must have an INFORMATION_SCHEMA schema in use or the function name must be fully-qualified. For more details, see Information Schema.

Output

The function returns the following columns:

Column

Data Type

Description

CREATED_ON

TIMESTAMP_LTZ

The date and time when the masking policy was created.

POLICY_DB

TEXT

The database in which the masking policy is set.

POLICY_SCHEMA

TEXT

The schema in which the masking policy is set.

POLICY_NAME

TEXT

The name of the masking policy.

POLICY_KIND

TEXT

The type of policy in Snowflake.

REF_DATABASE_NAME

TEXT

The name of the database containing an object that the queried object references.

REF_SCHEMA_NAME

TEXT

The name of the database containing an object that the queried object references.

REF_ENTITY_NAME

TEXT

The name of the object (i.e. table_name, view_name) on which the masking policy is set.

REF_ENTITY_DOMAIN

TEXT

The object type (i.e. table, view) on which the masking policy is set.

REF_COLUMN_NAME

TEXT

The column name on which the masking policy is set.

Examples

Retrieve the list of objects that has the masking policy ssn_mask set on a column:

use database my_db;
use schema information_schema;
select *
  from table(information_schema.policy_references(policy_name => 'ssn_mask'));