top of page

SQL developer for PostgreSQL

Открытая·3 пользователя

PostgreSQL: table foreign keys



[EN]

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 referential integrity of two related tables.

​

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


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


[RU]

Ограничение внешнего ключа указывает, что значения столбца (или группы столбцов) должны соответствовать значениям в некоторой строке другой таблицы. Это называется ссылочной целостностью двух связанных таблиц.

​

Узел 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


10 просмотров
bottom of page