List unique keys and their columns in Vertica database

The query below returns all unique key constraints columns in a Vertica database.

Query

select table_schema,
       table_name,
       constraint_name,
       column_name,
       is_enabled
from v_catalog.constraint_columns cc
where constraint_type = 'u'
order by table_schema,
         table_name;

Columns

  • table_schema - schema name
  • table_name - table name
  • constraint_name - constraint name of unique constraint
  • columns - column name
  • is_enabled - indicate if constraint is enabled od not

Rows

  • One row: represents one key column in the database
  • Scope of rows: all unique constraints
  • Ordered by schema and table name

Sample results