Ethan Shoe
Ethan Shoe

Reputation: 564

Is there a way to find all tables that reference another table/column in DBeaver?

I have a relatively large DBeaver database and am trying to find all tables and possibly columns reference a specific table/column. I can't find anything on SO or anywhere else relating to this question. Any help would be appreciated, thanks.

Upvotes: 6

Views: 20032

Answers (3)

Rajesh K Grover
Rajesh K Grover

Reputation: 21

Found this way out in DBeaver:-

SELECT * FROM ALL_TAB_COLUMNS;

Upvotes: 2

Lefteris Xris
Lefteris Xris

Reputation: 1000

Feature Support

Since DBeaver 7.0.0, this has been added as a Major Feature in Table objects (it is major because it exists on any table expandable view).

Their release notes (github or official page) are not very detailed, unfortunately. However, I will provide an overview of the feature at it is really helpful.

References - Feature Overview

Here is a brief overview of how it works:

  1. From Database Navigator go to the table you want
  2. Select the expand icon
  3. Select the References option

Any references to your table will be listed below. Note that, each table may have zero, one, or more references to your table.

  1. If you just want to get the list of tables (with possible duplicates as mentioned before), you can select all the references, right-click, and from the context menu select Copy Advanced Info. This will copy to your clipboard the references in the following form: [Schema].[OwnerTable].[ReferenceName] from which you can isolate the table names.
  2. Also, a more detailed view is available on double-click References

References - Demonstration Example

As a demonstration, I will use one of the most popular sample databases, the Chinook database. It's always freely available on github

Suppose that you need to know which tables are referencing the table Track.

From Navigator

Dbeaver References Demonstration

Or more detailed view with double click

Dbeaver References Detailed Demonstration

Upvotes: 7

VandeputHendrik
VandeputHendrik

Reputation: 107

This is possible in the interface through the UML view.

  1. Open the table you want to find the related tables of
  2. In the top menu click on ER Diagram (next to Properties and Data)

Upvotes: 2

Related Questions