Information Schema INNODB_SYS_FOREIGN_COLS Table
The INNODB_SYS_FOREIGN_COLS table maps columns to their respective foreign key constraints within the InnoDB storage engine.
The Information Schema INNODB_SYS_FOREIGN_COLS table contains information about InnoDB foreign key columns.
The PROCESS privilege is required to view the table.
It has the following columns:
ID
Foreign key index associated with this column, matching the INNODB_SYS_FOREIGN.ID field.
Prior to MariaDB 12.1, this is preceded by the database name. From MariaDB 12.1, foreign key names are only required to be unique per table, not per database, so the redundant database name is not shown.
FOR_COL_NAME
Child column name.
REF_COL_NAME
Parent column name.
POS
Ordinal position of the column in the table, starting from 0.
Examples
Prior to MariaDB 12.1:
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS\G
*************************** 1. row ***************************
ID: test/fk_book_author
FOR_COL_NAME: author_id
REF_COL_NAME: id
POS: 0From MariaDB 12.1:
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS\G
*************************** 1. row ***************************
ID: fk_book_author
FOR_COL_NAME: author_id
REF_COL_NAME: id
POS: 0This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

