Топ-100
top of page
Волнистый абстрактный фон
CerebroSQL

PostgreSQL: table foreign keys

A foreign key constraint specifies that the values of a column (or group of columns) must match the values in some row of another table. This is called the referential integrity of two related tables.

The FOREIGN node displays information on all foreign keys created in the table

PostgreSQL table foreign

SELECT oid, conname, 
      pg_catalog.pg_get_constraintdef(r.oid, true) as condef,
      conrelid::pg_catalog.regclass AS ontable 
 FROM pg_catalog.pg_constraint r 
WHERE r.conrelid = $$TABLEOID
  AND r.contype = 'f'
  AND conparentid = 0 
ORDER BY conname  

bottom of page