FOREIGNKEYS System Table Description

Description

Contains information about any foreign keys defined in your database.

Fields

Field Type Description
PRIMARYTABLEID integer TABLEID from SYSTEM.TABLES for the referenced table of the foreign key (see TABLES System Table Description
PRIMARYFIELDID integer FIELDID from SYSTEM.FIELDS for the referenced field in the referenced table of the foreign key (see FIELDS System Table Description)
FOREIGNTABLEID integer TABLEID from SYSTEM.TABLES for the table containing the foreign key FOREIGNFIELDID integer
FOREIGNFIELDID integer FIELDID from SYSTEM.FIELDS for the field in the table defined by the foreign key
NUMBERKEYS integer Number of keys in the definition of this foreign key
POSITION integer Position of this specified field in the foreign key definition
UPDATERULE smallint Unused
DELETERULE smallint
  • importedKeyCascade = 0;
  • importedKeyRestrict = 1;
  • importedKeySetNull = 2;
  • importedKeyNoAction = 3;
  • importedKeySetDefault = 4;
  • importedKeyInitiallyDeferred = 5;
  • importedKeyInitiallyImmediate = 6;
  • importedKeyNotDeferrable = 7;
DEFERRABILITY smallint

Unused

FOREIGNKEYNAME string

The name of the foreign key constraint. If you create a foreign key constraint without specifying a name for it then NuoDB SQL automatically generates a name in the following format:

FK_schema_tablename_columns#referenced-table-schema_referenced-tablename_referenced-columns

where:

  • schema is the name of the schema for the table with this foreign key constraint
  • tablename is the name of the table with this foreign key constraint
  • columns is one or more columns, separated by underscores, that define this foreign key constraint
  • referenced-table-schema is the name of the schema for the table being refereced by this foreign key constraint
  • referenced-tablename is the name of the table being referenced by this foreign key constraint
  • referenced-columns is one or more columns, separated by underscores, that defines the columns being referenced by this foreign key constraint

The column has a default value of "FKDefault"

Indexes

Primary Index: FOREIGNKEYS..PRIMARY_KEY on fields: FOREIGNTABLEID, PRIMARYTABLEID, FOREIGNFIELDID
Secondary Index: FOREIGNKEYSINDEX on field: PRIMARYTABLEID