DBeaver ER Diagram Not Showing Relationships? Three Causes and the Fix
For DBeaver users whose ER diagram shows two related tables with no line between them. Every check and fix below is a statement you can run.
On this page
You open the ER diagram in DBeaver, and two tables that you know are related sit side by side with no line between them. DBeaver draws a line only for a foreign key that the database holds and reports. A line goes missing for one of three reasons:
| Cause | How to tell | Fix |
|---|---|---|
| The foreign key was never declared | The foreign key query below lists no key for the table | Declare the key, or add a virtual foreign key in DBeaver |
| MySQL dropped the key from a MyISAM table | No key, and the table's DDL ends in ENGINE=MyISAM | Convert the table to InnoDB, then declare the key |
| DBeaver didn't read the key | The foreign key query lists the key | Press Refresh under the diagram, then download a newer driver |
To find your cause, run this foreign key query. It works on MySQL and PostgreSQL. Replace shop with the name of your schema:
SELECT table_name, constraint_name
FROM information_schema.table_constraints
WHERE constraint_type = 'FOREIGN KEY'
AND table_schema = 'shop';
Free Community Edition plus a 15-day Architect trial. No signup. Windows, macOS and Linux.
The foreign key was never declared
DBeaver reads the foreign keys from the database and draws one line for each. Take three tables:
CREATE TABLE customers (id INT PRIMARY KEY, name VARCHAR(50));
CREATE TABLE orders (id INT PRIMARY KEY, customer_id INT,
FOREIGN KEY (customer_id) REFERENCES customers (id));
CREATE TABLE invoices (id INT PRIMARY KEY, order_id INT);
The invoices.order_id column holds an order's id, but no foreign key says so. On MySQL 9.1, the foreign key query finds one key:
| TABLE_NAME | CONSTRAINT_NAME |
|---|---|
| orders | orders_ibfk_1 |
On PostgreSQL 18.6, the same key is named orders_customer_id_fkey. DBeaver draws a line between orders and customers. No line connects invoices to orders.
If you can change the database, declare the key. The statement runs on MySQL and PostgreSQL:
ALTER TABLE invoices
ADD FOREIGN KEY (order_id) REFERENCES orders (id);
The foreign key query now lists both keys on MySQL:
| TABLE_NAME | CONSTRAINT_NAME |
|---|---|
| invoices | invoices_ibfk_1 |
| orders | orders_ibfk_1 |
Press Refresh in the toolbar under the diagram. Refresh reloads the diagram with the changes made in the database, as DBeaver's ER diagram documentation says.
If you can't change the database, add a virtual foreign key in DBeaver. DBeaver saves a virtual foreign key in its own file, data-sources.json, and never in the database. Open the table's Properties editor, select the Virtual tab, and click Add under Virtual Foreign/Unique Keys. You can also drag one column onto another in the diagram. The steps are on the Virtual Keys page of the wiki of DBeaver Community, the free and open-source edition.
MySQL dropped the key from a MyISAM table
MySQL stores each table through a storage engine. InnoDB, the default engine, supports foreign keys, and MyISAM doesn't. For an engine without foreign keys, MySQL "parses and ignores foreign key specifications", as the MySQL manual says. Here is a payments table in MyISAM:
CREATE TABLE payments (id INT PRIMARY KEY, order_id INT,
FOREIGN KEY (order_id) REFERENCES orders (id)) ENGINE=MyISAM;
The statement succeeds, and SHOW WARNINGS returns an empty set. The foreign key query lists no key for payments. SHOW CREATE TABLE payments shows what MySQL kept:
CREATE TABLE `payments` (
`id` int NOT NULL,
`order_id` int DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
MySQL turned the FOREIGN KEY clause into a plain index. Without the key, MySQL checks nothing: INSERT INTO payments VALUES (1, 999) succeeds, although no order 999 exists.
To get the key, convert payments to InnoDB, then declare the key:
ALTER TABLE payments ENGINE=InnoDB;
ALTER TABLE payments ADD FOREIGN KEY (order_id) REFERENCES orders (id);
The second statement fails, because payment 1 points at order 999, and no such order exists:
ERROR 1452 (23000) at line 2: Cannot add or update a child row: a foreign key constraint fails (`shop`.`#sql-1_17`, CONSTRAINT `payments_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`))
Delete the payments that point at no order:
DELETE FROM payments
WHERE order_id NOT IN (SELECT id FROM orders);
The DELETE removes one row. Run the second ALTER TABLE again, and MySQL adds the key: the foreign key query then lists payments_ibfk_1.
DBeaver didn't read the key
If the foreign key query lists the key and the diagram shows no line, press Refresh under the diagram first.
If the line is still missing, the JDBC driver may not report foreign keys. In a DuckDB issue opened in October 2023, DBeaver 23.2.3 drew no foreign keys for a DuckDB database. The DuckDB driver lacked getImportedKeys, the JDBC call that reports foreign keys. A driver fix closed the issue in December 2025.
To get a newer driver, open DBeaver's Driver Manager, select the driver of your database, go to the Libraries tab, and click Download/Update.
How to open and export DBeaver's ER diagram
- Double-click a table or a schema in the navigator on the left.
- Open the Diagram tab of the editor.
- To change the notation, such as IDEF1X or Crow's Foot, right-click the diagram and choose Notation.
- To export, click Save diagram in external format in the toolbar. It saves SVG, PNG, GIF, BMP or GraphML, and the documentation marks only SVG "Available only in PRO".
Diagrams are read-only by default. In Edit mode, DBeaver turns changes in the diagram, such as a new foreign key, into an SQL script. The Edit mode page puts Edit mode in the Enterprise and Ultimate editions only. Here is a diagram in DBeaver Enterprise 25.0, with Refresh and Edit Mode in the toolbar under it:
The DBeaver pages in this article were checked on 12 November 2026.
Drawing the missing relations in DbSchema
DbSchema Community Edition connects to the same database and reverse-engineers it into an interactive ER diagram. DbSchema draws a relation that the database lacks as a virtual foreign key. Drag the referencing column onto the column it points at, tick Virtual in the New Foreign Key dialog, and press OK. DbSchema draws the virtual foreign key in another color:
The virtual foreign key exists only in the DbSchema model, never in the database. Model → Find Virtual Foreign Keys suggests virtual foreign keys between columns with matching names. While DbSchema is connected, a foreign key drawn with Virtual unticked is created in the database at once.
Download DbSchema and connect it to the database whose diagram has missing lines. The free Community Edition reverse-engineers the schema and draws virtual foreign keys. Saving them in a model file needs DbSchema Pro. The Query Builder and the Data Explorer, also in DbSchema Pro, follow virtual foreign keys like real ones.
Draw the relations your database never declared
DbSchema reverse-engineers the same database into an editable diagram and draws the missing lines as virtual foreign keys. Connecting and reverse-engineering are free in the Community Edition.