Using PGAdmin (or other free tools), is there a way to explore PostgreSQL table data via Foreign Keys?

Let's say I have already selected a single record of a table via primary key (a surrogate key). Now, I'd like to look at some/all data that is related to this record via Foreign Keys. PGAdmin knows what table I've selected the data from, and it knows the Foreign Key definitions. I'm imagining something like:

  • right click on an FK value, a context menu pops up, "show related data", which auto-generates an SQL query to select data from the referenced table, and then runs it and shows the results. A similar feature, but going the other way, would also be great: right click the primary surrogate key and a context menu pops up, one option says "view data referencing this record", which auto-generates SQL queries which select records from tables that have data referencing the current record. (Ie, gets data from tables that have an FK referencing the current table, and filtering by the record I'm currently looking at)

    - or -

  • a tool similar to "ERD" generator, but instead of showing table relationships, it shows data. It would need to ask for a starting table and an id of a record from that table, but then it could auto-generate an SQL query that selects data from related tables based on Foreign Keys. I know there could be cyclical references, or self-referential data, and I know that it would not be uncommon for all of the data in the db to be related via Foreign Keys, etc. But a "smart" feature that limits the number of references followed, or similar, could be used to mitigate such scenarios.

I know I could write a query to JOIN based on FK's, and I have the skills to do that. But, I'm wondering if there is a free GUI tool out there to explore data easily via FK relationships. I'm already using PGAdmin4 (web), but willing to use other free software instead.

What I've tried: Web search for a feature like this. Maybe I'm not using the right terms


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.