Schema:

ACCOUNT_USAGE

REFERENTIAL_CONSTRAINTS view

This Account Usage view displays a row for each FOREIGN KEY constraint that is defined for tables in the account.

FOREIGN KEY constraints are used to enforce referential integrity. For more information, see Constraints and Referential Integrity Constraints.

To return information about other constraint types (as well as FOREIGN KEY constraints), query the TABLE_CONSTRAINTS view.

Columns

Column NameData TypeDescription
CONSTRAINT_CATALOG_IDNUMBERInternal/system-generated identifier for the database of the constraint.
CONSTRAINT_CATALOGVARCHARDatabase that the constraint belongs to
CONSTRAINT_SCHEMA_IDNUMBERInternal/system-generated identifier for the schema of the constraint.
CONSTRAINT_SCHEMAVARCHARSchema that the constraint belongs to
CONSTRAINT_NAMEVARCHARName of the constraint
UNIQUE_CONSTRAINT_CATALOG_IDNUMBERInternal/system-generated identifier for the database of the current constraint.
UNIQUE_CONSTRAINT_CATALOGVARCHARDatabase of the unique constraint referenced by the current constraint.
UNIQUE_CONSTRAINT_SCHEMA_IDNUMBERInternal/system-generated identifier for the schema of the constraint.
UNIQUE_CONSTRAINT_SCHEMAVARCHARSchema of the unique constraint referenced by the current constraint.
UNIQUE_CONSTRAINT_NAMEVARCHARName of the unique constraint referenced by the current constraint.
MATCH_OPTIONVARCHARMatch option for the constraint.
UPDATE_RULEVARCHARUpdate Rule for the current constraint.
DELETE_RULEVARCHARDelete Rule for the current constraint.
COMMENTVARCHARComment for the constraint.
CREATEDTIMESTAMP_LTZDate and time when the constraint was created.
LAST_ALTEREDTIMESTAMP_LTZDate and time the object was last altered by a DML, DDL, or background metadata operation. See Usage Notes.
DELETEDTIMESTAMP_LTZDate and time when the constraint was dropped.

Usage notes

  • Latency for the view may be up to 120 minutes (2 hours).
  • The view only displays objects for which the current role for the session has been granted access privileges.
  • The LAST_ALTERED column is updated when the following operations are performed on an object:

    • DDL operations.
    • DML operations (for tables only). This column is updated even when no rows are affected by the DML statement.
    • Background maintenance operations on metadata performed by Snowflake.