How to view table foreign keys (FKs) in pgAdmin

This guide will show you how you can view table foreign key constraints in pgAdmin 4, most popular administration and development tool for PostgreSQL.

Table

To view table FKs you need to find and select the table first.

View FKs in Constraints folder

When you expand the table element and then Constraints element underneath (in the Tree Control), you will see list of foreign key constraints - those are the items with gray key icon.

When you select key and go to Properties in the browser you will see the details of this FK. Foreign and primary columns are visible at the bottom in Columns section (purple rectangle). However, you cannot see here the primary table.

View FKs in Constraint Dependencies

You can see more details in the first Dependencies tab. There will be 3 elements and the one with type of Column will be foreign and primary table and column.

In case below film.language_id is a foreign column (in film table) and language.language_id is a primary column (in language table).

View FK details in Constraint Properties

There's yet another way to see foreign key details. Right click on key and choose Properties option from context menu.

Go to Columns tab in a properties dialog. References field (purple rectangle) shows primary table and table below (orange rectangle) pairs of foreign (Local) and primary (Referenced) columns.

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.