FOREIGN_KEYS

Provides foreign key information.

Provides foreign key information.

Column Name Data Type Description
CONSTRAINT_ID INTEGER A unique numeric ID assigned by the Vertica catalog, which identifies the constraint.
CONSTRAINT_NAME VARCHAR The constraint name for which information is listed.
COLUMN_NAME VARCHAR The name of the column that is constrained.
ORDINAL_POSITION VARCHAR The position of the column within the key. The numbering of columns starts at 1.
TABLE_NAME VARCHAR The table name for which information is listed.
REFERENCE_TABLE_NAME VARCHAR References the TABLE_NAME column in the PRIMARY_KEYS table.
CONSTRAINT_TYPE VARCHAR The constraint type, f, for foreign key.
REFERENCE_COLUMN_NAME VARCHAR References the COLUMN_NAME column in the PRIMARY_KEY table.
TABLE_NAMESPACE_ID VARCHAR Unique numeric identifier for the table namespace.
TABLE_NAMESPACE VARCHAR For Eon Mode databases, namespace that contains the table for which information is listed.
TABLE_SCHEMA VARCHAR

The schema name for which information is listed.

If the schema belongs to a non-default namespace in an Eon Mode database, the schema name is front-qualified with the name of the schema's namespace. For example, n1.s refers to schema s in namespace n1.

REFERENCE_TABLE_NAMESPACE_ID VARCHAR For Eon Mode databases, references the TABLE_NAMESPACE_ID column in the PRIMARY_KEYS table.
REFERENCE_TABLE_NAMESPACE VARCHAR For Eon Mode databases, references the TABLE_NAMESPACE column in the PRIMARY_KEYS table.
REFERENCE_TABLE_SCHEMA VARCHAR

References the TABLE_SCHEMA column in the PRIMARY_KEYS table.

If the schema belongs to a non-default namespace in an Eon Mode database, the schema name is front-qualified with the name of the schema's namespace. For example, n1.s refers to schema s in namespace n1.

Examples

mydb=> SELECT
          constraint_name,
          table_name,
          ordinal_position,
          reference_table_name
       FROM foreign_keys ORDER BY 3;
      constraint_name      |    table_name     | ordinal_position | reference_table_name
---------------------------+-------------------+------------------+-----------------------
 fk_store_sales_date       | store_sales_fact  |                1 | date_dimension
 fk_online_sales_saledate  | online_sales_fact |                1 | date_dimension
 fk_store_orders_product   | store_orders_fact |                1 | product_dimension
 fk_inventory_date         | inventory_fact    |                1 | date_dimension
 fk_inventory_product      | inventory_fact    |                2 | product_dimension
 fk_store_sales_product    | store_sales_fact  |                2 | product_dimension
 fk_online_sales_shipdate  | online_sales_fact |                2 | date_dimension
 fk_store_orders_product   | store_orders_fact |                2 | product_dimension
 fk_inventory_product      | inventory_fact    |                3 | product_dimension
 fk_store_sales_product    | store_sales_fact  |                3 | product_dimension
 fk_online_sales_product   | online_sales_fact |                3 | product_dimension
 fk_store_orders_store     | store_orders_fact |                3 | store_dimension
 fk_online_sales_product   | online_sales_fact |                4 | product_dimension
 fk_inventory_warehouse    | inventory_fact    |                4 | warehouse_dimension
 fk_store_orders_vendor    | store_orders_fact |                4 | vendor_dimension
 fk_store_sales_store      | store_sales_fact  |                4 | store_dimension
 fk_store_orders_employee  | store_orders_fact |                5 | employee_dimension
 fk_store_sales_promotion  | store_sales_fact  |                5 | promotion_dimension
 fk_online_sales_customer  | online_sales_fact |                5 | customer_dimension
 fk_store_sales_customer   | store_sales_fact  |                6 | customer_dimension
 fk_online_sales_cc        | online_sales_fact |                6 | call_center_dimension
 fk_store_sales_employee   | store_sales_fact  |                7 | employee_dimension
 fk_online_sales_op        | online_sales_fact |                7 | online_page_dimension
 fk_online_sales_shipping  | online_sales_fact |                8 | shipping_dimension
 fk_online_sales_warehouse | online_sales_fact |                9 | warehouse_dimension
 fk_online_sales_promotion | online_sales_fact |               10 | promotion_dimension
(26 rows)